-
Notifications
You must be signed in to change notification settings - Fork 33
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
feat: certificate rotation #829
feat: certificate rotation #829
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #829 +/- ##
==========================================
- Coverage 70.96% 70.14% -0.83%
==========================================
Files 27 29 +2
Lines 2435 2599 +164
==========================================
+ Hits 1728 1823 +95
- Misses 562 601 +39
- Partials 145 175 +30
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
6372337
to
787677e
Compare
a24541a
to
dd5fc7a
Compare
225d8c8
to
fb6a2cf
Compare
2146a33
to
43be290
Compare
43be290
to
4731544
Compare
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.
Looks really good, I like it! 👏
I left some minor comments
client.MatchingLabels{ | ||
"app.kubernetes.io/part-of": "kubewarden", | ||
"app.kubernetes.io/component": "policy-server", | ||
}, |
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.
Also here, I think we're not using these labels right now (KW 1.16). I haven't finished to review the whole PR, I guess that if this PR changes the PolicyServer reconciler to add these labels everything will be fine.
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.
good catch, we are using those for the default policy server: https://github.com/kubewarden/helm-charts/blob/735ccfd74a44eca62f4f35093877f6197221913b/charts/kubewarden-defaults/templates/policyserver-default.yaml#L6 but they are not reconciled
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.
LGTM! great work!
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.
LGTM. Thanks for the great work!
8460ed6
to
382e7ca
Compare
382e7ca
to
28a7495
Compare
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.
LGTM, thanks for the hard work!
Congrats! 🚀 |
Signed-off-by: Fabrizio Sestito <fabrizio.sestito@suse.com>
Signed-off-by: Fabrizio Sestito <fabrizio.sestito@suse.com>
Signed-off-by: Fabrizio Sestito <fabrizio.sestito@suse.com>
Signed-off-by: Fabrizio Sestito <fabrizio.sestito@suse.com>
Signed-off-by: Fabrizio Sestito <fabrizio.sestito@suse.com>
…ollers Signed-off-by: Fabrizio Sestito <fabrizio.sestito@suse.com>
Signed-off-by: Fabrizio Sestito <fabrizio.sestito@suse.com>
Signed-off-by: Fabrizio Sestito <fabrizio.sestito@suse.com>
Signed-off-by: Fabrizio Sestito <fabrizio.sestito@suse.com>
Signed-off-by: Fabrizio Sestito <fabrizio.sestito@suse.com>
Signed-off-by: Fabrizio Sestito <fabrizio.sestito@suse.com>
Signed-off-by: Fabrizio Sestito <fabrizio.sestito@suse.com>
In the recent root CA controller change we changed the labels used in the controller. Therefore, the policy groups policies tests need to be updated to make them work in the latest controller. Signed-off-by: José Guilherme Vanz <jguilhermevanz@suse.com>
28a7495
to
4146066
Compare
@kubewarden/kubewarden-developers I've rebased this PR on top of the latest main branch. I think that after tests passes, we can merge it. |
Thanks! everything green, merging 🚀 |
Moved the TODO tasks on this PR to the certs epic #7. |
Description
This PR introduces a new runnable (
CertController
) that rotates CA root and leaf certificates:It removes the
cert-manager
dependency.NOTE: this PR requires helm chart changes, see: kubewarden/helm-charts#488
TODO:
genCA
andgenSignedCert
to the templates)Testing
The cert controller has been tested by using gingko/envtest.
Additional information
Part-of label
Before these changes, we used the
kubewarden: true
label in the webhook configuration, to filter kubewarden resources.However, using the recommended label
app.kubernetes is better.io/part-of
is more idiomatic.Also, the label is already set by the helm chart on the controller's webhook configurations.
Unfortunately, we need to support both labels to be compatible with the older versions.
Injecting the CA bundle
There was the need to use the
retry.RetryOnConflict
utility when injecting thecaBundle
in the validating/mutating webhook configuration since there could be a chance to have a conflict with the neighbor controllers (namely the policy controllers).(Cluster)AdmissionPolicyController
will eventually converge to the new bundle, since it reads the secret (from the cache) every time it restores the webhook configuration.Instead, the
CertController
reconciliation loop is ticker-based, so we cannot wait for the next tick to reconcile again. Therefore retrying with a certain backoff is a good strategy in this situation. See: kubernetes-sigs/controller-runtime#1748Fixes #819, fixes #818