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
f531bf20
Commit
f531bf20
authored
Feb 01, 2017
by
Janet Kuo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Address comments
parent
7074d2fd
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
4 deletions
+16
-4
daemoncontroller.go
pkg/controller/daemon/daemoncontroller.go
+16
-4
No files found.
pkg/controller/daemon/daemoncontroller.go
View file @
f531bf20
...
...
@@ -56,6 +56,14 @@ const (
// If sending a status upate to API server fails, we retry a finite number of times.
StatusUpdateRetries
=
1
// Reasons for DaemonSet events
// SelectingAllReason is added to an event when a DaemonSet selects all Pods.
SelectingAllReason
=
"SelectingAll"
// FailedPlacementReason is added to an event when a DaemonSet can't schedule a Pod to a specified node.
FailedPlacementReason
=
"FailedPlacement"
// FailedDaemonPodReason is added to an event when the status of a Pod of a DaemonSet is 'Failed'.
FailedDaemonPodReason
=
"FailedDaemonPod"
)
// DaemonSetsController is responsible for synchronizing DaemonSet objects stored
...
...
@@ -479,11 +487,15 @@ func (dsc *DaemonSetsController) manage(ds *extensions.DaemonSet) error {
var
daemonPodsRunning
[]
*
v1
.
Pod
for
i
:=
range
daemonPods
{
pod
:=
daemonPods
[
i
]
// Skip terminating pods. We won't delete them again or count them as running daemon pods.
if
pod
.
DeletionTimestamp
!=
nil
{
continue
}
if
pod
.
Status
.
Phase
==
v1
.
PodFailed
{
msg
:=
fmt
.
Sprintf
(
"Found failed daemon pod %s/%s on node %s, will try to kill it"
,
pod
.
Namespace
,
node
.
Name
,
pod
.
Name
)
glog
.
V
(
2
)
.
Infof
(
msg
)
// Emit an event so that it's discoverable to users.
dsc
.
eventRecorder
.
Eventf
(
ds
,
v1
.
EventTypeWarning
,
"FailedDaemonPod"
,
msg
)
dsc
.
eventRecorder
.
Eventf
(
ds
,
v1
.
EventTypeWarning
,
FailedDaemonPodReason
,
msg
)
podsToDelete
=
append
(
podsToDelete
,
pod
.
Name
)
failedPodsObserved
++
}
else
{
...
...
@@ -676,7 +688,7 @@ func (dsc *DaemonSetsController) syncDaemonSet(key string) error {
everything
:=
metav1
.
LabelSelector
{}
if
reflect
.
DeepEqual
(
ds
.
Spec
.
Selector
,
&
everything
)
{
dsc
.
eventRecorder
.
Eventf
(
ds
,
v1
.
EventTypeWarning
,
"SelectingAll"
,
"This daemon set is selecting all pods. A non-empty selector is required."
)
dsc
.
eventRecorder
.
Eventf
(
ds
,
v1
.
EventTypeWarning
,
SelectingAllReason
,
"This daemon set is selecting all pods. A non-empty selector is required."
)
return
nil
}
...
...
@@ -762,7 +774,7 @@ func (dsc *DaemonSetsController) nodeShouldRunDaemonPod(node *v1.Node, ds *exten
glog
.
V
(
4
)
.
Infof
(
"GeneralPredicates failed on ds '%s/%s' for reason: %v"
,
ds
.
ObjectMeta
.
Namespace
,
ds
.
ObjectMeta
.
Name
,
r
.
GetReason
())
switch
reason
:=
r
.
(
type
)
{
case
*
predicates
.
InsufficientResourceError
:
dsc
.
eventRecorder
.
Eventf
(
ds
,
v1
.
EventTypeNormal
,
"FailedPlacement"
,
"failed to place pod on %q: %s"
,
node
.
ObjectMeta
.
Name
,
reason
.
Error
())
dsc
.
eventRecorder
.
Eventf
(
ds
,
v1
.
EventTypeNormal
,
FailedPlacementReason
,
"failed to place pod on %q: %s"
,
node
.
ObjectMeta
.
Name
,
reason
.
Error
())
shouldSchedule
=
false
case
*
predicates
.
PredicateFailureError
:
var
emitEvent
bool
...
...
@@ -801,7 +813,7 @@ func (dsc *DaemonSetsController) nodeShouldRunDaemonPod(node *v1.Node, ds *exten
emitEvent
=
true
}
if
emitEvent
{
dsc
.
eventRecorder
.
Eventf
(
ds
,
v1
.
EventTypeNormal
,
"FailedPlacement"
,
"failed to place pod on %q: %s"
,
node
.
ObjectMeta
.
Name
,
reason
.
GetReason
())
dsc
.
eventRecorder
.
Eventf
(
ds
,
v1
.
EventTypeNormal
,
FailedPlacementReason
,
"failed to place pod on %q: %s"
,
node
.
ObjectMeta
.
Name
,
reason
.
GetReason
())
}
}
}
...
...
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