Bug 1792054

Summary: MachineHealthChecks have no schema properties in console
Product: OpenShift Container Platform Reporter: Clayton Coleman <ccoleman>
Component: Cloud ComputeAssignee: Joel Speed <jspeed>
Status: CLOSED DUPLICATE QA Contact: Jianwei Hou <jhou>
Severity: high Docs Contact:
Priority: unspecified    
Version: 4.4CC: agarcial, xtian
Target Milestone: ---   
Target Release: 4.4.0   
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: 2020-01-23 10:07:36 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:
Embargoed:

Description Clayton Coleman 2020-01-16 22:53:24 UTC
$ oc explain machinehealthcheck
KIND:     MachineHealthCheck
VERSION:  machine.openshift.io/v1beta1

DESCRIPTION:
     <empty>


Machine health checks should have a full schema, description, etc.

High because no user can use MHC if they can't see what fields to set.  If this is a bug in 4.3 needs to be back ported.

Comment 1 Joel Speed 2020-01-17 14:41:22 UTC
To get a description with `oc explain`, CRDs need to have a structural schema.

> (source https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/#publish-validation-schema-in-openapi-v2 "... CustomResourceDefinition OpenAPI v3 validation schemas which are structural and enable pruning ... are published as part of the OpenAPI v2 spec from Kubernetes API server. kubectl consumes the published schema to perform .. schema explanation (kubectl explain) on custom resources."

Currently, MachineHealthCheck CRDs are not structural because they include the type `IntOrString` which does not have a concrete type in the OpenAPI schema definition (https://github.com/openshift/machine-api-operator/blob/a3345f5a437a8ca82be683c7c38fe49de64c2b5f/pkg/apis/machine/v1beta1/machinehealthcheck_types.go#L57)

The CRD definition is currently generated by the CRD generator tool from controller runtime, which, recently had a bug fix (https://github.com/kubernetes-sigs/controller-tools/pull/360) which adds an annotation to the generated CRD, `x-kubernetes-int-or-string`, which allows the `IntOrString` type to be used and the OpenAPI definition to be considered structural.

To fix this issue, we need to update the controller-runtime dependency in the machine-api-operator repository to include this bug fix and regenerate the CRD.

There is a ticket in our next sprint for addressing this https://issues.redhat.com/browse/OCPCLOUD-693

Comment 2 Clayton Coleman 2020-01-17 16:41:50 UTC
https://github.com/openshift/origin/pull/24412 will start enforcing this, I will open follow up bugs for any others.

Comment 3 Clayton Coleman 2020-01-17 16:42:29 UTC
Note the part about this needs to be backported, so if you have to bump the dependency you may have to take that into account in how you implement.

Comment 4 Alberto 2020-01-23 10:07:36 UTC

*** This bug has been marked as a duplicate of bug 1769004 ***