daemonset don't place pods on notready nodes

This commit is contained in:
Mike Danese
2015-10-28 18:01:34 -07:00
parent c691f66b79
commit f237db81f0
3 changed files with 36 additions and 1 deletions

View File

@@ -84,6 +84,11 @@ func newNode(name string, label map[string]string) *api.Node {
Labels: label,
Namespace: api.NamespaceDefault,
},
Status: api.NodeStatus{
Conditions: []api.NodeCondition{
{Type: api.NodeReady, Status: api.ConditionTrue},
},
},
}
}
@@ -177,6 +182,21 @@ func TestOneNodeDaemonLaunchesPod(t *testing.T) {
syncAndValidateDaemonSets(t, manager, ds, podControl, 1, 0)
}
// DaemonSets should not place onto NotReady nodes
func TestNotReadNodeDaemonDoesNotLaunchPod(t *testing.T) {
manager, podControl := newTestController()
node := newNode("not-ready", nil)
node.Status = api.NodeStatus{
Conditions: []api.NodeCondition{
{Type: api.NodeReady, Status: api.ConditionFalse},
},
}
manager.nodeStore.Add(node)
ds := newDaemonSet("foo")
manager.dsStore.Add(ds)
syncAndValidateDaemonSets(t, manager, ds, podControl, 0, 0)
}
// Controller should not create pods on nodes which have daemon pods, and should remove excess pods from nodes that have extra pods.
func TestDealsWithExistingPods(t *testing.T) {
manager, podControl := newTestController()