-
Notifications
You must be signed in to change notification settings - Fork 779
Fix v1beta1 webhook #2358
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
Fix v1beta1 webhook #2358
Conversation
The v1 webhook did work as expected, but not the v1beta1 webhook before this commit. To fix this, it: * creates 2 distinct webhooks with distinct names (`elastic-es-validation-v1beta1.k8s.elastic.co` and `elastic-es-validation-v1.k8s.elastic.co`) in the ValidatingWebhookConfiguration * ensures the v1beta1 webhook is created along with the v1 webhook at operator startup * registers v1beta1 resources in the schema, required for the v1beta1 webhook to run To test it, I deployed the operator and webhook configurations, then: - tried applying a v1beta1 resource: the v1beta1 webhook was triggered, returning an error mentioning v1beta1.NodeSet - tried applying a v1 resource: the v1 webhook was triggered, returning an error mentioning v1.NodeSet
thbkrkr
left a comment
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
docs/webhook.asciidoc
Outdated
| The webhook is composed of 4 main components. Here is a brief description of each of them to understand how they interact, their naming, and how they are managed. | ||
|
|
||
| . A `ValidatingWebhookConfiguration` object that defines the validating webhook, named `elastic-es-validation.k8s.elastic.co`. It must be created before starting the operator. The `caBundle` field can be automatically managed as part of the automatic certificate management _(see below)_. | ||
| . A `ValidatingWebhookConfiguration` object that defines the validating webhook, named `elastic-es-validation-{eck_crd_version}.k8s.elastic.co`. It must be created before starting the operator. The `caBundle` field can be automatically managed as part of the automatic certificate management _(see below)_. |
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.
The ValidatingWebhookConfiguration object is named elastic-webhook.k8s.elastic.co
It is the clientConfig that is named elastic-es-validation-{eck_crd_version}.k8s.elastic.co
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.
The ValidatingWebhookConfiguration contains a webhooks array of Webhook, for which we define the name. That's not the name of the clientConfig.
I think in "A ValidatingWebhookConfiguration object that defines the validating webhook, named elastic-es-validation-{eck_crd_version}.k8s.elastic.co", named refers to the inner validating webhook, not to the ValidatingWebhookConfiguration.
WDYT?
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.
We can maybe simplify that sentence to A ValidatingWebhookConfiguration object that defines the validating webhooks(without any name reference) so we avoid the confusion?
I think the user can name them any way they want as long as they point to the correct path.
barkbay
left a comment
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.
Just left a nit in the doc, otherwise lgtm
* Fix v1beta1 webhook The v1 webhook did work as expected, but not the v1beta1 webhook before this commit. To fix this, it: * creates 2 distinct webhooks with distinct names (`elastic-es-validation-v1beta1.k8s.elastic.co` and `elastic-es-validation-v1.k8s.elastic.co`) in the ValidatingWebhookConfiguration * ensures the v1beta1 webhook is created along with the v1 webhook at operator startup * registers v1beta1 resources in the schema, required for the v1beta1 webhook to run To test it, I deployed the operator and webhook configurations, then: - tried applying a v1beta1 resource: the v1beta1 webhook was triggered, returning an error mentioning v1beta1.NodeSet - tried applying a v1 resource: the v1 webhook was triggered, returning an error mentioning v1.NodeSet * Remove ambiguity in webhooks docs
* Fix v1beta1 webhook The v1 webhook did work as expected, but not the v1beta1 webhook before this commit. To fix this, it: * creates 2 distinct webhooks with distinct names (`elastic-es-validation-v1beta1.k8s.elastic.co` and `elastic-es-validation-v1.k8s.elastic.co`) in the ValidatingWebhookConfiguration * ensures the v1beta1 webhook is created along with the v1 webhook at operator startup * registers v1beta1 resources in the schema, required for the v1beta1 webhook to run To test it, I deployed the operator and webhook configurations, then: - tried applying a v1beta1 resource: the v1beta1 webhook was triggered, returning an error mentioning v1beta1.NodeSet - tried applying a v1 resource: the v1 webhook was triggered, returning an error mentioning v1.NodeSet * Remove ambiguity in webhooks docs
* Fix v1beta1 webhook The v1 webhook did work as expected, but not the v1beta1 webhook before this commit. To fix this, it: * creates 2 distinct webhooks with distinct names (`elastic-es-validation-v1beta1.k8s.elastic.co` and `elastic-es-validation-v1.k8s.elastic.co`) in the ValidatingWebhookConfiguration * ensures the v1beta1 webhook is created along with the v1 webhook at operator startup * registers v1beta1 resources in the schema, required for the v1beta1 webhook to run To test it, I deployed the operator and webhook configurations, then: - tried applying a v1beta1 resource: the v1beta1 webhook was triggered, returning an error mentioning v1beta1.NodeSet - tried applying a v1 resource: the v1 webhook was triggered, returning an error mentioning v1.NodeSet * Remove ambiguity in webhooks docs
The v1 webhook did work as expected, but not the v1beta1 webhook before
this commit.
To fix this, it:
(
elastic-es-validation-v1beta1.k8s.elastic.coandelastic-es-validation-v1.k8s.elastic.co) in theValidatingWebhookConfiguration
operator startup
webhook to run
To test it, I deployed the operator and webhook configurations, then:
returning an error mentioning v1beta1.NodeSet
an error mentioning v1.NodeSet
Fixes #2355.