Skip to content

How to handle deleting machine.cluster.x-k8s.io/certificates-expiry annotation on the kubeadmconfig #7216

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

Closed
ykakarap opened this issue Sep 14, 2022 · 11 comments
Labels
area/bootstrap Issues or PRs related to bootstrap providers triage/accepted Indicates an issue or PR is ready to be actively worked on.

Comments

@ykakarap
Copy link
Contributor

Detailed Description

This issue is to discuss how to handle user deleting the machine.cluster.x-k8s.io/certificates-expiry annotation on KubeadmConfig.

The option proposed was:

  • Block the deletion of the annotation in the webhook of KubeadmConfig.
  • Simply document the need and use of annotation

Ref: #6983 (comment)

@k8s-ci-robot k8s-ci-robot added the needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. label Sep 14, 2022
@sbueringer
Copy link
Member

sbueringer commented Sep 14, 2022

Just wanted to add that when we implement in-place propagation of labels/annotations we have to take care that we don't overwrite this annotation on the Machine and on the KubeadmConfig. But I guess that's already a requirement there for any additional labels/annotations anyway.

Back to topic: I think validating in the validate update hook of KubeadmConfig that this annotation can never be removed once it has been added is the ideal solution. It protects against users accidentally deleting the annotation and against bugs in our implementation.

I think I wouldn't do anything for the Machine so folks can do whatever they want there.

@fabriziopandini
Copy link
Member

+1 to prevent users from removing / modifying the annotation
/triage accepted

@k8s-ci-robot k8s-ci-robot added triage/accepted Indicates an issue or PR is ready to be actively worked on. and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Sep 14, 2022
@fabriziopandini fabriziopandini added the area/bootstrap Issues or PRs related to bootstrap providers label Sep 14, 2022
@killianmuldoon
Copy link
Contributor

Aside: Could the same be done for other pieces of metadata that CAPI relies on as a source of truth? e.g. the topologyOwned label?

@sbueringer
Copy link
Member

For the ones that should be immutable - yes

@fabriziopandini
Copy link
Member

thinking a little bit more about this.
I'm not sure we should go down the path of making labels immutable (it makes sense, but even in KK they are not, and also this goes behind the scope of this issue), so this is a broader discussion.

The problem with this specific issue is that we should prevent the annotation to be created with the wrong expiration date, which can lead to certificate expiration. An idea could be:
if the data secret has been already generated, and the annotation is missing, set a condition with a warning

@fabriziopandini
Copy link
Member

in this use case API server warnings would be an even better solution because they give an immediate feedback to the users, but we have to wait for controller runtime to support them

@vincepri
Copy link
Member

While can be a problem, there are a number of similar issues where deleting a label or annotation could result in the system not behaving accordingly. While we could go down the path of preventing the annotation to be removed through the webhook (which I'm fine with), we could also choose to keep it as-is and document the side effects in case that happens

@ykakarap
Copy link
Contributor Author

we could also choose to keep it as-is and document the side effects in case that happens

We dont explicitly call it out now, but I think we should add a section about this in the new Certificate Renewal doc that we are adding. Ref PR: #7268

@sbueringer
Copy link
Member

I think we don't care about this case anymore, given that KCP will just add it again on the next reconcile

@ykakarap @fabriziopandini WDYT, can we close this issue?

@fabriziopandini
Copy link
Member

makes sense for me
/close

@k8s-ci-robot
Copy link
Contributor

@fabriziopandini: Closing this issue.

In response to this:

makes sense for me
/close

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/bootstrap Issues or PRs related to bootstrap providers triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
None yet
Development

No branches or pull requests

6 participants