Skip to content

Commit

Permalink
crd, Adding PreserveUnknownFields=false to crd spec to fix upgrade issue
Browse files Browse the repository at this point in the history
there is an issue where on upgrade of apiVersion from
apiextensions.k8s.io/v1beta1 to apiextensions.k8s.io/v1,
oc explain does not show the CR documentation.
This is solved in parallel PRs (SSP PR [1], CDI PR [2])
by adding PreserveUnknownFields=false to the CRD's spec

[1] kubevirt/kubevirt-ssp-operator@7ecd297
[2] kubevirt/containerized-data-importer#1343

Signed-off-by: Ram Lavi <[email protected]>
  • Loading branch information
RamLavi committed Oct 19, 2020
1 parent 46f3acf commit 523e9be
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions tools/manifest-templator/manifest-templator.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ func getCNA(data *templateData) {
crd := components.GetCrd()
marshallObject(crd, &writer)
crdString := writer.String()
crdString = addPreserveUnknownFields(crdString)
crdVersion := crd.Spec.Versions[0].Name

// Get CNA CR
Expand Down Expand Up @@ -224,6 +225,12 @@ func getCNA(data *templateData) {
data.CNA = &cnaData
}

func addPreserveUnknownFields(crdString string) string {
// TODO replace this solution with a better one once this issue get resolved:
// https://github.com/kubernetes/apiextensions-apiserver/issues/48
return crdString + " preserveUnknownFields: false"
}

func main() {
version := flag.String("version", "", "The csv version")
versionReplaces := flag.String("version-replaces", "", "The csv version this replaces")
Expand Down

0 comments on commit 523e9be

Please sign in to comment.