New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
🐛 cleanup infrastructure configuration object after bootstrap clone error #1400
Conversation
Hi @tangle329. Thanks for your PR. I'm waiting for a kubernetes-sigs or kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
controllers/machineset_controller.go
Outdated
@@ -273,6 +273,9 @@ func (r *MachineSetReconciler) syncReplicas(ms *clusterv1.MachineSet, machines [ | |||
if machine.Spec.Bootstrap.ConfigRef != nil { | |||
bootstrapConfig, err = external.CloneTemplate(r.Client, machine.Spec.Bootstrap.ConfigRef, machine.Namespace) | |||
if err != nil { | |||
if err := r.Client.Delete(context.TODO(), infraConfig); !apierrors.IsNotFound(err) { | |||
klog.Errorf("Failed to cleanup infrastructure configuration object after bootstrap clone error: %v", err) | |||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of attempting to delete here, would it make sense to move the cloning of the bootstrap template before the cloning of the infrastructure template?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm, I suppose that is indeed possible. I'm wondering if we should have some have some type of a reaper process to clean up these types of resources rather than trying to rely on conditional deletion. We could potentially add an annotation when we create the resource and clean up any that don't have an ownerref within some pre-defined period of time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/ok-to-test
@tangle329 Are you still interested in this change? If so, would you be able to address the PR comments? |
@detiber if that's ok, let's merge this in and open an issue with your comment? |
Signed-off-by: Tang Le <at28997146@163.com>
…emplate prior to infrastructure template
@vincepri added a commit to change the ordering and rebased to account for the addition of a context to |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: tangle329, vincepri The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Signed-off-by: Tang Le at28997146@163.com
What this PR does / why we need it:
We should cleanup infrastructure configuration object after bootstrap clone error, otherwise infrastructure configuration object will leak.
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 #