From c60bf3b99dfadcd165ecc3d9f970ed7cc8ef17bc Mon Sep 17 00:00:00 2001 From: viragvoros Date: Tue, 23 Jun 2026 14:02:27 +0200 Subject: [PATCH 1/3] Fix machine loop stall when backing node is missing --- pkg/util/provider/machinecontroller/machine.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/pkg/util/provider/machinecontroller/machine.go b/pkg/util/provider/machinecontroller/machine.go index fc05c38c76..07fe60f993 100644 --- a/pkg/util/provider/machinecontroller/machine.go +++ b/pkg/util/provider/machinecontroller/machine.go @@ -774,7 +774,15 @@ 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) { + err = nil + nodeAnnotationValue = "" + } else { + return + } } } var effectivePreserveValue string From 9cec03d89580db3af72803ccb8c3a60fe4816627 Mon Sep 17 00:00:00 2001 From: viragvoros Date: Tue, 23 Jun 2026 14:24:35 +0200 Subject: [PATCH 2/3] Add test --- .../provider/machinecontroller/machine_test.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/pkg/util/provider/machinecontroller/machine_test.go b/pkg/util/provider/machinecontroller/machine_test.go index 15f98f5098..05598f6c9a 100644 --- a/pkg/util/provider/machinecontroller/machine_test.go +++ b/pkg/util/provider/machinecontroller/machine_test.go @@ -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, + }, + }), ) }) }) From c09ec927425e4afb2542611902daa42e71595c1b Mon Sep 17 00:00:00 2001 From: viragvoros Date: Tue, 23 Jun 2026 14:42:55 +0200 Subject: [PATCH 3/3] happy linter --- pkg/util/provider/machinecontroller/machine.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/pkg/util/provider/machinecontroller/machine.go b/pkg/util/provider/machinecontroller/machine.go index 07fe60f993..77255dfede 100644 --- a/pkg/util/provider/machinecontroller/machine.go +++ b/pkg/util/provider/machinecontroller/machine.go @@ -777,12 +777,11 @@ func (c *controller) manageMachinePreservation(ctx context.Context, machine *v1a // 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) { - err = nil - nodeAnnotationValue = "" - } else { + if !apierrors.IsNotFound(err) { return } + err = nil + nodeAnnotationValue = "" } } var effectivePreserveValue string