mirror of https://github.com/k3s-io/k3s
Merge pull request #46346 from zjj2wry/ds-controller
Automatic merge from submit-queue (batch tested with PRs 46239, 46627, 46346, 46388, 46524) add test and fix typo in daemoncontroller **What this PR does / why we need it**: **Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: fixes # **Special notes for your reviewer**: **Release note**: ```release-note NONE ```pull/6/head
commit
d8374eaae4
|
@ -847,7 +847,7 @@ func (dsc *DaemonSetsController) syncDaemonSet(key string) error {
|
|||
// summary. Returned booleans are:
|
||||
// * wantToRun:
|
||||
// Returns true when a user would expect a pod to run on this node and ignores conditions
|
||||
// such as OutOfDisk or insufficent resource that would cause a daemonset pod not to schedule.
|
||||
// such as OutOfDisk or insufficient resource that would cause a daemonset pod not to schedule.
|
||||
// This is primarily used to populate daemonset status.
|
||||
// * shouldSchedule:
|
||||
// Returns true when a daemonset should be scheduled to a node if a daemonset pod is not already
|
||||
|
|
|
@ -456,7 +456,7 @@ func TestInsufficientCapacityNodeDaemonDoesNotLaunchPod(t *testing.T) {
|
|||
}
|
||||
|
||||
// DaemonSets should not unschedule a daemonset pod from a node with insufficient free resource
|
||||
func TestInsufficentCapacityNodeDaemonDoesNotUnscheduleRunningPod(t *testing.T) {
|
||||
func TestInsufficientCapacityNodeDaemonDoesNotUnscheduleRunningPod(t *testing.T) {
|
||||
podSpec := resourcePodSpec("too-much-mem", "75M", "75m")
|
||||
podSpec.NodeName = "too-much-mem"
|
||||
ds := newDaemonSet("foo")
|
||||
|
@ -1351,6 +1351,29 @@ func TestGetNodesToDaemonPods(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestAddNode(t *testing.T) {
|
||||
manager, _, _ := newTestController()
|
||||
node1 := newNode("node1", nil)
|
||||
ds := newDaemonSet("ds")
|
||||
ds.Spec.Template.Spec.NodeSelector = simpleNodeLabel
|
||||
manager.dsStore.Add(ds)
|
||||
|
||||
manager.addNode(node1)
|
||||
if got, want := manager.queue.Len(), 0; got != want {
|
||||
t.Fatalf("queue.Len() = %v, want %v", got, want)
|
||||
}
|
||||
|
||||
node2 := newNode("node2", simpleNodeLabel)
|
||||
manager.addNode(node2)
|
||||
if got, want := manager.queue.Len(), 1; got != want {
|
||||
t.Fatalf("queue.Len() = %v, want %v", got, want)
|
||||
}
|
||||
key, done := manager.queue.Get()
|
||||
if key == nil || done {
|
||||
t.Fatalf("failed to enqueue controller for node %v", node2.Name)
|
||||
}
|
||||
}
|
||||
|
||||
func TestAddPod(t *testing.T) {
|
||||
manager, _, _ := newTestController()
|
||||
ds1 := newDaemonSet("foo1")
|
||||
|
|
Loading…
Reference in New Issue