✨ Allow customizing generated webhook K8s Service#1128
✨ Allow customizing generated webhook K8s Service#1128k8s-ci-robot merged 1 commit intokubernetes-sigs:mainfrom
Conversation
|
Hi @davidxia. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions 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. |
|
tested manually by
case 1: backwards compatibility
case 2: modify marker only for MutatingWebhookConfiguration
|
|
/ok-to-test |
Allow customizing the webhook K8s Service's name, namespace, and port. ## example usage Look for the new `serviceName`, `serviceNamespace`, and `servicePort` fields. ``` ❯ 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>[,serviceName=<string>][,serviceNamespace=<string>][,servicePort=<int>][,sideEffects=<string>][,timeoutSeconds=<int>][,url=<string>],verbs=<[]string>,versions=<[]string>[,webhookVersions=<[]string>] package specifies how a webhook should be served. ... ``` contributes to kubernetes-sigs#865 Signed-off-by: David Xia <david@davidxia.com>
|
Thanks for the initial review. Wrote an integration test. Ready for another review. |
|
Thank you! /lgtm |
|
LGTM label has been added. DetailsGit tree hash: babb9bdd65bafd28d6a0a9743b709b706d2bcc68 |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: davidxia, sbueringer The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
thank you! |
|
You're welcome :) Thx for the PR(s)! |
| v1 = "v1" | ||
| defaultWebhookVersion = v1 | ||
| defaultServiceName = "webhook-service" | ||
| defaultServiceNamespace = "system" |
There was a problem hiding this comment.
It looks like this change may have broken the default behavior 😞
Is this the intended outcome? Or is it an unexpected side effect of the change?
cc/ @sbueringer
There was a problem hiding this comment.
I don't see how this change could affect the name of your CRD?
CustomResourceDefinition.apiextensions.k8s.io "project-v4-system" is invalid: metadata.name: Invalid value: "project-v4-system": must be spec.names.plural+"."+spec.group
There was a problem hiding this comment.
At most this will affect the content of *WebhookConfiguration objects
There was a problem hiding this comment.
This change is meant to be backwards-compat.
I also see
error when retrieving current configuration of:
Resource: "admissionregistration.k8s.io/v1, Resource=mutatingwebhookconfigurations", GroupVersionKind: "admissionregistration.k8s.io/v1, Kind=MutatingWebhookConfiguration"
Name: "project-v4-mutating-webhook-configuration/project-v4-serving-cert", Namespace: ""
from server for: "STDIN": invalid resource name "project-v4-mutating-webhook-configuration/project-v4-serving-cert": [may not contain '/']
Is this another error separate from must be spec.names.plural+?
There was a problem hiding this comment.
You can close this one, @davidxia, as it's sorted out. I figured out what was wrong—it was my bad. Everything is working as before. Sorry for the unnecessary disturbance!
Allow customizing the webhook K8s Service's name, namespace, and port.
example usage
Look for the new
serviceName,serviceNamespace, andservicePortfields.contributes to #865