@@ -623,11 +623,11 @@ func (dsc *DaemonSetsController) addNode(obj interface{}) {
623
623
}
624
624
node := obj .(* v1.Node )
625
625
for _ , ds := range dsList {
626
- shouldSchedule , _ , err := dsc .nodeShouldRunDaemonPod (node , ds )
626
+ shouldRun , _ , err := dsc .nodeShouldRunDaemonPod (node , ds )
627
627
if err != nil {
628
628
continue
629
629
}
630
- if shouldSchedule {
630
+ if shouldRun {
631
631
dsc .enqueueDaemonSet (ds )
632
632
}
633
633
}
@@ -685,15 +685,15 @@ func (dsc *DaemonSetsController) updateNode(old, cur interface{}) {
685
685
}
686
686
// TODO: it'd be nice to pass a hint with these enqueues, so that each ds would only examine the added node (unless it has other work to do, too).
687
687
for _ , ds := range dsList {
688
- oldShouldSchedule , oldShouldContinueRunning , err := dsc .nodeShouldRunDaemonPod (oldNode , ds )
688
+ oldShouldRun , oldShouldContinueRunning , err := dsc .nodeShouldRunDaemonPod (oldNode , ds )
689
689
if err != nil {
690
690
continue
691
691
}
692
- currentShouldSchedule , currentShouldContinueRunning , err := dsc .nodeShouldRunDaemonPod (curNode , ds )
692
+ currentShouldRun , currentShouldContinueRunning , err := dsc .nodeShouldRunDaemonPod (curNode , ds )
693
693
if err != nil {
694
694
continue
695
695
}
696
- if (oldShouldSchedule != currentShouldSchedule ) || (oldShouldContinueRunning != currentShouldContinueRunning ) {
696
+ if (oldShouldRun != currentShouldRun ) || (oldShouldContinueRunning != currentShouldContinueRunning ) {
697
697
dsc .enqueueDaemonSet (ds )
698
698
}
699
699
}
@@ -789,15 +789,15 @@ func (dsc *DaemonSetsController) podsShouldBeOnNode(
789
789
ds * apps.DaemonSet ,
790
790
) (nodesNeedingDaemonPods , podsToDelete []string , err error ) {
791
791
792
- shouldSchedule , shouldContinueRunning , err := dsc .nodeShouldRunDaemonPod (node , ds )
792
+ shouldRun , shouldContinueRunning , err := dsc .nodeShouldRunDaemonPod (node , ds )
793
793
if err != nil {
794
794
return
795
795
}
796
796
797
797
daemonPods , exists := nodeToDaemonPods [node .Name ]
798
798
799
799
switch {
800
- case shouldSchedule && ! exists :
800
+ case shouldRun && ! exists :
801
801
// If daemon pod is supposed to be running on node, but isn't, create daemon pod.
802
802
nodesNeedingDaemonPods = append (nodesNeedingDaemonPods , node .Name )
803
803
case shouldContinueRunning :
@@ -1054,14 +1054,14 @@ func (dsc *DaemonSetsController) updateDaemonSetStatus(ds *apps.DaemonSet, nodeL
1054
1054
1055
1055
var desiredNumberScheduled , currentNumberScheduled , numberMisscheduled , numberReady , updatedNumberScheduled , numberAvailable int
1056
1056
for _ , node := range nodeList {
1057
- wantToRun , _ , err := dsc .nodeShouldRunDaemonPod (node , ds )
1057
+ shouldRun , _ , err := dsc .nodeShouldRunDaemonPod (node , ds )
1058
1058
if err != nil {
1059
1059
return err
1060
1060
}
1061
1061
1062
1062
scheduled := len (nodeToDaemonPods [node .Name ]) > 0
1063
1063
1064
- if wantToRun {
1064
+ if shouldRun {
1065
1065
desiredNumberScheduled ++
1066
1066
if scheduled {
1067
1067
currentNumberScheduled ++
@@ -1195,8 +1195,8 @@ func (dsc *DaemonSetsController) syncDaemonSet(key string) error {
1195
1195
1196
1196
// nodeShouldRunDaemonPod checks a set of preconditions against a (node,daemonset) and returns a
1197
1197
// summary. Returned booleans are:
1198
- // * shouldSchedule :
1199
- // Returns true when a daemonset should be scheduled to a node if a daemonset pod is not already
1198
+ // * shouldRun :
1199
+ // Returns true when a daemonset should run on the node if a daemonset pod is not already
1200
1200
// running on that node.
1201
1201
// * shouldContinueRunning:
1202
1202
// Returns true when a daemonset should continue running on a node if a daemonset pod is already
@@ -1217,24 +1217,24 @@ func (dsc *DaemonSetsController) nodeShouldRunDaemonPod(node *v1.Node, ds *apps.
1217
1217
return false , false , err
1218
1218
}
1219
1219
1220
- fitsNodeName , fitsNodeAffinity , fitsTaints := PodFitsNode (pod , node , taints )
1220
+ fitsNodeName , fitsNodeAffinity , fitsTaints := Predicates (pod , node , taints )
1221
1221
if ! fitsNodeName || ! fitsNodeAffinity {
1222
1222
return false , false , nil
1223
1223
}
1224
1224
1225
1225
if ! fitsTaints {
1226
- fitsNoExecuteTaint := v1helper .TolerationsTolerateTaintsWithFilter (pod .Spec .Tolerations , taints , func (t * v1.Taint ) bool {
1226
+ // Scheduled daemon pods should continue running if they tolerate NoExecute taint.
1227
+ shouldContinueRunning := v1helper .TolerationsTolerateTaintsWithFilter (pod .Spec .Tolerations , taints , func (t * v1.Taint ) bool {
1227
1228
return t .Effect == v1 .TaintEffectNoExecute
1228
1229
})
1229
-
1230
- return false , fitsNoExecuteTaint , nil
1230
+ return false , shouldContinueRunning , nil
1231
1231
}
1232
1232
1233
1233
return true , true , nil
1234
1234
}
1235
1235
1236
- // PodFitsNode Checks if a DaemonSet's pod can be scheduled on a node.
1237
- func PodFitsNode (pod * v1.Pod , node * v1.Node , taints []v1.Taint ) (fitsNodeName , fitsNodeAffinity , fitsTaints bool ) {
1236
+ // Predicates checks if a DaemonSet's pod can run on a node.
1237
+ func Predicates (pod * v1.Pod , node * v1.Node , taints []v1.Taint ) (fitsNodeName , fitsNodeAffinity , fitsTaints bool ) {
1238
1238
fitsNodeName = len (pod .Spec .NodeName ) == 0 || pod .Spec .NodeName == node .Name
1239
1239
fitsNodeAffinity = pluginhelper .PodMatchesNodeSelectorAndAffinityTerms (pod , node )
1240
1240
fitsTaints = v1helper .TolerationsTolerateTaintsWithFilter (pod .Spec .Tolerations , taints , func (t * v1.Taint ) bool {
0 commit comments