-
Notifications
You must be signed in to change notification settings - Fork 104
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
fix(kubeconfig-rotate): adding rotation of kubeconfig #341
Conversation
✅ Deploy Preview for kamaji-documentation canceled.
|
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.
Thanks for the quick fix.
I'd like to think about this more in a different way to tackle this. With your proposal change, we need to wait for a TCP reconciliation before having the rotation of the kubeconfig.
Furthermore, we need to have the same logic also for certificates, such as the API server one, or the Front Proxy.
What we could do, my 2 cents, is to leverage the same principle we're suggesting in operating Kamaji, such as deleting the Secret to perform a rotation since this will trigger the TCP reconciliation, thus the Secret creation.
I'm thinking of a Secret controller which is looking up Secret resources and, according to the type, extracts the NotAfter
field for the given x509 certificate, and enqueue it back according to the expiration.
Once this has been achieved (with a minimum gap, such as a day) the Controller will take care of deleting it to trigger the TCP reconciliation.
WDYT?
Yes, That was also my second consideration. I want to give you another option and you can decide which one is nicer for kamaji. In terms of the kubeadm control plane provider, it uses the sync-period option(https://github.com/kubernetes-sigs/cluster-api/blob/1f5fcd22fceccdd6286914bfb0ac494639f4d000/controlplane/kubeadm/main.go#L137) and they provide users certificatesExpiryDays(https://cluster-api.sigs.k8s.io/tasks/certs/auto-rotate-certificates-in-kcp.html). Like kubeadm control plane provider, we can add the sync-period option for TCPs' reconciliation and modify the checkCertificateValidity function( kamaji/internal/crypto/crypto.go Line 196 in 8e8ee92
|
I think TCPs should be reconciled regularly with two reasons and we can check the validity of the certificates before expiration on the regular basis. Please, refer https://pkg.go.dev/sigs.k8s.io/controller-runtime/pkg/manager. A period sync happens for two reasons:
|
Closed in favour of #342. |
Closes #340.