mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-06 18:54:06 +00:00
daemonset shouldn't place onto unschedulable nodes
This commit is contained in:
parent
89d7309c88
commit
f674109502
@ -364,6 +364,11 @@ func (dsc *DaemonSetsController) manage(ds *extensions.DaemonSet) {
|
|||||||
// TODO(mikedanese): remove this once daemonpods forgive nodes
|
// TODO(mikedanese): remove this once daemonpods forgive nodes
|
||||||
shouldRun = shouldRun && api.IsNodeReady(&node)
|
shouldRun = shouldRun && api.IsNodeReady(&node)
|
||||||
|
|
||||||
|
// If the node is unschedulable, don't run it
|
||||||
|
// TODO(mikedanese): remove this once we have the right node admitance levels.
|
||||||
|
// See https://github.com/kubernetes/kubernetes/issues/17297#issuecomment-156857375.
|
||||||
|
shouldRun = shouldRun && !node.Spec.Unschedulable
|
||||||
|
|
||||||
daemonPods, isRunning := nodeToDaemonPods[nodeName]
|
daemonPods, isRunning := nodeToDaemonPods[nodeName]
|
||||||
if shouldRun && !isRunning {
|
if shouldRun && !isRunning {
|
||||||
// If daemon pod is supposed to be running on node, but isn't, create daemon pod.
|
// If daemon pod is supposed to be running on node, but isn't, create daemon pod.
|
||||||
|
@ -197,6 +197,17 @@ func TestNotReadNodeDaemonDoesNotLaunchPod(t *testing.T) {
|
|||||||
syncAndValidateDaemonSets(t, manager, ds, podControl, 0, 0)
|
syncAndValidateDaemonSets(t, manager, ds, podControl, 0, 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// DaemonSets should not place onto Unschedulable nodes
|
||||||
|
func TestUnschedulableNodeDaemonDoesNotLaunchPod(t *testing.T) {
|
||||||
|
manager, podControl := newTestController()
|
||||||
|
node := newNode("not-ready", nil)
|
||||||
|
node.Spec.Unschedulable = true
|
||||||
|
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.
|
// 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) {
|
func TestDealsWithExistingPods(t *testing.T) {
|
||||||
manager, podControl := newTestController()
|
manager, podControl := newTestController()
|
||||||
|
Loading…
Reference in New Issue
Block a user