Bug 1777553 - Client side validation fails on required nullable field with null value
Summary: Client side validation fails on required nullable field with null value
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: oc
Version: 4.3.0
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: ---
: 4.4.0
Assignee: Maciej Szulik
QA Contact: zhou ying
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-11-27 19:43 UTC by Stefan Schimanski
Modified: 2020-05-04 11:18 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: No Doc Update
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-05-04 11:17:52 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2020:0581 0 None None None 2020-05-04 11:18:13 UTC

Description Stefan Schimanski 2019-11-27 19:43:01 UTC
When doing `kubectl edit clusterversions` with an upstream kubectl (or enabled client side validation in oc), one gets:

# Please edit the object below. Lines beginning with a '#' will be ignored,
# and an empty file will abort the edit. If an error occurs while saving this file will be
# reopened with the relevant failures.
#
# clusterversions.config.openshift.io "version" was not valid:
# * : Invalid value: "The edited file failed validation": ValidationError(ClusterVersion.status): missing required field "availableUpdates" in io.openshift.config.v1.ClusterVersion.status
#
apiVersion: config.openshift.io/v1
kind: ClusterVersion
metadata:
  creationTimestamp: "2019-11-27T17:35:03Z"
  generation: 4
  name: version
  resourceVersion: "47107"
  selfLink: /apis/config.openshift.io/v1/clusterversions/version
  uid: 21a49c2c-e43d-4fcc-8af1-363222577b1a
spec:
  channel: stable-4.3
  clusterID: d7300062-09bc-4250-ab0a-777d2970cc3c
  overrides:
  - group: apps/v1
    kind: Deployment
    name: openshift-kube-apiserver-operator
    namespace: kube-apiserver-operator
    unmanaged: true
  upstream: https://api.openshift.com/api/upgrades_info/v1/graph
status:
  availableUpdates: null
  conditions:
  - lastTransitionTime: "2019-11-27T17:53:30Z"
    message: Done applying 0.0.1-2019-11-27-172000
    status: "True"
    type: Available
  ...

Comment 1 Stefan Schimanski 2019-11-27 19:45:57 UTC
Compare https://github.com/openshift/api/blob/master/config/v1/0000_00_cluster-version-operator_01_clusterversion.crd.yaml#L153.

To work around, publishing has to strip nullable fields from the `required` slice, such that client-side validation does not break.

Comment 5 zhou ying 2020-02-14 06:05:52 UTC
Can't reproduce the issue now:

[root@dhcp-140-138 oc]# oc version -o yaml
clientVersion:
  buildDate: "2020-02-13T22:50:14Z"
  compiler: gc
  gitCommit: 5d7a12f03389b03b651f963cb5ee8ddfa9cff559
  gitTreeState: clean
  gitVersion: v4.4.0
  goVersion: go1.13.4
  major: ""
  minor: ""
  platform: linux/amd64


oc edit clusterversion --validate=true
# Please edit the object below. Lines beginning with a '#' will be ignored,
# and an empty file will abort the edit. If an error occurs while saving this file will be
# reopened with the relevant failures.
#
apiVersion: config.openshift.io/v1
kind: ClusterVersion
metadata:
  creationTimestamp: "2020-02-14T01:21:18Z"
  generation: 1
  name: version
  resourceVersion: "74494"
  selfLink: /apis/config.openshift.io/v1/clusterversions/version
  uid: 82619ef2-69ad-4fb9-9361-db07f0613e9f
spec:
  channel: stable-4.4
  clusterID: b5a607cf-8869-43c3-b1e2-d45ef51c5170
  upstream: https://api.openshift.com/api/upgrades_info/v1/graph
status:
  availableUpdates: null
  conditions:
  - lastTransitionTime: "2020-02-14T01:46:28Z"
    message: Done applying 4.4.0-0.nightly-2020-02-13-185851
    status: "True"
    type: Available
  - lastTransitionTime: "2020-02-14T01:32:43Z"
"/tmp/oc-edit-vhosr.yaml" 50L, 1903C

Comment 7 errata-xmlrpc 2020-05-04 11:17:52 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.

https://access.redhat.com/errata/RHBA-2020:0581


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