From 5651f822fd24702222d4afb15f444db347a8ae88 Mon Sep 17 00:00:00 2001 From: Ivan Shvedunov Date: Mon, 26 Sep 2016 22:14:28 +0300 Subject: [PATCH] Fix DaemonSet namespace handling for predicates In order to determine whether a node should run its daemon pod, DaemonController creates a dummy pod based on DaemonSet's template and then uses scheduler predicates (currently GeneralPredicates) to test whether such pod can be run by the node. The problem was that DaemonController was not setting Namespace for the dummy pod. This was not affecting currently used GeneralPredicates but this problem could bite later when some namespace-dependent predicates are added to GeneralPredicates or directly to DaemonController's node checks (e.g. pod affinity). Stumbled upon it while working on e2e test for #31136 --- pkg/controller/daemon/daemoncontroller.go | 1 + 1 file changed, 1 insertion(+) diff --git a/pkg/controller/daemon/daemoncontroller.go b/pkg/controller/daemon/daemoncontroller.go index 2654636df26..2e676562024 100644 --- a/pkg/controller/daemon/daemoncontroller.go +++ b/pkg/controller/daemon/daemoncontroller.go @@ -650,6 +650,7 @@ func (dsc *DaemonSetsController) nodeShouldRunDaemonPod(node *api.Node, ds *exte } newPod := &api.Pod{Spec: ds.Spec.Template.Spec, ObjectMeta: ds.Spec.Template.ObjectMeta} + newPod.Namespace = ds.Namespace newPod.Spec.NodeName = node.Name pods := []*api.Pod{}