Description of problem: CRDs with preserveUnknownFields:true won't be published via OpenAPI and oc explain will not work. This is intentional. But: Nothing in the CRD status suggests that preserveUnknownFields:true is the problem. How reproducible: Create a CRD in apiextensions.k8s.io/v1beta1 - with a structural schema - but without preserveUnknownFields being set at all. The default for that field is true, and hence that CRD won't get a published schema. Actual results: `oc explain` won't show descriptions of fields. Expected results: The NonStructural condition on the CRD should show: "preserveUnknownFields must not be true".
I will work on this after finishing up my current tasks.
I might find some time in this sprint to work on this.
I am working on other high priority items. I will get to this bug next sprint.
I am occupied with other priority items. Working on this bug will be re-evaluated in next sprint.
First read Stefan's https://kubernetes.io/blog/2019/06/20/crd-structural-schema/ about structural and non-structural schema. Then create a CRD in apiextensions.k8s.io/v1beta1: - with a structural schema - but without preserveUnknownFields being set at all $ cat crd.yaml apiVersion: apiextensions.k8s.io/v1beta1 kind: CustomResourceDefinition metadata: name: testcrs.example.com spec: group: example.com names: kind: TestCR plural: testcrs scope: Namespaced validation: openAPIV3Schema: type: object description: this is description for the crd properties: spec: type: object description: this is description for spec properties: a: type: string description: this is description for field a version: v1 versions: - name: v1 served: true storage: true $ oc create -f crd.yaml Then check oc explain, indeed cannot show description of fields. Then check oc get crd testcrs.example.com -o yaml, 4.7.0-0.nightly-2020-10-15-051208 env shows condition NonStructuralSchema as below, this is expected by the PR (4.6.0-0.nightly-2020-10-14-095718 env does not show it). ... spec: ... preserveUnknownFields: true ... conditions: - lastTransitionTime: "2020-10-15T14:50:01Z" message: 'spec.preserveUnknownFields: Invalid value: true: must be false' reason: Violations status: "True" type: NonStructuralSchema
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory (Moderate: OpenShift Container Platform 4.7.0 security, bug fix, and enhancement update), and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHSA-2020:5633