Bug 1901531 - Console returns a blank page while trying to create an operator Custom CR with Invalid Schema
Summary: Console returns a blank page while trying to create an operator Custom CR wit...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: Management Console
Version: 4.6
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: ---
: 4.7.0
Assignee: Jon Jackson
QA Contact: Yadan Pei
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-11-25 14:25 UTC by Akram Ben Aissi
Modified: 2021-02-24 15:36 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Cause: react-jsonschema-form did not gracefully handle array type schemas that are explicitly set to null. Consequence: A runtime exception would occur if the form data passed to the DynamicForm component contained an array type property set to null. Fix: Added a null check in array fields to catch potential exceptions. Result: An exception is no longer thrown in this scenario.
Clone Of:
Environment:
Last Closed: 2021-02-24 15:35:50 UTC
Target Upstream Version:
Embargoed:
jonjacks: needinfo+


Attachments (Terms of Use)
HAR generated while reproducing the bug (1.65 MB, text/plain)
2020-11-25 14:35 UTC, Robb Hamilton
no flags Details
CSV which reproduced the bug (6.42 KB, text/plain)
2020-12-14 14:31 UTC, Jon Jackson
no flags Details
CRD (148.55 KB, text/plain)
2020-12-14 14:31 UTC, Jon Jackson
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Github openshift console pull 7397 0 None closed Bug 1901531: Fix runtime error in create CR form 2021-02-18 20:19:33 UTC
Red Hat Product Errata RHSA-2020:5633 0 None None None 2021-02-24 15:36:19 UTC

Description Akram Ben Aissi 2020-11-25 14:25:17 UTC
Description of problem:

After installing our Operator (Jenkins one) and trying to create a CR, we face a blank page.

Comment 1 Robb Hamilton 2020-11-25 14:35:15 UTC
Created attachment 1733340 [details]
HAR generated while reproducing the bug

Comment 2 Robb Hamilton 2020-11-30 13:03:44 UTC
*** Bug 1901204 has been marked as a duplicate of this bug. ***

Comment 3 Jon Jackson 2020-11-30 19:04:40 UTC
Please provide specific, reproducible steps that led to this bug. What specific operator was installed? Which CR provided by that operator has a blank creation page? Are there any errors logged in the dev tools console? If the operator in question is not provided by the default cluster CatalogSources, please provide an image URL or a link to the source code for the CatalogSource that does provide this operator.

Comment 5 Yadan Pei 2020-12-07 09:09:46 UTC
Hi Jon,

I installed 'Couchbase Operator' and tries to create CouchbaseCluster via Form, Servers.Pod.Resource Requirements are not editable 

Is this issue caused by the fix? 


# oc get csv couchbase-operator.v1.2.2 -n default -o json | jq '.spec.customresourcedefinitions.owned[0].specDescriptors'
[
  {
    "description": "The name of the secret object that stores the admin credentials.",
    "displayName": "Auth Secret",
    "path": "authSecret",
    "x-descriptors": [
      "urn:alm:descriptor:io.kubernetes:Secret"
    ]
  },
  {
    "description": "The name of the secret object that stores the server's TLS certificate.",
    "displayName": "Server TLS Secret",
    "path": "tls.static.member.serverSecret",
    "x-descriptors": [
      "urn:alm:descriptor:io.kubernetes:Secret"
    ]
  },
  {
    "description": "The name of the secret object that stores the Operator's TLS certificate.",
    "displayName": "Operator TLS Secret",
    "path": "tls.static.operatorSecret",
    "x-descriptors": [
      "urn:alm:descriptor:io.kubernetes:Secret"
    ]
  },
  {
    "description": "Specifies if the Operator will manage this cluster.",
    "displayName": "Paused",
    "path": "paused",
    "x-descriptors": [
      "urn:alm:descriptor:com.tectonic.ui:booleanSwitch"
    ]
  },
  {
    "description": "Specifies if the Couchbase Server Web Console will be exposed externally.",
    "displayName": "Expose Console",
    "path": "exposeAdminConsole",
    "x-descriptors": [
      "urn:alm:descriptor:com.tectonic.ui:booleanSwitch"
    ]
  },
  {
    "description": "Specifies whether or not two pods in this cluster can be deployed on the same Kubernetes node.",
    "displayName": "Anti Affinity",
    "path": "antiAffinity",
    "x-descriptors": [
      "urn:alm:descriptor:com.tectonic.ui:booleanSwitch"
    ]
  },
  {
    "description": "Specifies if update notifications will be displayed in the Couchbase UI.",
    "displayName": "Show Update Notifications",
    "path": "softwareUpdateNotifications",
    "x-descriptors": [
      "urn:alm:descriptor:com.tectonic.ui:booleanSwitch"
    ]
  },
  {
    "description": "Specifies if the Operator will create or delete buckets.",
    "displayName": "Disable Bucket Management",
    "path": "disableBucketManagement",
    "x-descriptors": [
      "urn:alm:descriptor:com.tectonic.ui:booleanSwitch"
    ]
  },
  {
    "description": "The desired number of member Pods for the Couchbase cluster.",
    "displayName": "Size",
    "path": "servers[0].size",
    "x-descriptors": [
      "urn:alm:descriptor:com.tectonic.ui:podCount"
    ]
  },
  {
    "description": "The maximum number of failover events tolerated before manual intervention is required.",
    "displayName": "Auto Failover Max Count",
    "path": "cluster.autoFailoverMaxCount",
    "x-descriptors": [
      "urn:alm:descriptor:com.tectonic.ui:slider",
      "urn:alm:descriptor:com.tectonic.ui:sliderStart:1"
    ]
  },
  {
    "description": "Limits describes the minimum/maximum amount of compute resources required/allowed.",
    "displayName": "Resource Requirements",
    "path": "servers[0].pod.resources",
    "x-descriptors": [
      "urn:alm:descriptor:com.tectonic.ui:resourceRequirements"
    ]
  }
]

Comment 6 Jon Jackson 2020-12-07 15:52:20 UTC
I was not able to reproduce your issue on current master. I installed Couchbase operator, create CouchbaseCluster instance, modified Servers -> Pod -> Resource Requirements on the form, added a new server and did the same, toggled to YAML where the edits I made were persisted, then created the instance and checked the YAML and it all seems to be working.

Comment 7 Yadan Pei 2020-12-14 07:33:29 UTC
Hi Jon,

I tried again on 4.7.0-0.nightly-2020-12-13-202314 and edit resource requirements is working well.

Comment 8 Yadan Pei 2020-12-14 07:37:27 UTC
Jon, I see `This was happening when a nested array field had an explicitly set 'null' value` in PR description, can you help confirm if following verification steps correct? 

1. Install Couchbase Operator
2. Tries to create CouchbaseCluster via Form, leave Servers.Pod.Resource Requirements empty/blank, verify that CouchbaseCluster instance can be created successfully

Comment 9 Jon Jackson 2020-12-14 14:31:01 UTC
Created attachment 1738980 [details]
CSV which reproduced the bug

Comment 10 Jon Jackson 2020-12-14 14:31:54 UTC
Created attachment 1738981 [details]
CRD

Comment 11 Jon Jackson 2020-12-14 14:47:26 UTC
(In reply to Yadan Pei from comment #8)
> Jon, I see `This was happening when a nested array field had an explicitly
> set 'null' value` in PR description, can you help confirm if following
> verification steps correct? 
> 
> 1. Install Couchbase Operator
> 2. Tries to create CouchbaseCluster via Form, leave Servers.Pod.Resource
> Requirements empty/blank, verify that CouchbaseCluster instance can be
> created successfully

Hi Yadan, I'm not sure this quite covers the bug. I've attached a CSV + CRD that I used to reproduce the bug. The issue was with metadata.annotations.alm-examples on the CSV. The JSON in that annotation had an array field defined explicitly as null, which caused the exception we were seeing.

Comment 12 Yadan Pei 2020-12-15 02:20:26 UTC
Thank you Jon, I was misunderstanding the fix, now I know what is the real root cause

1. Create test project
$ oc new-project test

2. Create CRD and CSV in attachment
$ oc create -f csv.yaml -f crd.yaml -n test

3. Goes to Operators -> Installed Operators -> click 'Test Jenkins Operator' -> navigate to 'Jenkins' tab -> tries to create Jenkins instance by hitting 'Create Jenkins' button,  click 'Create' button will return error message instead of blank page

Error
Fix the above errors:

    Error "Required value" for field "spec.configurationAsCode.defaultConfig".


Verified on 4.7.0-0.nightly-2020-12-14-165231

Comment 15 errata-xmlrpc 2021-02-24 15:35:50 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 (Moderate: OpenShift Container Platform 4.7.0 security, bug fix, and enhancement update), 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:5633


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