Skip to content

From SDK 1.17.0 release CRD using v1beta1 requires preserveUnknownFields: false to pass in the validations #5688

@camilamacedo86

Description

@camilamacedo86

Bug Report

From SDK 1.17.0 release CRD using v1beta1 requires preserveUnknownFields: false to pass in the validations
We need to understand why.

  • Is some dependence that was added to the operator-framework/api?
  • Should the preserveUnknownFields: false been set before and the checks were not raising the error?
  • Should we really fail in this scenario where the preserveUnknownFields: false is not set?

What did you do?

Following the steps to reproduce the issue.

  1. Create the mock project with v1beta1 and a bundle for it: ( you can use the master branch or the latest release 1.19.0 )
$ mkdir test
$ cd test
$ go mod init test
go: creating new go.mod: module test

$ operator-sdk init
$ operator-sdk create api --group crew --version v1 --kind Admiral --controller=true --resource=true --namespaced=false --make=false --crd-version=v1beta1
$ go mod tidy

$ make bundle
…
operator-sdk bundle validate ./bundle
INFO[0000] All validation tests have completed successfully
  1. Now, edit the CRD to remove the attributed requires preserveUnknownFields: false

$ vim bundle/manifests/crew.my.domain_admirals.yaml

  1. Run bundle validate again:
$ operator-sdk bundle validate ./bundle --select-optional suite=operatorframework 
ERRO[0000] Error: Field spec.preserveUnknownFields, Value 0xc000c31ac0: spec.preserveUnknownFields: Invalid value: true: cannot set to true, set x-preserve-unknown-fields to true in spec.versions[*].schema instead 

See that the error spec.preserveUnknownFields: Invalid value: true: cannot set to true, set x-preserve-unknown-fields to true in spec.versions[*].schema instead will be raised.

  1. Now, do the same check using SDK 1.16.0:
$ git fetch --all --tags
$ git checkout tags/v1.16.0 -b v1.16.0
$ make install 
$ operator-sdk version 

You will see that the error spec.preserveUnknownFields: Invalid value: true: cannot set to true, set x-preserve-unknown-fields to true in spec.versions[*].schema instead is NOT raised.

What did you expect to see?

What did you see instead? Under which circumstances?

Environment

Operator type:

Kubernetes cluster type:

$ operator-sdk version

$ go version (if language is Go)

$ kubectl version

Possible Solution

Additional context

Metadata

Metadata

Assignees

Labels

area/dependencyIssues or PRs related to dependency changes

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions