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

Facilitate the config on the scaffolding when only validation OR Mutation Webhooks are used #4119

Open
camilamacedo86 opened this issue Aug 30, 2024 · 0 comments · May be fixed by #4123
Open
Assignees
Labels
good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. kind/bug Categorizes issue or PR as related to a bug.

Comments

@camilamacedo86
Copy link
Member

camilamacedo86 commented Aug 30, 2024

What broke? What's expected?

When attempting to scaffold only ValidatingWebhooks in a new kubebuilder project, I encountered an issue where MutatingWebhookConfiguration references still cause errors, despite ensuring that all related configuration for MutatingWebhookConfiguration is commented out or removed. Also, see that we just scaffold MutatingWebhookConfiguration when the flag --defaulting is used. Then, note that the cert-manager configuration is not working well with only one of the cases scenarios. See that for example, for we run and test our e2e scaffolded for the sample we need to use both flags to make it work: https://github.com/kubernetes-sigs/kubebuilder/pull/4118/files

I expected be able to configure the default scaffold ONLY with validation webhooks and without defaulting/mutation. The scaffold should help and allow users be able to configure only one of them and work well in this case. We need to check what changes is required to do for each case scenario and ensure that the scaffolds can easily configured by users in thoses cases.

Reproducing this issue

  1. Initialize a new Kubebuilder project:

    kubebuilder init --domain testproject.org --repo sigs.k8s.io/test
  2. Create a new API:

kubebuilder create api --group ship --version v1beta1 --kind Frigate
  1. create the webhook
kubebuilder create webhook --group ship --version v1beta1 --kind Frigate --programmatic-validation
  1. Uncomment relevant sections in config/default/kustomization.yaml to enable cert-manager

NOTE: Indeed if I only uncomment all that is required only for ValidationConfig I still facing the issue

  1. Generate the manifests and kustomize
make generate
make manifests
make build-installer

Error

Error: no resource matches strategic merge patch "MutatingWebhookConfiguration.v1.admissionregistration.k8s.io/mutating-webhook-configuration.[noNs]": no matches for Id MutatingWebhookConfiguration.v1.admissionregistration.k8s.io/mutating-webhook-configuration.[noNs]; failed to find unique target for patch MutatingWebhookConfiguration.v1.admissionregistration.k8s.io/mutating-webhook-configuration.[noNs]
make: *** [build-installer] Error 1

What is expected to get done in this task

  • We need to figure out what is the configuration required for ONLY Validation OR for ONLY Multation
  • We need to ensure that the scaffold provide can work with only one of the case scenarios
  • We need to ensure that users are properly guide via scaffold comments to know what to do and when
  • We need to have tests to ensure that configure only one of them will work fine

KubeBuilder (CLI) Version

master

PROJECT version

4.2.0

Plugin versions

go/v4
kustomize/v2

Other versions

No response

Extra Labels

No response

@camilamacedo86 camilamacedo86 added kind/bug Categorizes issue or PR as related to a bug. help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. labels Aug 30, 2024
@camilamacedo86 camilamacedo86 changed the title Error When Scaffolding Only Validation Webhooks in Kubebuilder Error and hard to config scaffolding Only for Validation or Mutation Webhooks Aug 30, 2024
@camilamacedo86 camilamacedo86 changed the title Error and hard to config scaffolding Only for Validation or Mutation Webhooks Facilitate the config on the scaffolding when only validation OR Mutation Webhooks are used Aug 30, 2024
camilamacedo86 added a commit to camilamacedo86/kubebuilder that referenced this issue Aug 30, 2024
We are enabling the execution of e2e tests for deploy-image in the GitHub action. However, to allow we easily configure the tests we needed to change the scaffold of the samples to have defaulting and validation webhooks.

So, we just added the --defaulting flag to generate the webhook for the testdata sample using deploy image and regenerated it. If you want to understand why see: kubernetes-sigs#4119
camilamacedo86 added a commit to camilamacedo86/kubebuilder that referenced this issue Aug 31, 2024
We are enabling the execution of e2e tests for deploy-image in the GitHub action. However, to allow we easily configure the tests we needed to change the scaffold of the samples to have defaulting and validation webhooks.

So, we just added the --defaulting flag to generate the webhook for the testdata sample using deploy image and regenerated it. If you want to understand why see: kubernetes-sigs#4119
camilamacedo86 added a commit to camilamacedo86/kubebuilder that referenced this issue Aug 31, 2024
We are enabling the execution of e2e tests for deploy-image in the GitHub action. However, to allow we easily configure the tests we needed to change the scaffold of the samples to have defaulting and validation webhooks.

So, we just added the --defaulting flag to generate the webhook for the testdata sample using deploy image and regenerated it. If you want to understand why see: kubernetes-sigs#4119
camilamacedo86 added a commit to camilamacedo86/kubebuilder that referenced this issue Aug 31, 2024
We are enabling the execution of e2e tests for deploy-image in the GitHub action. However, to allow we easily configure the tests we needed to change the scaffold of the samples to have defaulting and validation webhooks.

So, we just added the --defaulting flag to generate the webhook for the testdata sample using deploy image and regenerated it. If you want to understand why see: kubernetes-sigs#4119
camilamacedo86 added a commit to camilamacedo86/kubebuilder that referenced this issue Aug 31, 2024
We are enabling the execution of e2e tests for deploy-image in the GitHub action. However, to allow we easily configure the tests we needed to change the scaffold of the samples to have defaulting and validation webhooks.

So, we just added the --defaulting flag to generate the webhook for the testdata sample using deploy image and regenerated it. If you want to understand why see: kubernetes-sigs#4119
@camilamacedo86 camilamacedo86 self-assigned this Sep 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. kind/bug Categorizes issue or PR as related to a bug.
Projects
None yet
1 participant