Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save k82cn/3dbd398ef2b138fee6a4c19ec3d2ddcf to your computer and use it in GitHub Desktop.
Save k82cn/3dbd398ef2b138fee6a4c19ec3d2ddcf to your computer and use it in GitHub Desktop.
k8s_48190
diff --git a/pkg/controller/daemon/daemoncontroller.go b/pkg/controller/daemon/daemoncontroller.go
index c45e17ab30..d5781a1d3d 100644
--- a/pkg/controller/daemon/daemoncontroller.go
+++ b/pkg/controller/daemon/daemoncontroller.go
@@ -1122,6 +1122,8 @@ func (dsc *DaemonSetsController) nodeShouldRunDaemonPod(node *v1.Node, ds *exten
// ignore pods that belong to the daemonset when taking into account whether
// a daemonset should bind to a node.
if controllerRef := controller.GetControllerOf(pod); controllerRef != nil && controllerRef.UID == ds.UID {
+ // Keep this pods's phase for toleration/taints check.
+ newPods.Status.Phase = pod.Status.Phase
continue
}
pods = append(pods, pod)
diff --git a/plugin/pkg/scheduler/algorithm/predicates/predicates.go b/plugin/pkg/scheduler/algorithm/predicates/predicates.go
index dbb214c943..7a1c8663ee 100644
--- a/plugin/pkg/scheduler/algorithm/predicates/predicates.go
+++ b/plugin/pkg/scheduler/algorithm/predicates/predicates.go
@@ -1254,6 +1254,9 @@ func PodToleratesNodeTaints(pod *v1.Pod, meta interface{}, nodeInfo *schedulerca
if v1helper.TolerationsTolerateTaintsWithFilter(pod.Spec.Tolerations, taints, func(t *v1.Taint) bool {
// PodToleratesNodeTaints is only interested in NoSchedule and NoExecute taints.
+ if pod.Status.Phase == v1.PodRunning {
+ return t.Effect == v1.TaintEffectNoExecute
+ }
return t.Effect == v1.TaintEffectNoSchedule || t.Effect == v1.TaintEffectNoExecute
}) {
return true, nil, nil
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment