Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion pkg/util/provider/machinecontroller/machine.go
Original file line number Diff line number Diff line change
Expand Up @@ -774,7 +774,14 @@ func (c *controller) manageMachinePreservation(ctx context.Context, machine *v1a
if nodeName != "" {
nodeAnnotationValue, err = c.getNodePreserveAnnotationValue(nodeName)
if err != nil {
return
// If the Node object doesn't exist in the cluster yet,
// it cannot have a preservation annotation. Swallow the NotFound error
// so the machine can continue its status transition to Pending.
if !apierrors.IsNotFound(err) {
return
}
err = nil
nodeAnnotationValue = ""
}
}
var effectivePreserveValue string
Expand Down
14 changes: 14 additions & 0 deletions pkg/util/provider/machinecontroller/machine_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4448,6 +4448,20 @@ var _ = Describe("machine", func() {
err: nil,
},
}),
Entry("when machine has a backing node name, but node object does not exist in cluster, should swallow NotFound error and return LongRetry", testCase{
setup: setup{
nodeName: "non-existent-node",
nodeAnnotationValue: "",
machineAnnotationValue: "",
machinePhase: v1alpha1.MachineUnknown,
},
expect: expect{
preserveExpiryTimeIsSet: false,
nodeCondition: nil,
retry: machineutils.LongRetry,
err: nil,
},
}),
)
})
})
Loading