Skip to content

Commit

Permalink
Explicitly set preserveUnknownFields to false
Browse files Browse the repository at this point in the history
This is a leftover from pre `v1` lieutenant. CRDs had the API version `v1beta1` which, when converted to `v1`, set `preserveUnknownFields=true`.
Since the field was never explicitly managed it stayed on clusters that had lieutenant `< v1` installed and was false on clusters that never used a `< v1` lieutenant.

The introduction of kubebuilder defaults with the upgrade of k8s.io/api/core broke old installations since defaults are not compatible with `preserveUnknownFields=true`.

This commit explicitly sets `preserveUnknownFields` to `false` in all CRDs.

Commit changing API version: 8839a08
  • Loading branch information
bastjan committed May 30, 2024
1 parent 99ccfa2 commit a9dda7c
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions config/crd/bases/syn.tools_clusters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ spec:
listKind: ClusterList
plural: clusters
singular: cluster
preserveUnknownFields: false
scope: Namespaced
versions:
- additionalPrinterColumns:
Expand Down
1 change: 1 addition & 0 deletions config/crd/bases/syn.tools_gitrepos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ spec:
listKind: GitRepoList
plural: gitrepos
singular: gitrepo
preserveUnknownFields: false
scope: Namespaced
versions:
- additionalPrinterColumns:
Expand Down
1 change: 1 addition & 0 deletions config/crd/bases/syn.tools_tenants.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ spec:
listKind: TenantList
plural: tenants
singular: tenant
preserveUnknownFields: false
scope: Namespaced
versions:
- additionalPrinterColumns:
Expand Down
1 change: 1 addition & 0 deletions config/crd/bases/syn.tools_tenanttemplates.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ spec:
listKind: TenantTemplateList
plural: tenanttemplates
singular: tenanttemplate
preserveUnknownFields: false
scope: Namespaced
versions:
- additionalPrinterColumns:
Expand Down
2 changes: 1 addition & 1 deletion generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
package main

//go:generate go run sigs.k8s.io/controller-tools/cmd/controller-gen object:headerFile="hack/boilerplate.go.txt" paths="./..."
//go:generate go run sigs.k8s.io/controller-tools/cmd/controller-gen rbac:roleName=manager-role webhook paths="./..." output:crd:artifacts:config=${CRD_ROOT_DIR}/bases crd:crdVersions=v1
//go:generate go run sigs.k8s.io/controller-tools/cmd/controller-gen rbac:roleName=manager-role webhook paths="./..." output:crd:artifacts:config=${CRD_ROOT_DIR}/bases crd:crdVersions=v1,deprecatedV1beta1CompatibilityPreserveUnknownFields=false

// Generate API reference documentation
//go:generate go run github.com/elastic/crd-ref-docs --source-path=api/v1alpha1 --config=docs/api-gen-config.yaml --renderer=asciidoctor --templates-dir=docs/api-templates --output-path=${CRD_DOCS_REF_PATH}

0 comments on commit a9dda7c

Please sign in to comment.