Bug 1885620

Summary: CRDs with preserveUnknownFields:true don't reflect in status that they are non-structural
Product: OpenShift Container Platform Reporter: OpenShift BugZilla Robot <openshift-bugzilla-robot>
Component: kube-apiserverAssignee: Stefan Schimanski <sttts>
Status: CLOSED CURRENTRELEASE QA Contact: Ke Wang <kewang>
Severity: low Docs Contact:
Priority: low    
Version: 4.5CC: aos-bugs, erich, mfojtik, xxia
Target Milestone: ---   
Target Release: 4.6.z   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-01-12 09:34:12 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1848358    
Bug Blocks:    

Comment 2 Ke Wang 2020-10-29 11:11:20 UTC
First read Stefan's https://kubernetes.io/blog/2019/06/20/crd-structural-schema/ about structural and non-structural schema.

This bug's PR is dev-approved and not yet merged, so I'm following issue DPTP-660 to do the pre-merge verifying for QE pre-merge verification goal of issue OCPQE-815 by using the bot to launch one 4.6 cluster with the open PR. after the cluster is ready, did the following verification steps:

To 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.6.0-0.ci.test-2020-10-29-093230-ci-ln-hw6j6fb 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-29T10:52:41Z"
  message: 'spec.preserveUnknownFields: Invalid value: true: must be false'
  reason: Violations
  status: "True"
  type: NonStructuralSchema

So the bug is pre-merge verified. After the PR gets merged, the bug will be moved to VERIFIED by the bot automatically or, if not working, by me manually.

Comment 4 Stefan Schimanski 2021-01-12 09:34:12 UTC
This will be solved in 4.7. We won't backport it due to complexity and capacity. Severity is low.