Bug 1754640

Summary: CRD schema generator doesn't produce resources with structural schema
Product: OpenShift Container Platform Reporter: Lukasz Szaszkiewicz <lszaszki>
Component: UnknownAssignee: Sudha Ponnaganti <sponnaga>
Status: CLOSED ERRATA QA Contact: Johnny Liu <jialiu>
Severity: high Docs Contact:
Priority: unspecified    
Version: 4.3.zCC: adahiya, adam.kaplan, aos-bugs, calfonso, eparis, jmencak, jokerman, maszulik, mdame, sttts, wzheng, xiuwang
Target Milestone: ---Flags: mdame: needinfo? (sttts)
Target Release: 4.3.0   
Hardware: Unspecified   
OS: Unspecified   
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-01-23 11:06:54 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Lukasz Szaszkiewicz 2019-09-23 19:22:17 UTC
Since Kubernetes 1.16+ doesn't publish OpenAPI for non-structural custom resource definitions and tools like oc explain returns an empty result we should update our CRDs generators to produce schemas that are structural.

Comment 1 Lukasz Szaszkiewicz 2019-09-24 08:03:19 UTC
Once this issue is fixed please enable the integration tests that make use of OpenAPI schema - https://github.com/openshift/origin/commit/befc02022de04a47bfef81d7955ff5b98600485a

Comment 4 XiuJuan Wang 2019-10-15 08:41:15 UTC
https://github.com/openshift/api/pull/443 is not merged in 4.3.0-0.nightly-2019-10-15-020113 yet which blocked this bug verifying.

$ oc version 
Client Version: openshift-clients-4.3.0-201910141917
Server Version: 4.3.0-0.nightly-2019-10-15-020113
Kubernetes Version: v1.16.0-beta.2+a6ff814

$ oc explain configs --api-version=samples.operator.openshift.io/v1  
KIND:     Config
VERSION:  samples.operator.openshift.io/v1


Comment 5 Mike Dame 2019-10-21 18:59:26 UTC
Updates on this:

The config manifests were moved to openshift/api in https://github.com/openshift/api/pull/470
Those were then enabled in cluster-config-operator in https://github.com/openshift/cluster-config-operator/pull/102. At this point the description for those should have come back but testing manually they still are not there, so need to check if we need something else:

$ oc version
Client Version: version.Info{Major:"4", Minor:"1+", GitVersion:"v4.1.0+be7ae76-1352", GitCommit:"be7ae76246", GitTreeState:"clean", BuildDate:"2019-08-27T21:41:57Z", GoVersion:"go1.12.9", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"16+", GitVersion:"v1.16.0-beta.2+d6da963", GitCommit:"d6da963", GitTreeState:"clean", BuildDate:"2019-10-20T20:15:30Z", GoVersion:"go1.12.5", Compiler:"gc", Platform:"linux/amd64"}
OpenShift Version: 4.3.0-0.ci-2019-10-21-085330

$ oc explain configs --api-version=samples.operator.openshift.io/v1
KIND:     Config
VERSION:  samples.operator.openshift.io/v1


We are also migrating all of the operator manifests (https://github.com/openshift/api/pull/475), which will need similar updates to their repos

Comment 9 Maciej Szulik 2019-11-05 11:42:56 UTC
With https://github.com/openshift/cluster-config-operator/pull/106 I think we can close this now, separate operators will get their own bugs. 

IMPORTANT for QA team, when you spot a resource that does not have proper oc explain output, please open a bug against a specific operator.

In https://github.com/openshift/origin/pull/23935 we have brought back the explain test but there are still some leftovers, we'll be addressing
these as we go and I'll make sure to open bugs for the missing bits. So please double check if a bug doesn't exist, before opening a new one.

Comment 11 jmencak 2019-11-06 19:44:03 UTC
(In reply to Maciej Szulik from comment #9)
> With https://github.com/openshift/cluster-config-operator/pull/106 I think
> we can close this now, separate operators will get their own bugs. 

Maciej, does this mean that "preserveUnknownFields: false" is now required in order for 
the "oc explain RESOURCE" to work properly?  How about recursiveness in the API that rules
out "preserveUnknownFields: false"?
Please see: https://github.com/openshift/cluster-node-tuning-operator/blob/master/manifests/02-crd.yaml#L24

Comment 12 Maciej Szulik 2019-11-06 20:02:24 UTC
Jiri yes preserveUnknownFields is required at the global level, but for the particular fields where you need to 
exclude them use // +kubebuilder:pruning:PreserveUnknownFields
like in https://github.com/openshift/api/pull/505/commits/de0cf99e4f4f1c38153a61d48757bd86c9309c09

Comment 13 XiuJuan Wang 2019-11-07 06:06:04 UTC
Since `oc explain` in https://github.com/openshift/origin/pull/24058 has passed, see https://prow.svc.ci.openshift.org/view/gcs/origin-ci-test/logs/release-openshift-ocp-installer-e2e-azure-4.3/332 (4.3.0-0.nightly-2019-11-07-010532 payload)
And QA teams report issued crds under own component, then mark this bug as verified.

Comment 15 errata-xmlrpc 2020-01-23 11:06:54 UTC
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, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.