Bug 1792054 - MachineHealthChecks have no schema properties in console
Summary: MachineHealthChecks have no schema properties in console
Keywords:
Status: CLOSED DUPLICATE of bug 1769004
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: Cloud Compute
Version: 4.4
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: ---
: 4.4.0
Assignee: Joel Speed
QA Contact: Jianwei Hou
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-01-16 22:53 UTC by Clayton Coleman
Modified: 2020-01-23 10:07 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-01-23 10:07:36 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

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 ***


Note You need to log in before you can comment on or make changes to this bug.