diff --git a/docs/book/src/component-config-tutorial/testdata/project/config/crd/kustomization.yaml b/docs/book/src/component-config-tutorial/testdata/project/config/crd/kustomization.yaml index 22fff65b92c..97cb6432412 100644 --- a/docs/book/src/component-config-tutorial/testdata/project/config/crd/kustomization.yaml +++ b/docs/book/src/component-config-tutorial/testdata/project/config/crd/kustomization.yaml @@ -8,12 +8,12 @@ resources: patches: # [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix. # patches here are for enabling the conversion webhook for each CRD -#- patches/webhook_in_projectconfigs.yaml +#- path: patches/webhook_in_projectconfigs.yaml #+kubebuilder:scaffold:crdkustomizewebhookpatch # [CERTMANAGER] To enable cert-manager, uncomment all the sections with [CERTMANAGER] prefix. # patches here are for enabling the CA injection for each CRD -#- patches/cainjection_in_projectconfigs.yaml +#- path: patches/cainjection_in_projectconfigs.yaml #+kubebuilder:scaffold:crdkustomizecainjectionpatch # the following config is for teaching kustomize how to do kustomization for CRDs. diff --git a/docs/book/src/cronjob-tutorial/testdata/project/config/crd/kustomization.yaml b/docs/book/src/cronjob-tutorial/testdata/project/config/crd/kustomization.yaml index ed16f6b985b..726852ee68b 100644 --- a/docs/book/src/cronjob-tutorial/testdata/project/config/crd/kustomization.yaml +++ b/docs/book/src/cronjob-tutorial/testdata/project/config/crd/kustomization.yaml @@ -8,12 +8,12 @@ resources: patches: # [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix. # patches here are for enabling the conversion webhook for each CRD -- patches/webhook_in_cronjobs.yaml +- path: patches/webhook_in_cronjobs.yaml #+kubebuilder:scaffold:crdkustomizewebhookpatch # [CERTMANAGER] To enable cert-manager, uncomment all the sections with [CERTMANAGER] prefix. # patches here are for enabling the CA injection for each CRD -- patches/cainjection_in_cronjobs.yaml +- path: patches/cainjection_in_cronjobs.yaml #+kubebuilder:scaffold:crdkustomizecainjectionpatch # the following config is for teaching kustomize how to do kustomization for CRDs. diff --git a/hack/docs/internal/cronjob-tutorial/generate_cronjob.go b/hack/docs/internal/cronjob-tutorial/generate_cronjob.go index 9a404a6fc2a..3eb13ea54c3 100644 --- a/hack/docs/internal/cronjob-tutorial/generate_cronjob.go +++ b/hack/docs/internal/cronjob-tutorial/generate_cronjob.go @@ -581,12 +581,12 @@ func updateKustomization(sp *Sample) { // uncomment crd/kustomization err = pluginutil.UncommentCode( filepath.Join(sp.ctx.Dir, "config/crd/kustomization.yaml"), - `#- patches/webhook_in_cronjobs.yaml`, `#`) + `#- path: patches/webhook_in_cronjobs.yaml`, `#`) CheckError("fixing crd/kustomization", err) err = pluginutil.UncommentCode( filepath.Join(sp.ctx.Dir, "config/crd/kustomization.yaml"), - `#- patches/cainjection_in_cronjobs.yaml`, `#`) + `#- path: patches/cainjection_in_cronjobs.yaml`, `#`) CheckError("fixing crd/kustomization", err) } diff --git a/pkg/plugins/common/kustomize/v2/scaffolds/internal/templates/config/crd/kustomization.go b/pkg/plugins/common/kustomize/v2/scaffolds/internal/templates/config/crd/kustomization.go index 0cdca88ad14..960ad2c5da3 100644 --- a/pkg/plugins/common/kustomize/v2/scaffolds/internal/templates/config/crd/kustomization.go +++ b/pkg/plugins/common/kustomize/v2/scaffolds/internal/templates/config/crd/kustomization.go @@ -68,9 +68,9 @@ func (f *Kustomization) GetMarkers() []machinery.Marker { const ( resourceCodeFragment = `- bases/%s_%s.yaml ` - webhookPatchCodeFragment = `#- patches/webhook_in_%s.yaml + webhookPatchCodeFragment = `#- path: patches/webhook_in_%s.yaml ` - caInjectionPatchCodeFragment = `#- patches/cainjection_in_%s.yaml + caInjectionPatchCodeFragment = `#- path: patches/cainjection_in_%s.yaml ` ) diff --git a/pkg/plugins/golang/declarative/v1/api.go b/pkg/plugins/golang/declarative/v1/api.go index ee70095da32..998f39eebc9 100644 --- a/pkg/plugins/golang/declarative/v1/api.go +++ b/pkg/plugins/golang/declarative/v1/api.go @@ -20,8 +20,6 @@ import ( "errors" "fmt" - goPluginV3 "sigs.k8s.io/kubebuilder/v3/pkg/plugins/golang/v3" - "sigs.k8s.io/kubebuilder/v3/pkg/config" "sigs.k8s.io/kubebuilder/v3/pkg/machinery" "sigs.k8s.io/kubebuilder/v3/pkg/model/resource" @@ -29,6 +27,7 @@ import ( "sigs.k8s.io/kubebuilder/v3/pkg/plugin/util" "sigs.k8s.io/kubebuilder/v3/pkg/plugins/golang/declarative/v1/scaffolds" goPluginV2 "sigs.k8s.io/kubebuilder/v3/pkg/plugins/golang/v2" + goPluginV3 "sigs.k8s.io/kubebuilder/v3/pkg/plugins/golang/v3" ) const ( diff --git a/test/e2e/v4/plugin_cluster_test.go b/test/e2e/v4/plugin_cluster_test.go index 3f7b7b4980a..65679b6a9b7 100644 --- a/test/e2e/v4/plugin_cluster_test.go +++ b/test/e2e/v4/plugin_cluster_test.go @@ -107,6 +107,14 @@ func Run(kbc *utils.TestContext) { err = kbc.Tidy() ExpectWithOffset(1, err).NotTo(HaveOccurred()) + By("run make manifests") + err = kbc.Make("manifests") + ExpectWithOffset(1, err).NotTo(HaveOccurred()) + + By("run make generate") + err = kbc.Make("generate") + ExpectWithOffset(1, err).NotTo(HaveOccurred()) + By("building the controller image") err = kbc.Make("docker-build", "IMG="+kbc.ImageName) ExpectWithOffset(1, err).NotTo(HaveOccurred()) diff --git a/testdata/project-v4-declarative-v1/config/crd/kustomization.yaml b/testdata/project-v4-declarative-v1/config/crd/kustomization.yaml index bf4c93a811c..687526d8e7c 100644 --- a/testdata/project-v4-declarative-v1/config/crd/kustomization.yaml +++ b/testdata/project-v4-declarative-v1/config/crd/kustomization.yaml @@ -10,16 +10,16 @@ resources: patches: # [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix. # patches here are for enabling the conversion webhook for each CRD -#- patches/webhook_in_captains.yaml -#- patches/webhook_in_firstmates.yaml -#- patches/webhook_in_admirals.yaml +#- path: patches/webhook_in_captains.yaml +#- path: patches/webhook_in_firstmates.yaml +#- path: patches/webhook_in_admirals.yaml #+kubebuilder:scaffold:crdkustomizewebhookpatch # [CERTMANAGER] To enable cert-manager, uncomment all the sections with [CERTMANAGER] prefix. # patches here are for enabling the CA injection for each CRD -#- patches/cainjection_in_captains.yaml -#- patches/cainjection_in_firstmates.yaml -#- patches/cainjection_in_admirals.yaml +#- path: patches/cainjection_in_captains.yaml +#- path: patches/cainjection_in_firstmates.yaml +#- path: patches/cainjection_in_admirals.yaml #+kubebuilder:scaffold:crdkustomizecainjectionpatch # the following config is for teaching kustomize how to do kustomization for CRDs. diff --git a/testdata/project-v4-multigroup/config/crd/kustomization.yaml b/testdata/project-v4-multigroup/config/crd/kustomization.yaml index 8c2e5c49499..633e725aa1a 100644 --- a/testdata/project-v4-multigroup/config/crd/kustomization.yaml +++ b/testdata/project-v4-multigroup/config/crd/kustomization.yaml @@ -17,28 +17,28 @@ resources: patches: # [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix. # patches here are for enabling the conversion webhook for each CRD -#- patches/webhook_in_captains.yaml -#- patches/webhook_in_frigates.yaml -#- patches/webhook_in_destroyers.yaml -#- patches/webhook_in_cruisers.yaml -#- patches/webhook_in_krakens.yaml -#- patches/webhook_in_leviathans.yaml -#- patches/webhook_in_healthcheckpolicies.yaml -#- patches/webhook_in_bars.yaml -#- patches/webhook_in_lakers.yaml +#- path: patches/webhook_in_captains.yaml +#- path: patches/webhook_in_frigates.yaml +#- path: patches/webhook_in_destroyers.yaml +#- path: patches/webhook_in_cruisers.yaml +#- path: patches/webhook_in_krakens.yaml +#- path: patches/webhook_in_leviathans.yaml +#- path: patches/webhook_in_healthcheckpolicies.yaml +#- path: patches/webhook_in_bars.yaml +#- path: patches/webhook_in_lakers.yaml #+kubebuilder:scaffold:crdkustomizewebhookpatch # [CERTMANAGER] To enable cert-manager, uncomment all the sections with [CERTMANAGER] prefix. # patches here are for enabling the CA injection for each CRD -#- patches/cainjection_in_captains.yaml -#- patches/cainjection_in_frigates.yaml -#- patches/cainjection_in_destroyers.yaml -#- patches/cainjection_in_cruisers.yaml -#- patches/cainjection_in_krakens.yaml -#- patches/cainjection_in_leviathans.yaml -#- patches/cainjection_in_healthcheckpolicies.yaml -#- patches/cainjection_in_bars.yaml -#- patches/cainjection_in_lakers.yaml +#- path: patches/cainjection_in_captains.yaml +#- path: patches/cainjection_in_frigates.yaml +#- path: patches/cainjection_in_destroyers.yaml +#- path: patches/cainjection_in_cruisers.yaml +#- path: patches/cainjection_in_krakens.yaml +#- path: patches/cainjection_in_leviathans.yaml +#- path: patches/cainjection_in_healthcheckpolicies.yaml +#- path: patches/cainjection_in_bars.yaml +#- path: patches/cainjection_in_lakers.yaml #+kubebuilder:scaffold:crdkustomizecainjectionpatch # the following config is for teaching kustomize how to do kustomization for CRDs. diff --git a/testdata/project-v4-with-deploy-image/config/crd/kustomization.yaml b/testdata/project-v4-with-deploy-image/config/crd/kustomization.yaml index 4d4c5a9212d..1385006e680 100644 --- a/testdata/project-v4-with-deploy-image/config/crd/kustomization.yaml +++ b/testdata/project-v4-with-deploy-image/config/crd/kustomization.yaml @@ -9,14 +9,14 @@ resources: patches: # [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix. # patches here are for enabling the conversion webhook for each CRD -#- patches/webhook_in_memcacheds.yaml -#- patches/webhook_in_busyboxes.yaml +#- path: patches/webhook_in_memcacheds.yaml +#- path: patches/webhook_in_busyboxes.yaml #+kubebuilder:scaffold:crdkustomizewebhookpatch # [CERTMANAGER] To enable cert-manager, uncomment all the sections with [CERTMANAGER] prefix. # patches here are for enabling the CA injection for each CRD -#- patches/cainjection_in_memcacheds.yaml -#- patches/cainjection_in_busyboxes.yaml +#- path: patches/cainjection_in_memcacheds.yaml +#- path: patches/cainjection_in_busyboxes.yaml #+kubebuilder:scaffold:crdkustomizecainjectionpatch # the following config is for teaching kustomize how to do kustomization for CRDs. diff --git a/testdata/project-v4/config/crd/kustomization.yaml b/testdata/project-v4/config/crd/kustomization.yaml index 75e0b8e4258..a67f99e5ea3 100644 --- a/testdata/project-v4/config/crd/kustomization.yaml +++ b/testdata/project-v4/config/crd/kustomization.yaml @@ -10,16 +10,16 @@ resources: patches: # [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix. # patches here are for enabling the conversion webhook for each CRD -#- patches/webhook_in_captains.yaml -#- patches/webhook_in_firstmates.yaml -#- patches/webhook_in_admirales.yaml +#- path: patches/webhook_in_captains.yaml +#- path: patches/webhook_in_firstmates.yaml +#- path: patches/webhook_in_admirales.yaml #+kubebuilder:scaffold:crdkustomizewebhookpatch # [CERTMANAGER] To enable cert-manager, uncomment all the sections with [CERTMANAGER] prefix. # patches here are for enabling the CA injection for each CRD -#- patches/cainjection_in_captains.yaml -#- patches/cainjection_in_firstmates.yaml -#- patches/cainjection_in_admirales.yaml +#- path: patches/cainjection_in_captains.yaml +#- path: patches/cainjection_in_firstmates.yaml +#- path: patches/cainjection_in_admirales.yaml #+kubebuilder:scaffold:crdkustomizecainjectionpatch # the following config is for teaching kustomize how to do kustomization for CRDs.