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

🐛 Delete unused ControlPlane InfrastructureMachineTemplates on rotation #6399

Merged

Conversation

killianmuldoon
Copy link
Contributor

@killianmuldoon killianmuldoon commented Apr 8, 2022

Delete ControlPlane InfrastructureMachineTemplates on a best effort basis once they have been rotated during a reconciliation loop.

Signed-off-by: killianmuldoon [email protected]

Fixes #6375
@chrischdi @fabriziopandini

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Apr 8, 2022
@k8s-ci-robot k8s-ci-robot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Apr 8, 2022
// If the controlPlane has infrastructureMachines and the InfrastructureMachineTemplate has changed on this reconcile
// delete the old template.
// This is a best effort deletion only and may leak templates if an error occurs during reconciliation.
// TODO:(killianmuldoon) Make a more holistic template deletion flow.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll create an issue covering over the problems with the way we currently handle template rotation.

Copy link
Member

Choose a reason for hiding this comment

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

Maybe we shouldn't have this todo here (when we merge this PR). I think it's better to just have an issue describing the holistic problem vs having the TODO here specifically (as the problem is much more widespread then just this location)

@killianmuldoon killianmuldoon changed the title Delete unused ControlPlane InfrastructureMachineTemplates on rotation 🐛 Delete unused ControlPlane InfrastructureMachineTemplates on rotation Apr 8, 2022
@chrischdi
Copy link
Member

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Apr 11, 2022
@JoelSpeed
Copy link
Contributor

/lgtm

Copy link
Member

@sbueringer sbueringer left a comment

Choose a reason for hiding this comment

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

Overall looks good. If not already done, I think one manual test would be good to ensure we're not missing anything. (just create a classy cluster and rotate the inframachinetemplate of the control plane once + verify the old one is gone)

// If the controlPlane has infrastructureMachines and the InfrastructureMachineTemplate has changed on this reconcile
// delete the old template.
// This is a best effort deletion only and may leak templates if an error occurs during reconciliation.
// TODO:(killianmuldoon) Make a more holistic template deletion flow.
Copy link
Member

Choose a reason for hiding this comment

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

Maybe we shouldn't have this todo here (when we merge this PR). I think it's better to just have an issue describing the holistic problem vs having the TODO here specifically (as the problem is much more widespread then just this location)

internal/controllers/topology/cluster/reconcile_state.go Outdated Show resolved Hide resolved
@ykakarap ykakarap force-pushed the fix/template-deletion branch from c804f44 to 116c751 Compare April 27, 2022 23:09
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Apr 27, 2022
@ykakarap
Copy link
Contributor

@fabriziopandini @sbueringer Addressed the PR comments.

@chrischdi
Copy link
Member

/retest

Looks like this was a network related issue to github while fetching manifests

@sbueringer
Copy link
Member

Thx!

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Apr 28, 2022
@fabriziopandini
Copy link
Member

/lgtm
/approve
@killianmuldoon could you kindly open an issue to track the need to find a reentrant solution for CP machines template cleanup

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: fabriziopandini

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 May 22, 2022
@k8s-ci-robot k8s-ci-robot merged commit 3580903 into kubernetes-sigs:main May 22, 2022
@k8s-ci-robot k8s-ci-robot added this to the v1.2 milestone May 22, 2022
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. 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.

ClusterClass: control plane template rotation leaks InfrastructureMachineTemplates
7 participants