controller-tools
controller-tools copied to clipboard
allow customizing generated webhook's name and its service's namespace and name
I'm using kubebuilder which generates webhooks with these markers. The generated mutating webhook has a hardcoded name of mutating-webhook-configuration here, and the validating webhook has a hardcoded name of validating-webhook-configuration here.
The webhook's .webhooks[].clientConfig.service also have their namespace hardcoded to system and name to webhook-service, respectively.
I'd like to be able to customize these three parameters with the markers. My webhook Service might be in a different namespace and name. I might also have different webhooks that need different [Validating|Mutating]WebhookConfiguration names. It'd be nice to not have to generate these webhook YAMLs and then have to use kustomize to alter them.
Is this a feature request you're open to?
related to https://github.com/kubernetes-sigs/controller-tools/issues/490
### Tasks
- [ ] https://github.com/kubernetes-sigs/controller-tools/pull/1002
- [ ] allow customizing webhook Service's namespace and name
The Kubernetes project currently lacks enough contributors to adequately respond to all issues.
This bot triages un-triaged issues according to the following rules:
- After 90d of inactivity,
lifecycle/staleis applied - After 30d of inactivity since
lifecycle/stalewas applied,lifecycle/rottenis applied - After 30d of inactivity since
lifecycle/rottenwas applied, the issue is closed
You can:
- Mark this issue as fresh with
/remove-lifecycle stale - Close this issue with
/close - Offer to help out with Issue Triage
Please send feedback to sig-contributor-experience at kubernetes/community.
/lifecycle stale
The Kubernetes project currently lacks enough active contributors to adequately respond to all issues.
This bot triages un-triaged issues according to the following rules:
- After 90d of inactivity,
lifecycle/staleis applied - After 30d of inactivity since
lifecycle/stalewas applied,lifecycle/rottenis applied - After 30d of inactivity since
lifecycle/rottenwas applied, the issue is closed
You can:
- Mark this issue as fresh with
/remove-lifecycle rotten - Close this issue with
/close - Offer to help out with Issue Triage
Please send feedback to sig-contributor-experience at kubernetes/community.
/lifecycle rotten
@davidxia sounds reasonable, if you want to open a PR for it
The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.
This bot triages issues according to the following rules:
- After 90d of inactivity,
lifecycle/staleis applied - After 30d of inactivity since
lifecycle/stalewas applied,lifecycle/rottenis applied - After 30d of inactivity since
lifecycle/rottenwas applied, the issue is closed
You can:
- Reopen this issue with
/reopen - Mark this issue as fresh with
/remove-lifecycle rotten - Offer to help out with Issue Triage
Please send feedback to sig-contributor-experience at kubernetes/community.
/close not-planned
@k8s-triage-robot: Closing this issue, marking it as "Not Planned".
In response to this:
The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.
This bot triages issues according to the following rules:
- After 90d of inactivity,
lifecycle/staleis applied- After 30d of inactivity since
lifecycle/stalewas applied,lifecycle/rottenis applied- After 30d of inactivity since
lifecycle/rottenwas applied, the issue is closedYou can:
- Reopen this issue with
/reopen- Mark this issue as fresh with
/remove-lifecycle rotten- Offer to help out with Issue Triage
Please send feedback to sig-contributor-experience at kubernetes/community.
/close not-planned
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.
@davidxia sounds reasonable, if you want to open a PR for it
@sbueringer thanks. Can you point to the places in code where I'll need to change things?
@camilamacedo86 don't know if you're also a maintainer for this repo, but are you able to give me some pointers to start a PR for this one too? 🙏
@davidxia we had a very similar PR before https://github.com/kubernetes-sigs/controller-tools/pull/824
I would expect roughly the same changes are necessary here
/reopen /remove-lifecycle frozen /lifecycle frozen
@sbueringer: Reopened this issue.
In response to this:
@davidxia we had a very similar PR before https://github.com/kubernetes-sigs/controller-tools/pull/824
I would expect roughly the same changes are necessary here
/reopen /remove-lifecycle frozen /lifecycle frozen
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-sigs/prow repository.
@sbueringer thanks! Just curious why the url marker doesn't show up in the webhook markers doc?
I would say because nobody thought about updating the docs over there :)
Although I wonder if that page is generated (but I don't know)
I would say because nobody thought about updating the docs over there :)
Although I wonder if that page is generated (but I don't know)
@sbueringer I added a task list to the issue description. We've finished the first one. For the second of allow customizing webhook Service's namespace and name, what do you think of adding an optional serviceName and serviceNamespace to the kubebuilder:webhookconfiguration marker?
Currently +kubebuilder:webhookconfiguration:mutating=<bool>[,name=<string>]
Proposed +kubebuilder:webhookconfiguration:mutating=<bool>[,name=<string>][,serviceName=<string>][,serviceNamespace=<string>]
Thx. Sounds good
Also it would be nice to have a servicePort argument for mutatingwebhookconfiguration.webhooks.clientConfig.service.port
@sbueringer based on existing code, it made more sense to me to add Service name, namespace, and port to the Config struct. If https://github.com/kubernetes-sigs/controller-tools/pull/1128 looks good, I'll write tests and move the PR out of draft status.
Can be probably closed, now that #1128 is merged/merging?
yes!