Closed
Description
crdVersions=v1
which is the new default, doesn't work in conjunction with preserveUnknownFields=false
. The spec.preserveUnknownFields
simply doesn't appear in the crd. There is an integration test for v1beta1
, but not for v1
.
I'm running the following command in a kubebuilder repo:
controller-gen "crd:preserveUnknownFields=false,crdVersions=v1" rbac:roleName=manager-role webhook paths="./..." output:crd:artifacts:config=config/crd/bases
I'm using defaults in my schema and if applying to a 1.16.13-gke.1
cluster, I get:
The CustomResourceDefinition "foo.example.com" is invalid: spec.preserveUnknownFields: Invalid value: true: must be false in order to use defaults in the schema
If I add spec.preserveUnknownFields manually to the crd it works
My workaround in the makefile right now is
yq w -i config/crd/bases/cluster.paas.getcruise.com_clusters.yaml spec.preserveUnknownFields false