Skip to content

Commit

Permalink
Ensure the ephemeral taints are removed before considering the node i…
Browse files Browse the repository at this point in the history
…nitialized (kubernetes-sigs#383)
  • Loading branch information
jonathan-innis authored Jun 26, 2023
1 parent 7183e31 commit 1e88464
Show file tree
Hide file tree
Showing 13 changed files with 556 additions and 87 deletions.
2 changes: 1 addition & 1 deletion pkg/controllers/consistency/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ var _ = Describe("Controller", func() {
v1.ResourcePods: resource.MustParse("10"),
}
ExpectApplied(ctx, env.Client, provisioner, machine, node)
ExpectMakeMachinesReady(ctx, env.Client, machine)
ExpectMakeMachinesInitialized(ctx, env.Client, machine)
ExpectReconcileSucceeded(ctx, consistencyController, client.ObjectKeyFromObject(machine))
Expect(recorder.DetectedEvent("expected 128Gi of resource memory, but found 64Gi (50.0% of expected)")).To(BeTrue())
})
Expand Down
16 changes: 8 additions & 8 deletions pkg/controllers/deprovisioning/drift_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ var _ = Describe("Drift", func() {
ExpectApplied(ctx, env.Client, machine, node, prov)

// inform cluster state about nodes and machines
ExpectMakeReadyAndStateUpdated(ctx, env.Client, nodeStateController, machineStateController, []*v1.Node{node}, []*v1alpha5.Machine{machine})
ExpectMakeInitializedAndStateUpdated(ctx, env.Client, nodeStateController, machineStateController, []*v1.Node{node}, []*v1alpha5.Machine{machine})

fakeClock.Step(10 * time.Minute)

Expand All @@ -89,7 +89,7 @@ var _ = Describe("Drift", func() {
ExpectApplied(ctx, env.Client, machine, node, prov)

// inform cluster state about nodes and machines
ExpectMakeReadyAndStateUpdated(ctx, env.Client, nodeStateController, machineStateController, []*v1.Node{node}, []*v1alpha5.Machine{machine})
ExpectMakeInitializedAndStateUpdated(ctx, env.Client, nodeStateController, machineStateController, []*v1.Node{node}, []*v1alpha5.Machine{machine})

fakeClock.Step(10 * time.Minute)

Expand All @@ -107,7 +107,7 @@ var _ = Describe("Drift", func() {
ExpectApplied(ctx, env.Client, machine, node, prov)

// inform cluster state about nodes and machines
ExpectMakeReadyAndStateUpdated(ctx, env.Client, nodeStateController, machineStateController, []*v1.Node{node}, []*v1alpha5.Machine{machine})
ExpectMakeInitializedAndStateUpdated(ctx, env.Client, nodeStateController, machineStateController, []*v1.Node{node}, []*v1alpha5.Machine{machine})

fakeClock.Step(10 * time.Minute)

Expand All @@ -124,7 +124,7 @@ var _ = Describe("Drift", func() {
ExpectApplied(ctx, env.Client, machine, node, prov)

// inform cluster state about nodes and machines
ExpectMakeReadyAndStateUpdated(ctx, env.Client, nodeStateController, machineStateController, []*v1.Node{node}, []*v1alpha5.Machine{machine})
ExpectMakeInitializedAndStateUpdated(ctx, env.Client, nodeStateController, machineStateController, []*v1.Node{node}, []*v1alpha5.Machine{machine})

fakeClock.Step(10 * time.Minute)

Expand Down Expand Up @@ -170,7 +170,7 @@ var _ = Describe("Drift", func() {
ExpectApplied(ctx, env.Client, prov)

// inform cluster state about nodes and machines
ExpectMakeReadyAndStateUpdated(ctx, env.Client, nodeStateController, machineStateController, nodes, machines)
ExpectMakeInitializedAndStateUpdated(ctx, env.Client, nodeStateController, machineStateController, nodes, machines)

var wg sync.WaitGroup
ExpectTriggerVerifyAction(&wg)
Expand Down Expand Up @@ -215,7 +215,7 @@ var _ = Describe("Drift", func() {
ExpectManualBinding(ctx, env.Client, pod, node)

// inform cluster state about nodes and machines
ExpectMakeReadyAndStateUpdated(ctx, env.Client, nodeStateController, machineStateController, []*v1.Node{node}, []*v1alpha5.Machine{machine})
ExpectMakeInitializedAndStateUpdated(ctx, env.Client, nodeStateController, machineStateController, []*v1.Node{node}, []*v1alpha5.Machine{machine})

fakeClock.Step(10 * time.Minute)

Expand Down Expand Up @@ -319,7 +319,7 @@ var _ = Describe("Drift", func() {
ExpectManualBinding(ctx, env.Client, pods[2], node)

// inform cluster state about nodes and machines
ExpectMakeReadyAndStateUpdated(ctx, env.Client, nodeStateController, machineStateController, []*v1.Node{node}, []*v1alpha5.Machine{machine})
ExpectMakeInitializedAndStateUpdated(ctx, env.Client, nodeStateController, machineStateController, []*v1.Node{node}, []*v1alpha5.Machine{machine})

fakeClock.Step(10 * time.Minute)

Expand Down Expand Up @@ -387,7 +387,7 @@ var _ = Describe("Drift", func() {
ExpectManualBinding(ctx, env.Client, pods[1], node2)

// inform cluster state about nodes and machines
ExpectMakeReadyAndStateUpdated(ctx, env.Client, nodeStateController, machineStateController, []*v1.Node{node, node2}, []*v1alpha5.Machine{machine, machine2})
ExpectMakeInitializedAndStateUpdated(ctx, env.Client, nodeStateController, machineStateController, []*v1.Node{node, node2}, []*v1alpha5.Machine{machine, machine2})

// deprovisioning won't delete the old node until the new node is ready
var wg sync.WaitGroup
Expand Down
16 changes: 8 additions & 8 deletions pkg/controllers/deprovisioning/expiration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ var _ = Describe("Expiration", func() {
ExpectApplied(ctx, env.Client, machine, node, prov)

// inform cluster state about nodes and machines
ExpectMakeReadyAndStateUpdated(ctx, env.Client, nodeStateController, machineStateController, []*v1.Node{node}, []*v1alpha5.Machine{machine})
ExpectMakeInitializedAndStateUpdated(ctx, env.Client, nodeStateController, machineStateController, []*v1.Node{node}, []*v1alpha5.Machine{machine})

ExpectReconcileSucceeded(ctx, deprovisioningController, types.NamespacedName{})

Expand All @@ -85,7 +85,7 @@ var _ = Describe("Expiration", func() {
ExpectApplied(ctx, env.Client, machine, node, prov)

// inform cluster state about nodes and machines
ExpectMakeReadyAndStateUpdated(ctx, env.Client, nodeStateController, machineStateController, []*v1.Node{node}, []*v1alpha5.Machine{machine})
ExpectMakeInitializedAndStateUpdated(ctx, env.Client, nodeStateController, machineStateController, []*v1.Node{node}, []*v1alpha5.Machine{machine})

ExpectReconcileSucceeded(ctx, deprovisioningController, types.NamespacedName{})

Expand All @@ -98,7 +98,7 @@ var _ = Describe("Expiration", func() {
ExpectApplied(ctx, env.Client, machine, node, prov)

// inform cluster state about nodes and machines
ExpectMakeReadyAndStateUpdated(ctx, env.Client, nodeStateController, machineStateController, []*v1.Node{node}, []*v1alpha5.Machine{machine})
ExpectMakeInitializedAndStateUpdated(ctx, env.Client, nodeStateController, machineStateController, []*v1.Node{node}, []*v1alpha5.Machine{machine})

var wg sync.WaitGroup
ExpectTriggerVerifyAction(&wg)
Expand Down Expand Up @@ -142,7 +142,7 @@ var _ = Describe("Expiration", func() {
ExpectApplied(ctx, env.Client, prov)

// inform cluster state about nodes and machines
ExpectMakeReadyAndStateUpdated(ctx, env.Client, nodeStateController, machineStateController, nodes, machines)
ExpectMakeInitializedAndStateUpdated(ctx, env.Client, nodeStateController, machineStateController, nodes, machines)

var wg sync.WaitGroup
ExpectTriggerVerifyAction(&wg)
Expand Down Expand Up @@ -223,7 +223,7 @@ var _ = Describe("Expiration", func() {
ExpectManualBinding(ctx, env.Client, pods[1], nodeNotExpire)

// inform cluster state about nodes and machines
ExpectMakeReadyAndStateUpdated(ctx, env.Client, nodeStateController, machineStateController, []*v1.Node{nodeToExpire, nodeNotExpire}, []*v1alpha5.Machine{machineToExpire, machineNotExpire})
ExpectMakeInitializedAndStateUpdated(ctx, env.Client, nodeStateController, machineStateController, []*v1.Node{nodeToExpire, nodeNotExpire}, []*v1alpha5.Machine{machineToExpire, machineNotExpire})

// deprovisioning won't delete the old node until the new node is ready
var wg sync.WaitGroup
Expand Down Expand Up @@ -269,7 +269,7 @@ var _ = Describe("Expiration", func() {
ExpectManualBinding(ctx, env.Client, pod, node)

// inform cluster state about nodes and machines
ExpectMakeReadyAndStateUpdated(ctx, env.Client, nodeStateController, machineStateController, []*v1.Node{node}, []*v1alpha5.Machine{machine})
ExpectMakeInitializedAndStateUpdated(ctx, env.Client, nodeStateController, machineStateController, []*v1.Node{node}, []*v1alpha5.Machine{machine})

// deprovisioning won't delete the old node until the new node is ready
var wg sync.WaitGroup
Expand Down Expand Up @@ -321,7 +321,7 @@ var _ = Describe("Expiration", func() {
ExpectManualBinding(ctx, env.Client, pod, node)

// inform cluster state about nodes and machines
ExpectMakeReadyAndStateUpdated(ctx, env.Client, nodeStateController, machineStateController, []*v1.Node{node}, []*v1alpha5.Machine{machine})
ExpectMakeInitializedAndStateUpdated(ctx, env.Client, nodeStateController, machineStateController, []*v1.Node{node}, []*v1alpha5.Machine{machine})

var wg sync.WaitGroup
ExpectTriggerVerifyAction(&wg)
Expand Down Expand Up @@ -413,7 +413,7 @@ var _ = Describe("Expiration", func() {
ExpectManualBinding(ctx, env.Client, pods[2], node)

// inform cluster state about nodes and machines
ExpectMakeReadyAndStateUpdated(ctx, env.Client, nodeStateController, machineStateController, []*v1.Node{node}, []*v1alpha5.Machine{machine})
ExpectMakeInitializedAndStateUpdated(ctx, env.Client, nodeStateController, machineStateController, []*v1.Node{node}, []*v1alpha5.Machine{machine})

// deprovisioning won't delete the old machine until the new machine is ready
var wg sync.WaitGroup
Expand Down
Loading

0 comments on commit 1e88464

Please sign in to comment.