Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
c13ae34b
Commit
c13ae34b
authored
Jan 14, 2015
by
Daniel Smith
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3445 from saad-ali/fix3172
Remove CONDITION from event object completely
parents
88c68e03
90dfdcec
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
61 additions
and
101 deletions
+61
-101
types.go
pkg/api/types.go
+2
-11
conversion.go
pkg/api/v1beta1/conversion.go
+0
-3
types.go
pkg/api/v1beta1/types.go
+1
-0
conversion.go
pkg/api/v1beta2/conversion.go
+0
-2
types.go
pkg/api/v1beta2/types.go
+1
-0
types.go
pkg/api/v1beta3/types.go
+1
-11
events_test.go
pkg/client/events_test.go
+0
-3
event.go
pkg/client/record/event.go
+8
-10
event_test.go
pkg/client/record/event_test.go
+17
-21
resource_printer.go
pkg/kubecfg/resource_printer.go
+2
-3
describe.go
pkg/kubectl/describe.go
+1
-2
resource_printer.go
pkg/kubectl/resource_printer.go
+2
-3
config.go
pkg/kubelet/config/config.go
+1
-1
kubelet.go
pkg/kubelet/kubelet.go
+12
-12
rest.go
pkg/registry/event/rest.go
+0
-2
rest_test.go
pkg/registry/event/rest_test.go
+10
-14
scheduler.go
plugin/pkg/scheduler/scheduler.go
+3
-3
No files found.
pkg/api/types.go
View file @
c13ae34b
...
@@ -1038,18 +1038,9 @@ type Event struct {
...
@@ -1038,18 +1038,9 @@ type Event struct {
// Required. The object that this event is about.
// Required. The object that this event is about.
InvolvedObject
ObjectReference
`json:"involvedObject,omitempty"`
InvolvedObject
ObjectReference
`json:"involvedObject,omitempty"`
// Should be a short, machine understandable string that describes the current condition
// of the referred object. This should not give the reason for being in this state.
// Examples: "Running", "CantStart", "CantSchedule", "Deleted".
// It's OK for components to make up conditions to report here, but the same string should
// always be used for the same conditions.
// TODO: define a way of making sure these are consistent and don't collide.
// TODO: provide exact specification for format.
Condition
string
`json:"condition,omitempty"`
// Optional; this should be a short, machine understandable string that gives the reason
// Optional; this should be a short, machine understandable string that gives the reason
// for th
e transition into the object's current condition. For example, if ObjectCondition is
// for th
is event being generated. For example, if the event is reporting that a container
//
"CantStart", Status
Reason might be "ImageNotFound".
//
can't start, the
Reason might be "ImageNotFound".
// TODO: provide exact specification for format.
// TODO: provide exact specification for format.
Reason
string
`json:"reason,omitempty"`
Reason
string
`json:"reason,omitempty"`
...
...
pkg/api/v1beta1/conversion.go
View file @
c13ae34b
...
@@ -562,7 +562,6 @@ func init() {
...
@@ -562,7 +562,6 @@ func init() {
return
nil
return
nil
},
},
// Event Status <-> Condition
// Event Source <-> Source.Component
// Event Source <-> Source.Component
// Event Host <-> Source.Host
// Event Host <-> Source.Host
// TODO: remove this when it becomes possible to specify a field name conversion on a specific type
// TODO: remove this when it becomes possible to specify a field name conversion on a specific type
...
@@ -573,7 +572,6 @@ func init() {
...
@@ -573,7 +572,6 @@ func init() {
if
err
:=
s
.
Convert
(
&
in
.
ObjectMeta
,
&
out
.
TypeMeta
,
0
);
err
!=
nil
{
if
err
:=
s
.
Convert
(
&
in
.
ObjectMeta
,
&
out
.
TypeMeta
,
0
);
err
!=
nil
{
return
err
return
err
}
}
out
.
Status
=
in
.
Condition
out
.
Reason
=
in
.
Reason
out
.
Reason
=
in
.
Reason
out
.
Message
=
in
.
Message
out
.
Message
=
in
.
Message
out
.
Source
=
in
.
Source
.
Component
out
.
Source
=
in
.
Source
.
Component
...
@@ -588,7 +586,6 @@ func init() {
...
@@ -588,7 +586,6 @@ func init() {
if
err
:=
s
.
Convert
(
&
in
.
TypeMeta
,
&
out
.
ObjectMeta
,
0
);
err
!=
nil
{
if
err
:=
s
.
Convert
(
&
in
.
TypeMeta
,
&
out
.
ObjectMeta
,
0
);
err
!=
nil
{
return
err
return
err
}
}
out
.
Condition
=
in
.
Status
out
.
Reason
=
in
.
Reason
out
.
Reason
=
in
.
Reason
out
.
Message
=
in
.
Message
out
.
Message
=
in
.
Message
out
.
Source
.
Component
=
in
.
Source
out
.
Source
.
Component
=
in
.
Source
...
...
pkg/api/v1beta1/types.go
View file @
c13ae34b
...
@@ -809,6 +809,7 @@ type Event struct {
...
@@ -809,6 +809,7 @@ type Event struct {
// always be used for the same status.
// always be used for the same status.
// TODO: define a way of making sure these are consistent and don't collide.
// TODO: define a way of making sure these are consistent and don't collide.
// TODO: provide exact specification for format.
// TODO: provide exact specification for format.
// DEPRECATED: Status (a.k.a Condition) value will be ignored.
Status
string
`json:"status,omitempty" description:"short, machine understandable string that describes the current status of the referred object"`
Status
string
`json:"status,omitempty" description:"short, machine understandable string that describes the current status of the referred object"`
// Optional; this should be a short, machine understandable string that gives the reason
// Optional; this should be a short, machine understandable string that gives the reason
...
...
pkg/api/v1beta2/conversion.go
View file @
c13ae34b
...
@@ -489,7 +489,6 @@ func init() {
...
@@ -489,7 +489,6 @@ func init() {
if
err
:=
s
.
Convert
(
&
in
.
ObjectMeta
,
&
out
.
TypeMeta
,
0
);
err
!=
nil
{
if
err
:=
s
.
Convert
(
&
in
.
ObjectMeta
,
&
out
.
TypeMeta
,
0
);
err
!=
nil
{
return
err
return
err
}
}
out
.
Status
=
in
.
Condition
out
.
Reason
=
in
.
Reason
out
.
Reason
=
in
.
Reason
out
.
Message
=
in
.
Message
out
.
Message
=
in
.
Message
out
.
Source
=
in
.
Source
.
Component
out
.
Source
=
in
.
Source
.
Component
...
@@ -504,7 +503,6 @@ func init() {
...
@@ -504,7 +503,6 @@ func init() {
if
err
:=
s
.
Convert
(
&
in
.
TypeMeta
,
&
out
.
ObjectMeta
,
0
);
err
!=
nil
{
if
err
:=
s
.
Convert
(
&
in
.
TypeMeta
,
&
out
.
ObjectMeta
,
0
);
err
!=
nil
{
return
err
return
err
}
}
out
.
Condition
=
in
.
Status
out
.
Reason
=
in
.
Reason
out
.
Reason
=
in
.
Reason
out
.
Message
=
in
.
Message
out
.
Message
=
in
.
Message
out
.
Source
.
Component
=
in
.
Source
out
.
Source
.
Component
=
in
.
Source
...
...
pkg/api/v1beta2/types.go
View file @
c13ae34b
...
@@ -782,6 +782,7 @@ type Event struct {
...
@@ -782,6 +782,7 @@ type Event struct {
// always be used for the same status.
// always be used for the same status.
// TODO: define a way of making sure these are consistent and don't collide.
// TODO: define a way of making sure these are consistent and don't collide.
// TODO: provide exact specification for format.
// TODO: provide exact specification for format.
// DEPRECATED: Status (a.k.a Condition) value will be ignored.
Status
string
`json:"status,omitempty" description:"short, machine understandable string that describes the current status of the referred object"`
Status
string
`json:"status,omitempty" description:"short, machine understandable string that describes the current status of the referred object"`
// Optional; this should be a short, machine understandable string that gives the reason
// Optional; this should be a short, machine understandable string that gives the reason
...
...
pkg/api/v1beta3/types.go
View file @
c13ae34b
...
@@ -1029,18 +1029,8 @@ type Event struct {
...
@@ -1029,18 +1029,8 @@ type Event struct {
// Required. The object that this event is about.
// Required. The object that this event is about.
InvolvedObject
ObjectReference
`json:"involvedObject,omitempty"`
InvolvedObject
ObjectReference
`json:"involvedObject,omitempty"`
// Should be a short, machine understandable string that describes the current condition
// of the referred object. This should not give the reason for being in this state.
// Examples: "Running", "CantStart", "CantSchedule", "Deleted".
// It's OK for components to make up conditions to report here, but the same string should
// always be used for the same conditions.
// TODO: define a way of making sure these are consistent and don't collide.
// TODO: provide exact specification for format.
Condition
string
`json:"condition,omitempty"`
// Optional; this should be a short, machine understandable string that gives the reason
// Optional; this should be a short, machine understandable string that gives the reason
// for the transition into the object's current condition. For example, if ObjectCondition is
// for this event being generated.
// "CantStart", StatusReason might be "ImageNotFound".
// TODO: provide exact specification for format.
// TODO: provide exact specification for format.
Reason
string
`json:"reason,omitempty"`
Reason
string
`json:"reason,omitempty"`
...
...
pkg/client/events_test.go
View file @
c13ae34b
...
@@ -63,7 +63,6 @@ func TestEventCreate(t *testing.T) {
...
@@ -63,7 +63,6 @@ func TestEventCreate(t *testing.T) {
timeStamp
:=
util
.
Now
()
timeStamp
:=
util
.
Now
()
event
:=
&
api
.
Event
{
event
:=
&
api
.
Event
{
//namespace: namespace{"default"},
//namespace: namespace{"default"},
Condition
:
"Running"
,
InvolvedObject
:
*
objReference
,
InvolvedObject
:
*
objReference
,
Timestamp
:
timeStamp
,
Timestamp
:
timeStamp
,
}
}
...
@@ -98,7 +97,6 @@ func TestEventGet(t *testing.T) {
...
@@ -98,7 +97,6 @@ func TestEventGet(t *testing.T) {
}
}
timeStamp
:=
util
.
Now
()
timeStamp
:=
util
.
Now
()
event
:=
&
api
.
Event
{
event
:=
&
api
.
Event
{
Condition
:
"Running"
,
InvolvedObject
:
*
objReference
,
InvolvedObject
:
*
objReference
,
Timestamp
:
timeStamp
,
Timestamp
:
timeStamp
,
}
}
...
@@ -136,7 +134,6 @@ func TestEventList(t *testing.T) {
...
@@ -136,7 +134,6 @@ func TestEventList(t *testing.T) {
eventList
:=
&
api
.
EventList
{
eventList
:=
&
api
.
EventList
{
Items
:
[]
api
.
Event
{
Items
:
[]
api
.
Event
{
{
{
Condition
:
"Running"
,
InvolvedObject
:
*
objReference
,
InvolvedObject
:
*
objReference
,
Timestamp
:
timeStamp
,
Timestamp
:
timeStamp
,
},
},
...
...
pkg/client/record/event.go
View file @
c13ae34b
...
@@ -93,7 +93,7 @@ func StartRecording(recorder EventRecorder, source api.EventSource) watch.Interf
...
@@ -93,7 +93,7 @@ func StartRecording(recorder EventRecorder, source api.EventSource) watch.Interf
// return value can be ignored or used to stop logging, if desired.
// return value can be ignored or used to stop logging, if desired.
func
StartLogging
(
logf
func
(
format
string
,
args
...
interface
{}))
watch
.
Interface
{
func
StartLogging
(
logf
func
(
format
string
,
args
...
interface
{}))
watch
.
Interface
{
return
GetEvents
(
func
(
e
*
api
.
Event
)
{
return
GetEvents
(
func
(
e
*
api
.
Event
)
{
logf
(
"Event(%#v):
status: '%v', reason: '%v' %v"
,
e
.
InvolvedObject
,
e
.
Condition
,
e
.
Reason
,
e
.
Message
)
logf
(
"Event(%#v):
reason: '%v' %v"
,
e
.
InvolvedObject
,
e
.
Reason
,
e
.
Message
)
})
})
}
}
...
@@ -127,17 +127,16 @@ var events = watch.NewBroadcaster(queueLen)
...
@@ -127,17 +127,16 @@ var events = watch.NewBroadcaster(queueLen)
// Event constructs an event from the given information and puts it in the queue for sending.
// Event constructs an event from the given information and puts it in the queue for sending.
// 'object' is the object this event is about. Event will make a reference-- or you may also
// 'object' is the object this event is about. Event will make a reference-- or you may also
// pass a reference to the object directly.
// pass a reference to the object directly.
// 'condition' is the new condition of the object. 'reason' is the reason it now has this status.
// 'reason' is the reason this event is generated. 'reason' should be short and unique; it will
// Both 'condition' and 'reason' should be short and unique; they will be used to automate
// be used to automate handling of events, so imagine people writing switch statements to
// handling of events, so imagine people writing switch statements to handle them. You want to
// handle them. You want to make that easy.
// make that easy.
// 'message' is intended to be human readable.
// 'message' is intended to be human readable.
//
//
// The resulting event will be created in the same namespace as the reference object.
// The resulting event will be created in the same namespace as the reference object.
func
Event
(
object
runtime
.
Object
,
condition
,
reason
,
message
string
)
{
func
Event
(
object
runtime
.
Object
,
reason
,
message
string
)
{
ref
,
err
:=
api
.
GetReference
(
object
)
ref
,
err
:=
api
.
GetReference
(
object
)
if
err
!=
nil
{
if
err
!=
nil
{
glog
.
Errorf
(
"Could not construct reference to: '%#v' due to: '%v'. Will not report event: '%v' '%v'
'%v'"
,
object
,
err
,
condition
,
reason
,
message
)
glog
.
Errorf
(
"Could not construct reference to: '%#v' due to: '%v'. Will not report event: '%v' '%v'
"
,
object
,
err
,
reason
,
message
)
return
return
}
}
t
:=
util
.
Now
()
t
:=
util
.
Now
()
...
@@ -148,7 +147,6 @@ func Event(object runtime.Object, condition, reason, message string) {
...
@@ -148,7 +147,6 @@ func Event(object runtime.Object, condition, reason, message string) {
Namespace
:
ref
.
Namespace
,
Namespace
:
ref
.
Namespace
,
},
},
InvolvedObject
:
*
ref
,
InvolvedObject
:
*
ref
,
Condition
:
condition
,
Reason
:
reason
,
Reason
:
reason
,
Message
:
message
,
Message
:
message
,
Timestamp
:
t
,
Timestamp
:
t
,
...
@@ -158,6 +156,6 @@ func Event(object runtime.Object, condition, reason, message string) {
...
@@ -158,6 +156,6 @@ func Event(object runtime.Object, condition, reason, message string) {
}
}
// Eventf is just like Event, but with Sprintf for the message field.
// Eventf is just like Event, but with Sprintf for the message field.
func
Eventf
(
object
runtime
.
Object
,
status
,
reason
,
messageFmt
string
,
args
...
interface
{})
{
func
Eventf
(
object
runtime
.
Object
,
reason
,
messageFmt
string
,
args
...
interface
{})
{
Event
(
object
,
status
,
reason
,
fmt
.
Sprintf
(
messageFmt
,
args
...
))
Event
(
object
,
reason
,
fmt
.
Sprintf
(
messageFmt
,
args
...
))
}
}
pkg/client/record/event_test.go
View file @
c13ae34b
...
@@ -64,16 +64,15 @@ func TestEventf(t *testing.T) {
...
@@ -64,16 +64,15 @@ func TestEventf(t *testing.T) {
t
.
Fatal
(
err
)
t
.
Fatal
(
err
)
}
}
table
:=
[]
struct
{
table
:=
[]
struct
{
obj
runtime
.
Object
obj
runtime
.
Object
status
,
reason
string
reason
string
messageFmt
string
messageFmt
string
elements
[]
interface
{}
elements
[]
interface
{}
expect
*
api
.
Event
expect
*
api
.
Event
expectLog
string
expectLog
string
}{
}{
{
{
obj
:
testRef
,
obj
:
testRef
,
status
:
"Running"
,
reason
:
"Started"
,
reason
:
"Started"
,
messageFmt
:
"some verbose message: %v"
,
messageFmt
:
"some verbose message: %v"
,
elements
:
[]
interface
{}{
1
},
elements
:
[]
interface
{}{
1
},
...
@@ -90,16 +89,14 @@ func TestEventf(t *testing.T) {
...
@@ -90,16 +89,14 @@ func TestEventf(t *testing.T) {
APIVersion
:
"v1beta1"
,
APIVersion
:
"v1beta1"
,
FieldPath
:
"desiredState.manifest.containers[2]"
,
FieldPath
:
"desiredState.manifest.containers[2]"
,
},
},
Condition
:
"Running"
,
Reason
:
"Started"
,
Reason
:
"Started"
,
Message
:
"some verbose message: 1"
,
Message
:
"some verbose message: 1"
,
Source
:
api
.
EventSource
{
Component
:
"eventTest"
},
Source
:
api
.
EventSource
{
Component
:
"eventTest"
},
},
},
expectLog
:
`Event(api.ObjectReference{Kind:"Pod", Namespace:"baz", Name:"foo", UID:"bar", APIVersion:"v1beta1", ResourceVersion:"", FieldPath:"desiredState.manifest.containers[2]"}):
status: 'Running',
reason: 'Started' some verbose message: 1`
,
expectLog
:
`Event(api.ObjectReference{Kind:"Pod", Namespace:"baz", Name:"foo", UID:"bar", APIVersion:"v1beta1", ResourceVersion:"", FieldPath:"desiredState.manifest.containers[2]"}): reason: 'Started' some verbose message: 1`
,
},
},
{
{
obj
:
testPod
,
obj
:
testPod
,
status
:
"Running"
,
reason
:
"Started"
,
reason
:
"Started"
,
messageFmt
:
"some verbose message: %v"
,
messageFmt
:
"some verbose message: %v"
,
elements
:
[]
interface
{}{
1
},
elements
:
[]
interface
{}{
1
},
...
@@ -115,12 +112,11 @@ func TestEventf(t *testing.T) {
...
@@ -115,12 +112,11 @@ func TestEventf(t *testing.T) {
UID
:
"bar"
,
UID
:
"bar"
,
APIVersion
:
"v1beta1"
,
APIVersion
:
"v1beta1"
,
},
},
Condition
:
"Running"
,
Reason
:
"Started"
,
Reason
:
"Started"
,
Message
:
"some verbose message: 1"
,
Message
:
"some verbose message: 1"
,
Source
:
api
.
EventSource
{
Component
:
"eventTest"
},
Source
:
api
.
EventSource
{
Component
:
"eventTest"
},
},
},
expectLog
:
`Event(api.ObjectReference{Kind:"Pod", Namespace:"baz", Name:"foo", UID:"bar", APIVersion:"v1beta1", ResourceVersion:"", FieldPath:""}):
status: 'Running',
reason: 'Started' some verbose message: 1`
,
expectLog
:
`Event(api.ObjectReference{Kind:"Pod", Namespace:"baz", Name:"foo", UID:"bar", APIVersion:"v1beta1", ResourceVersion:"", FieldPath:""}): reason: 'Started' some verbose message: 1`
,
},
},
}
}
...
@@ -155,7 +151,7 @@ func TestEventf(t *testing.T) {
...
@@ -155,7 +151,7 @@ func TestEventf(t *testing.T) {
called
<-
struct
{}{}
called
<-
struct
{}{}
})
})
Eventf
(
item
.
obj
,
item
.
status
,
item
.
reason
,
item
.
messageFmt
,
item
.
elements
...
)
Eventf
(
item
.
obj
,
item
.
reason
,
item
.
messageFmt
,
item
.
elements
...
)
<-
called
<-
called
<-
called
<-
called
...
@@ -231,9 +227,9 @@ func TestWriteEventError(t *testing.T) {
...
@@ -231,9 +227,9 @@ func TestWriteEventError(t *testing.T) {
)
.
Stop
()
)
.
Stop
()
for
caseName
:=
range
table
{
for
caseName
:=
range
table
{
Event
(
ref
,
"
Status"
,
"
Reason"
,
caseName
)
Event
(
ref
,
"Reason"
,
caseName
)
}
}
Event
(
ref
,
"
Status"
,
"
Reason"
,
"finished"
)
Event
(
ref
,
"Reason"
,
"finished"
)
<-
done
<-
done
for
caseName
,
item
:=
range
table
{
for
caseName
,
item
:=
range
table
{
...
...
pkg/kubecfg/resource_printer.go
View file @
c13ae34b
...
@@ -143,7 +143,7 @@ var replicationControllerColumns = []string{"Name", "Image(s)", "Selector", "Rep
...
@@ -143,7 +143,7 @@ var replicationControllerColumns = []string{"Name", "Image(s)", "Selector", "Rep
var
serviceColumns
=
[]
string
{
"Name"
,
"Labels"
,
"Selector"
,
"IP"
,
"Port"
}
var
serviceColumns
=
[]
string
{
"Name"
,
"Labels"
,
"Selector"
,
"IP"
,
"Port"
}
var
minionColumns
=
[]
string
{
"Minion identifier"
,
"Labels"
}
var
minionColumns
=
[]
string
{
"Minion identifier"
,
"Labels"
}
var
statusColumns
=
[]
string
{
"Status"
}
var
statusColumns
=
[]
string
{
"Status"
}
var
eventColumns
=
[]
string
{
"Name"
,
"Kind"
,
"
Condition"
,
"
Reason"
,
"Message"
}
var
eventColumns
=
[]
string
{
"Name"
,
"Kind"
,
"Reason"
,
"Message"
}
// addDefaultHandlers adds print handlers for default Kubernetes types.
// addDefaultHandlers adds print handlers for default Kubernetes types.
func
(
h
*
HumanReadablePrinter
)
addDefaultHandlers
()
{
func
(
h
*
HumanReadablePrinter
)
addDefaultHandlers
()
{
...
@@ -269,10 +269,9 @@ func printStatus(status *api.Status, w io.Writer) error {
...
@@ -269,10 +269,9 @@ func printStatus(status *api.Status, w io.Writer) error {
func
printEvent
(
event
*
api
.
Event
,
w
io
.
Writer
)
error
{
func
printEvent
(
event
*
api
.
Event
,
w
io
.
Writer
)
error
{
_
,
err
:=
fmt
.
Fprintf
(
_
,
err
:=
fmt
.
Fprintf
(
w
,
"%s
\t
%s
\t
%s
\t
%s
\
t
%s
\
n
"
,
w
,
"%s
\t
%s
\t
%s
\t
%s
\n
"
,
event
.
InvolvedObject
.
Name
,
event
.
InvolvedObject
.
Name
,
event
.
InvolvedObject
.
Kind
,
event
.
InvolvedObject
.
Kind
,
event
.
Condition
,
event
.
Reason
,
event
.
Reason
,
event
.
Message
,
event
.
Message
,
)
)
...
...
pkg/kubectl/describe.go
View file @
c13ae34b
...
@@ -200,13 +200,12 @@ func describeEvents(el *api.EventList, w io.Writer) {
...
@@ -200,13 +200,12 @@ func describeEvents(el *api.EventList, w io.Writer) {
return
return
}
}
sort
.
Sort
(
SortableEvents
(
el
.
Items
))
sort
.
Sort
(
SortableEvents
(
el
.
Items
))
fmt
.
Fprint
(
w
,
"Events:
\n
Time
\t
From
\t
SubobjectPath
\t
Condition
\t
Reason
\t
Message
\n
"
)
fmt
.
Fprint
(
w
,
"Events:
\n
Time
\t
From
\t
SubobjectPath
\t
Reason
\t
Message
\n
"
)
for
_
,
e
:=
range
el
.
Items
{
for
_
,
e
:=
range
el
.
Items
{
fmt
.
Fprintf
(
w
,
"%s
\t
%v
\t
%v
\t
%v
\t
%v
\t
%v
\n
"
,
fmt
.
Fprintf
(
w
,
"%s
\t
%v
\t
%v
\t
%v
\t
%v
\t
%v
\n
"
,
e
.
Timestamp
.
Time
.
Format
(
time
.
RFC1123Z
),
e
.
Timestamp
.
Time
.
Format
(
time
.
RFC1123Z
),
e
.
Source
,
e
.
Source
,
e
.
InvolvedObject
.
FieldPath
,
e
.
InvolvedObject
.
FieldPath
,
e
.
Condition
,
e
.
Reason
,
e
.
Reason
,
e
.
Message
)
e
.
Message
)
}
}
...
...
pkg/kubectl/resource_printer.go
View file @
c13ae34b
...
@@ -220,7 +220,7 @@ var replicationControllerColumns = []string{"CONTROLLER", "CONTAINER(S)", "IMAGE
...
@@ -220,7 +220,7 @@ var replicationControllerColumns = []string{"CONTROLLER", "CONTAINER(S)", "IMAGE
var
serviceColumns
=
[]
string
{
"NAME"
,
"LABELS"
,
"SELECTOR"
,
"IP"
,
"PORT"
}
var
serviceColumns
=
[]
string
{
"NAME"
,
"LABELS"
,
"SELECTOR"
,
"IP"
,
"PORT"
}
var
minionColumns
=
[]
string
{
"NAME"
,
"LABELS"
}
var
minionColumns
=
[]
string
{
"NAME"
,
"LABELS"
}
var
statusColumns
=
[]
string
{
"STATUS"
}
var
statusColumns
=
[]
string
{
"STATUS"
}
var
eventColumns
=
[]
string
{
"TIME"
,
"NAME"
,
"KIND"
,
"SUBOBJECT"
,
"
CONDITION"
,
"
REASON"
,
"SOURCE"
,
"MESSAGE"
}
var
eventColumns
=
[]
string
{
"TIME"
,
"NAME"
,
"KIND"
,
"SUBOBJECT"
,
"REASON"
,
"SOURCE"
,
"MESSAGE"
}
// addDefaultHandlers adds print handlers for default Kubernetes types.
// addDefaultHandlers adds print handlers for default Kubernetes types.
func
(
h
*
HumanReadablePrinter
)
addDefaultHandlers
()
{
func
(
h
*
HumanReadablePrinter
)
addDefaultHandlers
()
{
...
@@ -367,12 +367,11 @@ func printStatus(status *api.Status, w io.Writer) error {
...
@@ -367,12 +367,11 @@ func printStatus(status *api.Status, w io.Writer) error {
func
printEvent
(
event
*
api
.
Event
,
w
io
.
Writer
)
error
{
func
printEvent
(
event
*
api
.
Event
,
w
io
.
Writer
)
error
{
_
,
err
:=
fmt
.
Fprintf
(
_
,
err
:=
fmt
.
Fprintf
(
w
,
"%s
\t
%s
\t
%s
\t
%s
\t
%s
\t
%s
\t
%s
\
t
%s
\
n
"
,
w
,
"%s
\t
%s
\t
%s
\t
%s
\t
%s
\t
%s
\t
%s
\n
"
,
event
.
Timestamp
.
Time
.
Format
(
time
.
RFC1123Z
),
event
.
Timestamp
.
Time
.
Format
(
time
.
RFC1123Z
),
event
.
InvolvedObject
.
Name
,
event
.
InvolvedObject
.
Name
,
event
.
InvolvedObject
.
Kind
,
event
.
InvolvedObject
.
Kind
,
event
.
InvolvedObject
.
FieldPath
,
event
.
InvolvedObject
.
FieldPath
,
event
.
Condition
,
event
.
Reason
,
event
.
Reason
,
event
.
Source
,
event
.
Source
,
event
.
Message
,
event
.
Message
,
...
...
pkg/kubelet/config/config.go
View file @
c13ae34b
...
@@ -305,7 +305,7 @@ func filterInvalidPods(pods []api.BoundPod, source string) (filtered []*api.Boun
...
@@ -305,7 +305,7 @@ func filterInvalidPods(pods []api.BoundPod, source string) (filtered []*api.Boun
name
:=
bestPodIdentString
(
pod
)
name
:=
bestPodIdentString
(
pod
)
err
:=
utilerrors
.
NewAggregate
(
errlist
)
err
:=
utilerrors
.
NewAggregate
(
errlist
)
glog
.
Warningf
(
"Pod[%d] (%s) from %s failed validation, ignoring: %v"
,
i
+
1
,
name
,
source
,
err
)
glog
.
Warningf
(
"Pod[%d] (%s) from %s failed validation, ignoring: %v"
,
i
+
1
,
name
,
source
,
err
)
record
.
Eventf
(
pod
,
"
"
,
"
failedValidation"
,
"Error validating pod %s from %s, ignoring: %v"
,
name
,
source
,
err
)
record
.
Eventf
(
pod
,
"failedValidation"
,
"Error validating pod %s from %s, ignoring: %v"
,
name
,
source
,
err
)
continue
continue
}
}
filtered
=
append
(
filtered
,
pod
)
filtered
=
append
(
filtered
,
pod
)
...
...
pkg/kubelet/kubelet.go
View file @
c13ae34b
...
@@ -641,7 +641,7 @@ func (kl *Kubelet) runContainer(pod *api.BoundPod, container *api.Container, pod
...
@@ -641,7 +641,7 @@ func (kl *Kubelet) runContainer(pod *api.BoundPod, container *api.Container, pod
dockerContainer
,
err
:=
kl
.
dockerClient
.
CreateContainer
(
opts
)
dockerContainer
,
err
:=
kl
.
dockerClient
.
CreateContainer
(
opts
)
if
err
!=
nil
{
if
err
!=
nil
{
if
ref
!=
nil
{
if
ref
!=
nil
{
record
.
Eventf
(
ref
,
"failed"
,
"failed"
,
record
.
Eventf
(
ref
,
"failed"
,
"Failed to create docker container with error: %v"
,
err
)
"Failed to create docker container with error: %v"
,
err
)
}
}
return
""
,
err
return
""
,
err
...
@@ -649,7 +649,7 @@ func (kl *Kubelet) runContainer(pod *api.BoundPod, container *api.Container, pod
...
@@ -649,7 +649,7 @@ func (kl *Kubelet) runContainer(pod *api.BoundPod, container *api.Container, pod
// Remember this reference so we can report events about this container
// Remember this reference so we can report events about this container
if
ref
!=
nil
{
if
ref
!=
nil
{
kl
.
setRef
(
dockertools
.
DockerID
(
dockerContainer
.
ID
),
ref
)
kl
.
setRef
(
dockertools
.
DockerID
(
dockerContainer
.
ID
),
ref
)
record
.
Eventf
(
ref
,
"
waiting"
,
"
created"
,
"Created with docker id %v"
,
dockerContainer
.
ID
)
record
.
Eventf
(
ref
,
"created"
,
"Created with docker id %v"
,
dockerContainer
.
ID
)
}
}
if
len
(
container
.
TerminationMessagePath
)
!=
0
{
if
len
(
container
.
TerminationMessagePath
)
!=
0
{
...
@@ -687,13 +687,13 @@ func (kl *Kubelet) runContainer(pod *api.BoundPod, container *api.Container, pod
...
@@ -687,13 +687,13 @@ func (kl *Kubelet) runContainer(pod *api.BoundPod, container *api.Container, pod
err
=
kl
.
dockerClient
.
StartContainer
(
dockerContainer
.
ID
,
hc
)
err
=
kl
.
dockerClient
.
StartContainer
(
dockerContainer
.
ID
,
hc
)
if
err
!=
nil
{
if
err
!=
nil
{
if
ref
!=
nil
{
if
ref
!=
nil
{
record
.
Eventf
(
ref
,
"failed"
,
"failed"
,
record
.
Eventf
(
ref
,
"failed"
,
"Failed to start with docker id %v with error: %v"
,
dockerContainer
.
ID
,
err
)
"Failed to start with docker id %v with error: %v"
,
dockerContainer
.
ID
,
err
)
}
}
return
""
,
err
return
""
,
err
}
}
if
ref
!=
nil
{
if
ref
!=
nil
{
record
.
Eventf
(
ref
,
"
running"
,
"
started"
,
"Started with docker id %v"
,
dockerContainer
.
ID
)
record
.
Eventf
(
ref
,
"started"
,
"Started with docker id %v"
,
dockerContainer
.
ID
)
}
}
if
container
.
Lifecycle
!=
nil
&&
container
.
Lifecycle
.
PostStart
!=
nil
{
if
container
.
Lifecycle
!=
nil
&&
container
.
Lifecycle
.
PostStart
!=
nil
{
...
@@ -864,7 +864,7 @@ func (kl *Kubelet) killContainerByID(ID, name string) error {
...
@@ -864,7 +864,7 @@ func (kl *Kubelet) killContainerByID(ID, name string) error {
glog
.
Warningf
(
"No ref for pod '%v' - '%v'"
,
ID
,
name
)
glog
.
Warningf
(
"No ref for pod '%v' - '%v'"
,
ID
,
name
)
}
else
{
}
else
{
// TODO: pass reason down here, and state, or move this call up the stack.
// TODO: pass reason down here, and state, or move this call up the stack.
record
.
Eventf
(
ref
,
"
terminated"
,
"
killing"
,
"Killing %v - %v"
,
ID
,
name
)
record
.
Eventf
(
ref
,
"killing"
,
"Killing %v - %v"
,
ID
,
name
)
}
}
return
err
return
err
...
@@ -896,7 +896,7 @@ func (kl *Kubelet) createNetworkContainer(pod *api.BoundPod) (dockertools.Docker
...
@@ -896,7 +896,7 @@ func (kl *Kubelet) createNetworkContainer(pod *api.BoundPod) (dockertools.Docker
ok
,
err
:=
kl
.
dockerPuller
.
IsImagePresent
(
container
.
Image
)
ok
,
err
:=
kl
.
dockerPuller
.
IsImagePresent
(
container
.
Image
)
if
err
!=
nil
{
if
err
!=
nil
{
if
ref
!=
nil
{
if
ref
!=
nil
{
record
.
Eventf
(
ref
,
"failed"
,
"
failed"
,
"
Failed to inspect image %q"
,
container
.
Image
)
record
.
Eventf
(
ref
,
"failed"
,
"Failed to inspect image %q"
,
container
.
Image
)
}
}
return
""
,
err
return
""
,
err
}
}
...
@@ -906,7 +906,7 @@ func (kl *Kubelet) createNetworkContainer(pod *api.BoundPod) (dockertools.Docker
...
@@ -906,7 +906,7 @@ func (kl *Kubelet) createNetworkContainer(pod *api.BoundPod) (dockertools.Docker
}
}
}
}
if
ref
!=
nil
{
if
ref
!=
nil
{
record
.
Eventf
(
ref
,
"
waiting"
,
"
pulled"
,
"Successfully pulled image %q"
,
container
.
Image
)
record
.
Eventf
(
ref
,
"pulled"
,
"Successfully pulled image %q"
,
container
.
Image
)
}
}
return
kl
.
runContainer
(
pod
,
container
,
nil
,
""
)
return
kl
.
runContainer
(
pod
,
container
,
nil
,
""
)
}
}
...
@@ -916,12 +916,12 @@ func (kl *Kubelet) pullImage(img string, ref *api.ObjectReference) error {
...
@@ -916,12 +916,12 @@ func (kl *Kubelet) pullImage(img string, ref *api.ObjectReference) error {
defer
kl
.
pullLock
.
RUnlock
()
defer
kl
.
pullLock
.
RUnlock
()
if
err
:=
kl
.
dockerPuller
.
Pull
(
img
);
err
!=
nil
{
if
err
:=
kl
.
dockerPuller
.
Pull
(
img
);
err
!=
nil
{
if
ref
!=
nil
{
if
ref
!=
nil
{
record
.
Eventf
(
ref
,
"failed"
,
"
failed"
,
"
Failed to pull image %q"
,
img
)
record
.
Eventf
(
ref
,
"failed"
,
"Failed to pull image %q"
,
img
)
}
}
return
err
return
err
}
}
if
ref
!=
nil
{
if
ref
!=
nil
{
record
.
Eventf
(
ref
,
"
waiting"
,
"
pulled"
,
"Successfully pulled image %q"
,
img
)
record
.
Eventf
(
ref
,
"pulled"
,
"Successfully pulled image %q"
,
img
)
}
}
return
nil
return
nil
}
}
...
@@ -1090,7 +1090,7 @@ func (kl *Kubelet) syncPod(pod *api.BoundPod, dockerContainers dockertools.Docke
...
@@ -1090,7 +1090,7 @@ func (kl *Kubelet) syncPod(pod *api.BoundPod, dockerContainers dockertools.Docke
latest
:=
dockertools
.
RequireLatestImage
(
container
.
Image
)
latest
:=
dockertools
.
RequireLatestImage
(
container
.
Image
)
if
err
!=
nil
{
if
err
!=
nil
{
if
ref
!=
nil
{
if
ref
!=
nil
{
record
.
Eventf
(
ref
,
"failed"
,
"
failed"
,
"
Failed to inspect image %q"
,
container
.
Image
)
record
.
Eventf
(
ref
,
"failed"
,
"Failed to inspect image %q"
,
container
.
Image
)
}
}
glog
.
Errorf
(
"Failed to inspect image %q: %v; skipping pod %q container %q"
,
container
.
Image
,
err
,
podFullName
,
container
.
Name
)
glog
.
Errorf
(
"Failed to inspect image %q: %v; skipping pod %q container %q"
,
container
.
Image
,
err
,
podFullName
,
container
.
Name
)
continue
continue
...
@@ -1222,7 +1222,7 @@ func (kl *Kubelet) SyncPods(pods []api.BoundPod) error {
...
@@ -1222,7 +1222,7 @@ func (kl *Kubelet) SyncPods(pods []api.BoundPod) error {
kl
.
podWorkers
.
Run
(
podFullName
,
func
()
{
kl
.
podWorkers
.
Run
(
podFullName
,
func
()
{
if
err
:=
kl
.
syncPod
(
pod
,
dockerContainers
);
err
!=
nil
{
if
err
:=
kl
.
syncPod
(
pod
,
dockerContainers
);
err
!=
nil
{
glog
.
Errorf
(
"Error syncing pod, skipping: %v"
,
err
)
glog
.
Errorf
(
"Error syncing pod, skipping: %v"
,
err
)
record
.
Eventf
(
pod
,
"
"
,
"
failedSync"
,
"Error syncing pod, skipping: %v"
,
err
)
record
.
Eventf
(
pod
,
"failedSync"
,
"Error syncing pod, skipping: %v"
,
err
)
}
}
})
})
}
}
...
@@ -1434,5 +1434,5 @@ func (kl *Kubelet) BirthCry() {
...
@@ -1434,5 +1434,5 @@ func (kl *Kubelet) BirthCry() {
UID
:
util
.
UID
(
kl
.
hostname
),
UID
:
util
.
UID
(
kl
.
hostname
),
Namespace
:
api
.
NamespaceDefault
,
Namespace
:
api
.
NamespaceDefault
,
}
}
record
.
Eventf
(
ref
,
"
"
,
"
starting"
,
"Starting kubelet."
)
record
.
Eventf
(
ref
,
"starting"
,
"Starting kubelet."
)
}
}
pkg/registry/event/rest.go
View file @
c13ae34b
...
@@ -106,8 +106,6 @@ func (rs *REST) getAttrs(obj runtime.Object) (objLabels, objFields labels.Set, e
...
@@ -106,8 +106,6 @@ func (rs *REST) getAttrs(obj runtime.Object) (objLabels, objFields labels.Set, e
"involvedObject.apiVersion"
:
event
.
InvolvedObject
.
APIVersion
,
"involvedObject.apiVersion"
:
event
.
InvolvedObject
.
APIVersion
,
"involvedObject.resourceVersion"
:
fmt
.
Sprintf
(
"%s"
,
event
.
InvolvedObject
.
ResourceVersion
),
"involvedObject.resourceVersion"
:
fmt
.
Sprintf
(
"%s"
,
event
.
InvolvedObject
.
ResourceVersion
),
"involvedObject.fieldPath"
:
event
.
InvolvedObject
.
FieldPath
,
"involvedObject.fieldPath"
:
event
.
InvolvedObject
.
FieldPath
,
"condition"
:
event
.
Condition
,
"status"
:
event
.
Condition
,
// TODO: remove me when we version fields
"reason"
:
event
.
Reason
,
"reason"
:
event
.
Reason
,
"source"
:
event
.
Source
.
Component
,
"source"
:
event
.
Source
.
Component
,
},
nil
},
nil
...
...
pkg/registry/event/rest_test.go
View file @
c13ae34b
...
@@ -143,9 +143,8 @@ func TestRESTgetAttrs(t *testing.T) {
...
@@ -143,9 +143,8 @@ func TestRESTgetAttrs(t *testing.T) {
ResourceVersion
:
"0"
,
ResourceVersion
:
"0"
,
FieldPath
:
""
,
FieldPath
:
""
,
},
},
Condition
:
"Tested"
,
Reason
:
"ForTesting"
,
Reason
:
"ForTesting"
,
Source
:
api
.
EventSource
{
Component
:
"test"
},
Source
:
api
.
EventSource
{
Component
:
"test"
},
}
}
label
,
field
,
err
:=
rest
.
getAttrs
(
eventA
)
label
,
field
,
err
:=
rest
.
getAttrs
(
eventA
)
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -162,8 +161,6 @@ func TestRESTgetAttrs(t *testing.T) {
...
@@ -162,8 +161,6 @@ func TestRESTgetAttrs(t *testing.T) {
"involvedObject.apiVersion"
:
testapi
.
Version
(),
"involvedObject.apiVersion"
:
testapi
.
Version
(),
"involvedObject.resourceVersion"
:
"0"
,
"involvedObject.resourceVersion"
:
"0"
,
"involvedObject.fieldPath"
:
""
,
"involvedObject.fieldPath"
:
""
,
"condition"
:
"Tested"
,
"status"
:
"Tested"
,
"reason"
:
"ForTesting"
,
"reason"
:
"ForTesting"
,
"source"
:
"test"
,
"source"
:
"test"
,
}
}
...
@@ -183,8 +180,8 @@ func TestRESTList(t *testing.T) {
...
@@ -183,8 +180,8 @@ func TestRESTList(t *testing.T) {
ResourceVersion
:
"0"
,
ResourceVersion
:
"0"
,
FieldPath
:
""
,
FieldPath
:
""
,
},
},
Condition
:
"Tested
"
,
Reason
:
"ForTesting
"
,
Reason
:
"ForTesting"
,
Source
:
api
.
EventSource
{
Component
:
"GoodSource"
}
,
}
}
eventB
:=
&
api
.
Event
{
eventB
:=
&
api
.
Event
{
InvolvedObject
:
api
.
ObjectReference
{
InvolvedObject
:
api
.
ObjectReference
{
...
@@ -195,8 +192,8 @@ func TestRESTList(t *testing.T) {
...
@@ -195,8 +192,8 @@ func TestRESTList(t *testing.T) {
ResourceVersion
:
"0"
,
ResourceVersion
:
"0"
,
FieldPath
:
""
,
FieldPath
:
""
,
},
},
Condition
:
"Tested
"
,
Reason
:
"ForTesting
"
,
Reason
:
"ForTesting"
,
Source
:
api
.
EventSource
{
Component
:
"GoodSource"
}
,
}
}
eventC
:=
&
api
.
Event
{
eventC
:=
&
api
.
Event
{
InvolvedObject
:
api
.
ObjectReference
{
InvolvedObject
:
api
.
ObjectReference
{
...
@@ -207,13 +204,13 @@ func TestRESTList(t *testing.T) {
...
@@ -207,13 +204,13 @@ func TestRESTList(t *testing.T) {
ResourceVersion
:
"0"
,
ResourceVersion
:
"0"
,
FieldPath
:
""
,
FieldPath
:
""
,
},
},
Condition
:
"Untested
"
,
Reason
:
"ForTesting
"
,
Reason
:
"ForTesting"
,
Source
:
api
.
EventSource
{
Component
:
"OtherSource"
}
,
}
}
reg
.
ObjectList
=
&
api
.
EventList
{
reg
.
ObjectList
=
&
api
.
EventList
{
Items
:
[]
api
.
Event
{
*
eventA
,
*
eventB
,
*
eventC
},
Items
:
[]
api
.
Event
{
*
eventA
,
*
eventB
,
*
eventC
},
}
}
got
,
err
:=
rest
.
List
(
api
.
NewContext
(),
labels
.
Everything
(),
labels
.
Set
{
"s
tatus"
:
"Tested
"
}
.
AsSelector
())
got
,
err
:=
rest
.
List
(
api
.
NewContext
(),
labels
.
Everything
(),
labels
.
Set
{
"s
ource"
:
"GoodSource
"
}
.
AsSelector
())
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Fatalf
(
"Unexpected error %v"
,
err
)
t
.
Fatalf
(
"Unexpected error %v"
,
err
)
}
}
...
@@ -235,8 +232,7 @@ func TestRESTWatch(t *testing.T) {
...
@@ -235,8 +232,7 @@ func TestRESTWatch(t *testing.T) {
ResourceVersion
:
"0"
,
ResourceVersion
:
"0"
,
FieldPath
:
""
,
FieldPath
:
""
,
},
},
Condition
:
"Tested"
,
Reason
:
"ForTesting"
,
Reason
:
"ForTesting"
,
}
}
reg
,
rest
:=
NewTestREST
()
reg
,
rest
:=
NewTestREST
()
wi
,
err
:=
rest
.
Watch
(
api
.
NewContext
(),
labels
.
Everything
(),
labels
.
Everything
(),
"0"
)
wi
,
err
:=
rest
.
Watch
(
api
.
NewContext
(),
labels
.
Everything
(),
labels
.
Everything
(),
"0"
)
...
...
plugin/pkg/scheduler/scheduler.go
View file @
c13ae34b
...
@@ -72,7 +72,7 @@ func (s *Scheduler) scheduleOne() {
...
@@ -72,7 +72,7 @@ func (s *Scheduler) scheduleOne() {
dest
,
err
:=
s
.
config
.
Algorithm
.
Schedule
(
*
pod
,
s
.
config
.
MinionLister
)
dest
,
err
:=
s
.
config
.
Algorithm
.
Schedule
(
*
pod
,
s
.
config
.
MinionLister
)
if
err
!=
nil
{
if
err
!=
nil
{
glog
.
V
(
1
)
.
Infof
(
"Failed to schedule: %v"
,
pod
)
glog
.
V
(
1
)
.
Infof
(
"Failed to schedule: %v"
,
pod
)
record
.
Eventf
(
pod
,
string
(
api
.
PodPending
),
"failedScheduling"
,
"Error scheduling: %v"
,
err
)
record
.
Eventf
(
pod
,
"failedScheduling"
,
"Error scheduling: %v"
,
err
)
s
.
config
.
Error
(
pod
,
err
)
s
.
config
.
Error
(
pod
,
err
)
return
return
}
}
...
@@ -83,9 +83,9 @@ func (s *Scheduler) scheduleOne() {
...
@@ -83,9 +83,9 @@ func (s *Scheduler) scheduleOne() {
}
}
if
err
:=
s
.
config
.
Binder
.
Bind
(
b
);
err
!=
nil
{
if
err
:=
s
.
config
.
Binder
.
Bind
(
b
);
err
!=
nil
{
glog
.
V
(
1
)
.
Infof
(
"Failed to bind pod: %v"
,
err
)
glog
.
V
(
1
)
.
Infof
(
"Failed to bind pod: %v"
,
err
)
record
.
Eventf
(
pod
,
string
(
api
.
PodPending
),
"failedScheduling"
,
"Binding rejected: %v"
,
err
)
record
.
Eventf
(
pod
,
"failedScheduling"
,
"Binding rejected: %v"
,
err
)
s
.
config
.
Error
(
pod
,
err
)
s
.
config
.
Error
(
pod
,
err
)
return
return
}
}
record
.
Eventf
(
pod
,
string
(
api
.
PodPending
),
"scheduled"
,
"Successfully assigned %v to %v"
,
pod
.
Name
,
dest
)
record
.
Eventf
(
pod
,
"scheduled"
,
"Successfully assigned %v to %v"
,
pod
.
Name
,
dest
)
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment