Skip to content
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

Merged
merged 2 commits into from Oct 23, 2019

Conversation

tangle329
Copy link
Contributor

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 #

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Sep 9, 2019
@k8s-ci-robot
Copy link
Contributor

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 /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

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.

@k8s-ci-robot k8s-ci-robot added needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Sep 9, 2019
@@ -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)
}
Copy link
Member

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?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vincepri added a commit to change the ordering and rebased to account for the addition of a context to external.CloneTemplate

@detiber Will this cause the leak of bootstrapconfig?

Copy link
Member

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.

Copy link
Member

@vincepri vincepri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Sep 10, 2019
@ncdc ncdc changed the title cleanup infrastructure configuration object after bootstrap clone error 🐛cleanup infrastructure configuration object after bootstrap clone error Sep 11, 2019
@ncdc ncdc changed the title 🐛cleanup infrastructure configuration object after bootstrap clone error 🐛 cleanup infrastructure configuration object after bootstrap clone error Sep 11, 2019
@vincepri
Copy link
Member

@tangle329 Are you still interested in this change? If so, would you be able to address the PR comments?

@vincepri
Copy link
Member

@detiber if that's ok, let's merge this in and open an issue with your comment?

@k8s-ci-robot k8s-ci-robot added needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Oct 23, 2019
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 23, 2019
@detiber
Copy link
Member

detiber commented Oct 23, 2019

@vincepri added a commit to change the ordering and rebased to account for the addition of a context to external.CloneTemplate

@vincepri
Copy link
Member

/approve
/lgtm
/milestone v0.3.0

@k8s-ci-robot k8s-ci-robot added this to the v0.3.0 milestone Oct 23, 2019
@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 23, 2019
@k8s-ci-robot
Copy link
Contributor

[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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 23, 2019
@k8s-ci-robot k8s-ci-robot merged commit 5d0462c into kubernetes-sigs:master Oct 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants