[mhc] Error message not proper cluster version - 4.6.0-0.nightly-2020-08-04-002217 steps: 1.Create a mhc with below yaml apiVersion: machine.openshift.io/v1beta1 kind: MachineHealthCheck metadata: creationTimestamp: "2020-02-14T09:47:08Z" generation: 1 name: mhc2 namespace: openshift-machine-api nodeStartupTimeout: 12m spec: selector: {} maxUnhealthy: 2 unhealthyConditions: - status: "False" timeout: 3 type: Ready 2. run oc create -f <mhc.yaml> [miyadav@miyadav debug]$ oc create -f mhc.yaml Actual: The MachineHealthCheck "mhc2" is invalid: spec.unhealthyConditions.timeout: Invalid value: "integer": spec.unhealthyConditions.timeout in body must be of type string: "integer" Expected : The MachineHealthCheck "mhc2" is invalid: spec.unhealthyConditions.timeout: Invalid value: "": spec.unhealthyConditions.timeout in body should match '^([0-9]+(\.[0-9]+)?(ns|us|µs|ms|s|m|h)*)+$' Additional info: As the error message says invalid value "integer" , ...must be of type.. "integer" It might be confusing . Expected message I mentioned , can be reviewed for giving more info on what is exactly wrong in timeout value used in yaml
I don't think there is any way to force the validation to recognise the int as a string and produce the better error message. We may not be able to resolve this. I will do some research into this,
I asked in slack and I don't think we can resolve this issue, a type error will always trump a formatting error https://kubernetes.slack.com/archives/C0EG7JC6T/p1596554610279700
Hi @joel , Here is the error we get when using "3" in quotes , so as you suggested providing those details here - E0804 10:57:22.394358 1 reflector.go:178] sigs.k8s.io/controller-runtime/pkg/cache/internal/informers_map.go:224: Failed to list *v1beta1.MachineHealthCheck: v1beta1.MachineHealthCheckList.ListMeta: v1.ListMeta.TypeMeta: Kind: Items: []v1beta1.MachineHealthCheck: v1beta1.MachineHealthCheck.Spec: v1beta1.MachineHealthCheckSpec.UnhealthyConditions: []v1beta1.UnhealthyCondition: v1beta1.UnhealthyCondition.Type: Timeout: unmarshalerDecoder: time: missing unit in duration 3, error found in #10 byte of ...|meout":"3","type":"R|..., bigger context ...|ealthyConditions":[ {"status":"False","timeout":"3","type":"Ready"} So we can modify the bug to handle this issue of storing the value which shouldnt happen instead of error message.. Let me know if you have any comments on this ..
I don't mind which we do. The issue of storing the integer cannot be resolved as per the discussion I had in slack. I have a fix open for the format to require units already, if you update the description of the bug we can use this. Alternatively we close this as cantfix and create a new bug for the missing formats, wdyt?
Updated the description as per comment #4
VERIFIED ON - Cluster version is 4.6.0-0.nightly-2020-08-07-202945 Steps: 1.Create a mhc below yaml apiVersion: machine.openshift.io/v1beta1 kind: MachineHealthCheck metadata: creationTimestamp: "2020-02-14T09:47:08Z" generation: 1 name: mhc1 namespace: openshift-machine-api nodeStartupTimeout: 12m spec: selector: {} maxUnhealthy: 2 unhealthyConditions: - status: "False" timeout: "3" type: Ready ~ Expected and Actual : [miyadav@miyadav debug]$ oc create -f mhc.yaml --config awskube The MachineHealthCheck "mhc1" is invalid: spec.unhealthyConditions.timeout: Invalid value: "": spec.unhealthyConditions.timeout in body should match '^([0-9]+(\.[0-9]+)?(ns|us|µs|ms|s|m|h))+$' 2.Repeat with timeout as "3h" and 3h Expected and actual : mhc created successfully
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 (OpenShift Container Platform 4.6 GA Images), 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/RHBA-2020:4196