🐛 Gracefully handle not-found when resolving owner references#13510
🐛 Gracefully handle not-found when resolving owner references#13510damdo wants to merge 1 commit intokubernetes-sigs:mainfrom
Conversation
When a Machine or MachineSet has an owner reference pointing to a MachineSet or MachineDeployment that no longer exists (e.g. during deletion or garbage collection), the controller would return a hard error blocking further reconciliation, e.g. for deleting purposes. Handle this by treating a NotFound error the same as having no owner (standalone) and return nil instead of an error.
|
Skipping CI for Draft Pull Request. |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
/assign @fabriziopandini @sbueringer |
Let's move the PR out of draft so we can run CI. Let's hold instead /hold |
|
/test pull-cluster-api-e2e-main-gke |
|
|
||
| md := &clusterv1.MachineDeployment{} | ||
| if err := r.Client.Get(ctx, client.ObjectKey{Namespace: machineSet.Namespace, Name: mdName}, md); err != nil { | ||
| if apierrors.IsNotFound(err) { |
There was a problem hiding this comment.
I'm pretty sure this can lead to panics in reconcileUnhealthyMachines
What this PR does / why we need it:
When a Machine or MachineSet has an owner reference pointing to a MachineSet or MachineDeployment that no longer exists (e.g. got forcefully removed), the controller would return a hard error blocking further reconciliation, e.g. for deleting purposes.
Handle this by treating a NotFound error the same as having no owner (standalone) and return nil instead of an error.
Which issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)format, will close the issue(s) when PR gets merged):Fixes #13405
/area machine
/area machineset
NOTE: As decided during KubeCon, this PR is draft until we audit and confirm this doesn't break any existing assumption in code.
cc. @fabriziopandini @sbueringer