-
Notifications
You must be signed in to change notification settings - Fork 106
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
Only create per-object webhooks for configured types #285
Only create per-object webhooks for configured types #285
Conversation
Skipping CI for Draft Pull Request. |
/test all |
/test pull-hnc-test |
1 similar comment
/test pull-hnc-test |
/test pull-hnc-test |
df0d27b
to
49c6a36
Compare
/test pull-hnc-test |
@adrianludwin Existing tests are running fine now. Before writing some tests for this new feature, I would like to get your opinion on the approach. Because of the cert-rotator (as always 😉), I cannot move the now dynamic objects-webhook to a dedicated validating webhook configuration resource. IMO we should not mess with resources provisioned as part of HNC. That will never work with modern GitOps-tools like FluxCD/ArgoCD - as their reconcilers will compete with our internal reconciler. I would love to get your thoughts anyway, but I will continue writing tests now. |
Is this only a problem with cert-rotator? Or would cert-manager have the same problem? I would have thought that any controller that tried to inject certs into the webhook would have the same problem? How does cert-manager work with gitops tools today? Is there no way to say "please ignore these fields?"
Does this have something to do with the cert-rotator problem? I thought the caBundle needs to be injected to every new webhook (e.g. there isn't one caBundle per config) so why does moving these to a new config help? Just so Flux/Argo don't try to reconcile it away? Instead of hand-writing a patch, why not create the entire webhook config in code? There's not a lot in a webhook config other than the list of webhooks. |
I think my formulation was bad, sorry. The real problem is not with cert-rotator (or cert-manager). But with cert-manager, we could create a dedicated dynamic
WDYM? The kubebuilder markers does not allow a user to configure a webhook without rules. That is why I suggest to add the complete object-webhook using a patch. All other webhooks are sourced from kubebuilder-markers, so the |
Why doesn't this work with cert-rotator as well?
Yeah, this is what I'd expect as well. As long as the new controller doesn't respond to changes to caBundle, and cert-rotator doesn't respond to anything except changes to caBundle, we should be fine.
Yup that sgtm. My only suggestion was that instead of hand-creating the object webhook in a patch, the HNC controller just has the entire object built-in. That is, if (say) |
... I guess the only problem with creating it automatically is that if users want to disable it somehow, they can't. Maybe that's a good reason to have HNC rely on the VWC config existing:
Given this, a hand-written, empty VWC sgtm! |
c93ea91
to
3004313
Compare
/test pull-hnc-test |
@adrianludwin I think the code is almost done and ready for review. All existing tests are passing, and I think this indirectly verifies that this feature works. The e2e-tests would never succeed if the objects-webhook was not reconciled correctly. |
Hey @adrianludwin @erikgb when do we think this will be merged and available for use? |
@adrianludwin I have now reverted all suggested changes to the integration test setup in ac97676 - as you had a lot of comments/questions to the proposed changes. I am pretty sure CI should fail now. Feel free to look into it. Since we are no longer using HNC I am not prepared to work more on this PR. |
As expected, it fails now: https://prow.k8s.io/view/gs/kubernetes-jenkins/pr-logs/pull/kubernetes-sigs_hierarchical-namespaces/285/pull-hnc-test/1766783682422509568. If I remember this correctly, a webhook is required in the reconciler integration tests because the reconciler is now managing a webhook. And since the envTest represents a real control plane - we also need to mock/fake the webhook endpoint. I am going to revert the revert now, and hope you can look at this PR again - with the understanding that the new webhook setup IS required in the reconciler integration test. |
d3ae6d7
to
237fdba
Compare
237fdba
to
36139e3
Compare
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: erikgb, rjbez17 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 |
Fixes #152