When adding the patches for webhooks/cert manager, the subresources field for the CRD is empty and missing the status field.
Steps to reproduce:
$ kubebuilder init --domain robherley.xyz --repo github.com/robherley/example
$ kubebuilder create api --group=example --version=v1alpha1 --kind=Foobar
<added subresource marker to _types file>
$ make manifests
$ kustomize build config/default | grep subresources -C 1
scope: Namespaced
subresources:
status: {}
<uncommented the patches in config/crd/kustomization.yaml>
$ kustomize build config/default | grep subresources -A 1
scope: Namespaced
subresources: {}
validation:
kubebuilder version) and scaffolding version (check your PROJECT file)go.mod file)kubectl version against your API server)/kind bug
Hi @robherley,
Could you please check it with the master branch and the v3-alpha plugin?
E.g:
kubebuilder init --plugins=go/v3-alpha --domain=tutorial.kubebuilder.io --project-version=3-alpha --repo=tutorial.kubebuilder.io/project --license apache2 --owner "The Kubernetes authors"
Let's see it is not solved with the latest version and plugin. Also, if not could you please clarify what is the value scaffolded as you did and what is the value expected by you?
Here's the steps I followed for the master branch (3c4eb4f9):
$ kubebuilder init --plugins=go/v3-alpha --domain=tutorial.kubebuilder.io --project-version=3-alpha --repo=tutorial.kubebuilder.io/project --license apache2 --owner "The Kubernetes authors"
$ kubebuilder create api --group=example --version=v1alpha1 --kind=Foobar
$ make manifests
$ kustomize build config/default > before_patch.yaml
That yaml has the correct spec.subresources.status for the CustomResourceDefinition:
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
...
spec:
...
subresources:
status: {} # this is correct
...
But if I uncomment the patches for the webhooks in config/crd/kustomization:
patchesStrategicMerge:
- patches/webhook_in_foobars.yaml
- patches/cainjection_in_foobars.yaml
And regenerate the manifests:
$ make manifests
$ kustomize build config/default > after_patch.yaml
It's missing the status subresource:
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
...
spec:
...
subresources: {} # missing status
...
I've attached before_patch.yaml and after_patch.yaml: generated.zip
This might be related: https://github.com/kubernetes-sigs/kubebuilder/issues/1655
Hi @robherley,
Are you using the kustomize version defined in the Makefile or other version? If yes, we might be able to close this one with #1735? Could you help on the review of the PR? Also, we have an issue to upgrade the kustomize version and fix its issues see https://github.com/kubernetes-sigs/kubebuilder/issues/1657. Would you like to help on it?
Hi @camilamacedo86, I just ran my tests again with the latest commit on master (36124ae) and used the kustomize version specified in the Makefile (v3.5.4) and it generates the correct output. I'll close this issue and I can take a look at #1657. Thanks!