Skip to content
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

allow customizing generated webhook's name and its service's namespace and name #865

Open
1 of 2 tasks
davidxia opened this issue Dec 1, 2023 · 15 comments
Open
1 of 2 tasks
Labels
lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness.

Comments

@davidxia
Copy link
Contributor

davidxia commented Dec 1, 2023

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 #490

Tasks

Preview Give feedback
  1. approved cncf-cla: yes lgtm ok-to-test size/XL
    sbueringer
@k8s-triage-robot
Copy link

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/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was 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

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Feb 29, 2024
@k8s-triage-robot
Copy link

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/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was 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

@k8s-ci-robot k8s-ci-robot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Mar 31, 2024
@sbueringer
Copy link
Member

@davidxia sounds reasonable, if you want to open a PR for it

@k8s-triage-robot
Copy link

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/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was 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-ci-robot
Copy link
Contributor

@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/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was 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

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.

@k8s-ci-robot k8s-ci-robot closed this as not planned Won't fix, can't repro, duplicate, stale May 3, 2024
@davidxia
Copy link
Contributor Author

davidxia commented Jul 2, 2024

@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?

@davidxia
Copy link
Contributor Author

davidxia commented Jul 3, 2024

@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? 🙏

@sbueringer
Copy link
Member

@davidxia we had a very similar PR before #824

I would expect roughly the same changes are necessary here

/reopen
/remove-lifecycle frozen
/lifecycle frozen

@k8s-ci-robot k8s-ci-robot reopened this Jul 10, 2024
@k8s-ci-robot
Copy link
Contributor

@sbueringer: Reopened this issue.

In response to this:

@davidxia we had a very similar PR before #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.

@k8s-ci-robot k8s-ci-robot added lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. and removed lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. labels Jul 10, 2024
@davidxia
Copy link
Contributor Author

@sbueringer thanks! Just curious why the url marker doesn't show up in the webhook markers doc?

@sbueringer
Copy link
Member

sbueringer commented Jul 10, 2024

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)

@davidxia
Copy link
Contributor Author

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)

Filed doc issue here.

davidxia added a commit to davidxia/controller-tools that referenced this issue Jul 10, 2024
davidxia added a commit to davidxia/controller-tools that referenced this issue Jul 11, 2024
davidxia added a commit to davidxia/controller-tools that referenced this issue Sep 2, 2024
closes kubernetes-sigs#865

## example usage

```
❯ GOBIN=(pwd)/bin go install ./cmd/*

❯ ./bin/controller-gen webhook -w

Webhook

+kubebuilder:webhook:admissionReviewVersions=<[]string>,failurePolicy=<string>,groups=<[]string>[,matchPolicy=<string>],mutating=<bool>,name=<string>[,path=<string>][,reinvocationPolicy=<string>],resources=<[]string>[,sideEffects=<string>][,timeoutSeconds=<int>][,url=<string>],verbs=<[]string>,versions=<[]string>[,webhookVersions=<[]string>]  package  specifies how a webhook should be served.
+kubebuilder:webhookconfiguration:mutating=<bool>[,name=<string>]                                                                                                                                                                                                                                                                                        package  specifies how a webhook should be served.
```
davidxia added a commit to davidxia/controller-tools that referenced this issue Sep 2, 2024
closes kubernetes-sigs#865

## example usage

```
❯ GOBIN=(pwd)/bin go install ./cmd/*

❯ ./bin/controller-gen webhook -w

Webhook

+kubebuilder:webhook:admissionReviewVersions=<[]string>,failurePolicy=<string>,groups=<[]string>[,matchPolicy=<string>],mutating=<bool>,name=<string>[,path=<string>][,reinvocationPolicy=<string>],resources=<[]string>[,sideEffects=<string>][,timeoutSeconds=<int>][,url=<string>],verbs=<[]string>,versions=<[]string>[,webhookVersions=<[]string>]  package  specifies how a webhook should be served.
+kubebuilder:webhookconfiguration:mutating=<bool>[,name=<string>]                                                                                                                                                                                                                                                                                        package  specifies how a webhook should be served.
```
davidxia added a commit to davidxia/controller-tools that referenced this issue Sep 10, 2024
closes kubernetes-sigs#865

## example usage

```
❯ GOBIN=(pwd)/bin go install ./cmd/*

❯ ./bin/controller-gen webhook -w

Webhook

+kubebuilder:webhook:admissionReviewVersions=<[]string>,failurePolicy=<string>,groups=<[]string>[,matchPolicy=<string>],mutating=<bool>,name=<string>[,path=<string>][,reinvocationPolicy=<string>],resources=<[]string>[,sideEffects=<string>][,timeoutSeconds=<int>][,url=<string>],verbs=<[]string>,versions=<[]string>[,webhookVersions=<[]string>]  package  specifies how a webhook should be served.
+kubebuilder:webhookconfiguration:mutating=<bool>[,name=<string>]                                                                                                                                                                                                                                                                                        package  specifies how a webhook should be served.
```
davidxia added a commit to davidxia/controller-tools that referenced this issue Sep 10, 2024
closes kubernetes-sigs#865

## example usage

```
❯ GOBIN=(pwd)/bin go install ./cmd/*

❯ ./bin/controller-gen webhook -w

Webhook

+kubebuilder:webhook:admissionReviewVersions=<[]string>,failurePolicy=<string>,groups=<[]string>[,matchPolicy=<string>],mutating=<bool>,name=<string>[,path=<string>][,reinvocationPolicy=<string>],resources=<[]string>[,sideEffects=<string>][,timeoutSeconds=<int>][,url=<string>],verbs=<[]string>,versions=<[]string>[,webhookVersions=<[]string>]  package  specifies how a webhook should be served.
+kubebuilder:webhookconfiguration:mutating=<bool>[,name=<string>]                                                                                                                                                                                                                                                                                        package  specifies how a webhook should be served.
```

Signed-off-by: David Xia <[email protected]>
@davidxia
Copy link
Contributor Author

@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>]

@sbueringer
Copy link
Member

Thx. Sounds good

@risentveber
Copy link

Also it would be nice to have a servicePort argument for mutatingwebhookconfiguration.webhooks.clientConfig.service.port

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness.
Projects
None yet
Development

No branches or pull requests

5 participants