Description of problem: It seems that we have some yaml indent issue on node maintenance CRD so almost everything is defined under spec.validation.openAPIV3Schema: [stirabos@crc ~]$ oc get -o yaml crd nodemaintenances.kubevirt.io apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: creationTimestamp: "2020-03-25T09:22:57Z" generation: 1 name: nodemaintenances.kubevirt.io resourceVersion: "302560" selfLink: /apis/apiextensions.k8s.io/v1/customresourcedefinitions/nodemaintenances.kubevirt.io uid: 1e7046f4-602b-477c-8a07-68fc336babd8 spec: conversion: strategy: None group: kubevirt.io names: kind: NodeMaintenance listKind: NodeMaintenanceList plural: nodemaintenances singular: nodemaintenance preserveUnknownFields: true scope: Cluster versions: - name: v1alpha1 schema: openAPIV3Schema: properties: apiVersion: description: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources' type: string kind: description: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds' type: string metadata: type: object spec: properties: nodeName: description: Node name to apply maintanance on/off type: string reason: description: Reason for maintanance type: string required: - nodeName type: object status: properties: evictionPods: description: EvictionPods is the total number of pods up for eviction from the start format: int64 type: integer lastError: description: LastError represents the latest error if any in the latest reconciliation type: string pendingPods: description: PendingPods is a list of pending pods for eviction items: type: string type: array phase: description: Phase is the represtation of the maintenanace progress (Running,Succeeded) type: string totalpods: description: TotalPods is the total number of all pods on the node from the start format: int64 type: integer type: object served: true storage: true subresources: status: {} status: acceptedNames: kind: NodeMaintenance listKind: NodeMaintenanceList plural: nodemaintenances singular: nodemaintenance conditions: - lastTransitionTime: "2020-03-25T09:22:57Z" message: 'spec.validation.openAPIV3Schema.type: Required value: must not be empty at the root' reason: Violations status: "True" type: NonStructuralSchema - lastTransitionTime: "2020-03-25T09:22:57Z" message: no conflicts found reason: NoConflicts status: "True" type: NamesAccepted - lastTransitionTime: "2020-03-25T09:22:57Z" message: the initial names have been accepted reason: InitialNamesAccepted status: "True" type: Established storedVersions: - v1alpha1 Version-Release number of selected component (if applicable): 2.3.0 How reproducible: 100% Steps to Reproduce: 1. oc get -o yaml crd nodemaintenances.kubevirt.io 2. 3. Actual results: - lastTransitionTime: "2020-03-25T09:22:57Z" message: 'spec.validation.openAPIV3Schema.type: Required value: must not be empty at the root' reason: Violations status: "True" type: NonStructuralSchema Expected results: no openAPIV3Schema violations Additional info: it's reproducible also on CNV 2.2.0
It refers to https://github.com/kubernetes/enhancements/blob/master/keps/sig-api-machinery/20190425-structural-openapi.md probably it's simpler than I thought, but we still have something wrong (probably in the CRD validation criteria) that causes it to be declared as NonStructuralSchema
NMO is delivered via CNV but all the engineering is happening in the telco/management team. I will assign to Michael Moser once he creates an account here.
I'd suspect that the issue is just a missing `type: object` on the whole openAPIV3Schema: https://github.com/kubevirt/node-maintenance-operator/blob/master/deploy/crds/nodemaintenance_crd.yaml#L16 but it comes from https://github.com/kubevirt/node-maintenance-operator/blob/master/pkg/apis/kubevirt/v1alpha1/zz_generated.openapi.go which was generated with openapi-gen
I have submitted a PR to solve this issue; it is pending review for quite some time. https://github.com/kubevirt/node-maintenance-operator/pull/70 - right now all comments have been addressed so that I don't know if there is a problem to merge it right now.
Thanks Michael, I didn't know there was a PR for this bug. could you please update this BZ when the PR is merged?
The PR that is to solve the issue got merged now. https://github.com/kubevirt/node-maintenance-operator/pull/70
Verified on CNV-2.4.0, OCP: 4.5.0-rc.2, SSP build 58: There are no validation errors: $ oc get crd -n openshift-cnv nodemaintenances.nodemaintenance.kubevirt.io -oyaml apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: creationTimestamp: "2020-06-24T16:14:31Z" generation: 1 managedFields: - apiVersion: apiextensions.k8s.io/v1beta1 fieldsType: FieldsV1 fieldsV1: f:spec: f:conversion: .: {} f:strategy: {} f:group: {} f:names: f:kind: {} f:listKind: {} f:plural: {} f:singular: {} f:preserveUnknownFields: {} f:scope: {} f:subresources: .: {} f:status: {} f:validation: .: {} f:openAPIV3Schema: .: {} f:properties: .: {} f:apiVersion: .: {} f:description: {} f:type: {} f:kind: .: {} f:description: {} f:type: {} f:metadata: .: {} f:type: {} f:spec: .: {} f:properties: .: {} f:nodeName: .: {} f:description: {} f:type: {} f:reason: .: {} f:description: {} f:type: {} f:required: {} f:type: {} f:status: .: {} f:properties: .: {} f:evictionPods: .: {} f:description: {} f:format: {} f:type: {} f:lastError: .: {} f:description: {} f:type: {} f:pendingPods: .: {} f:description: {} f:items: {} f:type: {} f:phase: .: {} f:description: {} f:type: {} f:totalpods: .: {} f:description: {} f:format: {} f:type: {} f:type: {} f:type: {} f:version: {} f:versions: {} f:status: f:storedVersions: {} manager: catalog operation: Update time: "2020-06-24T16:14:31Z" - apiVersion: apiextensions.k8s.io/v1 fieldsType: FieldsV1 fieldsV1: f:status: f:acceptedNames: f:kind: {} f:listKind: {} f:plural: {} f:singular: {} f:conditions: {} manager: kube-apiserver operation: Update time: "2020-06-24T16:14:31Z" name: nodemaintenances.nodemaintenance.kubevirt.io resourceVersion: "39037" selfLink: /apis/apiextensions.k8s.io/v1/customresourcedefinitions/nodemaintenances.nodemaintenance.kubevirt.io uid: 3d7e36dc-6fbe-413c-8449-ed19acb785ac spec: conversion: strategy: None group: nodemaintenance.kubevirt.io names: kind: NodeMaintenance listKind: NodeMaintenanceList plural: nodemaintenances singular: nodemaintenance preserveUnknownFields: true scope: Cluster versions: - name: v1beta1 schema: openAPIV3Schema: properties: apiVersion: description: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources' type: string kind: description: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds' type: string metadata: type: object spec: properties: nodeName: description: Node name to apply maintanance on/off type: string reason: description: Reason for maintanance type: string required: - nodeName type: object status: properties: evictionPods: description: EvictionPods is the total number of pods up for eviction from the start format: int64 type: integer lastError: description: LastError represents the latest error if any in the latest reconciliation type: string pendingPods: description: PendingPods is a list of pending pods for eviction items: type: string type: array phase: description: Phase is the represtation of the maintenanace progress (Running,Succeeded) type: string totalpods: description: TotalPods is the total number of all pods on the node from the start format: int64 type: integer type: object type: object served: true storage: true subresources: status: {} status: acceptedNames: kind: NodeMaintenance listKind: NodeMaintenanceList plural: nodemaintenances singular: nodemaintenance conditions: - lastTransitionTime: "2020-06-24T16:14:31Z" message: no conflicts found reason: NoConflicts status: "True" type: NamesAccepted - lastTransitionTime: "2020-06-24T16:14:31Z" message: the initial names have been accepted reason: InitialNamesAccepted status: "True" type: Established storedVersions: - v1beta1
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. https://access.redhat.com/errata/RHSA-2020:3194