-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
🐛 (kustomize/v2, go/v4): Fix ca injection for conversion webhooks #4282
base: master
Are you sure you want to change the base?
🐛 (kustomize/v2, go/v4): Fix ca injection for conversion webhooks #4282
Conversation
1b5cddf
to
41e2c58
Compare
771d28b
to
fd37dfc
Compare
fd37dfc
to
093c664
Compare
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: camilamacedo86, grzesuav The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
6cc8aba
to
eb167ea
Compare
5a198df
to
d5055b5
Compare
d5055b5
to
2d60e80
Compare
The CA injection patch has **not** worked for `go/v4` and `kustomize/v2` (release `3.5.0`) due to the need to replace `vars` with `replacements`, as `vars` are no longer supported in the latest major versions of Kustomize. However, since webhook `--conversion` was an incomplete feature until the upcoming Kubebuilder future release `v4.4.0` (where [PR kubernetes-sigs#4254](kubernetes-sigs#4254) is expected to be merged), users likely didn’t encounter this issue or addressed it manually by fixing the scaffold. **Note:** This change only affects projects that require a **conversion webhook**.
2d60e80
to
c8ab90e
Compare
PR needs rebase. 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. |
PR Description
The CA injection patch has not worked for
go/v4
andkustomize/v2
(release3.5.0
) due to the need to replacevars
withreplacements
, asvars
are no longer supported in the latest major versions of Kustomize.However, since webhook
--conversion
was an incomplete feature until the upcoming Kubebuilder future releasev4.4.0
(where PR #4254 is expected to be merged), users likely didn’t encounter this issue or addressed it manually by fixing the scaffold.Note: This change only affects projects that require a conversion webhook.
To better understand the issue and context please see: #4285
Closes: #4285
To manually fix projects scaffolded with previous versions, users can:
Remove the CERTMANAGER Section from
config/crd/kustomization.yaml
:Delete the
CERTMANAGER
section to avoid unintended CA injection patches for CRDs. Ensure the following lines are removed or commented out:Add CA Injection Configuration in
config/default/kustomization.yaml
:In
config/default/kustomization.yaml
, add the following code under[CERTMANAGER]
for CA injection:Important: Ensure that these scaffold markers are included:
+kubebuilder:scaffold:crdkustomizecainjectionns
+kubebuilder:scaffold:crdkustomizecainjectioname
Ensure Only Conversion Webhook Patches in config/crd/patches:
The
config/crd/patches
directory and the corresponding entries inconfig/crd/kustomization.yaml
should onlycontain files for conversion webhooks. Previously, a bug (🐛 (kustomize/v2, go/v4): Fix incorrect generation of manifests under config/crd/patches. Previously, the /convert service patch was being generated for all webhooks instead of only for those with --conversion enabled. #4280) caused the patch file to be generated for any webhook,
but only patches for webhooks created with the
--conversion
option should be included.For further guidance, you can refer to examples in the
testdata/
directory in the Kubebuilder repository.