Bug 1898532

Summary: Display names defined in specDescriptors not respected
Product: OpenShift Container Platform Reporter: Alexandre Kieling <abrianik>
Component: Management ConsoleAssignee: Jon Jackson <jonjacks>
Status: CLOSED ERRATA QA Contact: Yadan Pei <yapei>
Severity: medium Docs Contact:
Priority: medium    
Version: 4.6CC: aos-bugs, jokerman, spadgett, yapei
Target Milestone: ---   
Target Release: 4.7.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Cause: Lodash startCase function was being applied to Operand form descriptor fields in some cases. Consequence: The field label would be formatted in Start Case, which would override the displayName property of the descriptor. Fix: Only apply startCase when a descriptor displayName is not provided. Result: Descriptor displayName is properly displayed on Operanmd forms.
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-02-24 15:34:16 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
CR creation page
none
specDescriptor displayName is shown correctly
none
specDescriptor displayName is respected none

Description Alexandre Kieling 2020-11-17 13:10:47 UTC
Created attachment 1730136 [details]
CR creation page

Description of problem:

In the Golang operator, I define the following CRD Spec field:

// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="3scale APIcast Operator"
ThreeScaleAPIcastInstallationInput *ThreeScaleAPIcastInstallationInput `json:"3scale-apicast-installation,omitempty"`

Which gets translated into the following CSV specDescriptor:

- displayName: 3scale APIcast Operator
  path: 3scale-apicast-installation

In the OpenShift console, the display name is changed to "3 Scale AP Icast Operator".


Steps to Reproduce:
1. Create a Go based operator and define an API Spec field with the following markers:
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="3scale APIcast Operator"
2. Deploy the operator to OperatorHub
3. Install the operator
4. Go to the CR creation page

Actual results:

In the CR creation page, the dynamically generated form shows the field with the following label: "3 Scale AP Icast Operator".

Expected results:

Expected to see the defined display name: "3scale APIcast Operator".

Additional info:

Comment 2 Yadan Pei 2020-12-07 07:32:31 UTC
Created attachment 1737209 [details]
specDescriptor displayName is shown correctly

1. Install Red Hat Integration - 3scale operator from OperatorHub, wait it is successfully installed
2. Check CSV specDescriptor
# oc get csv -n test
NAME                                           DISPLAY                            VERSION                 REPLACES                 PHASE
3scale-operator.v0.6.1                         Red Hat Integration - 3scale       0.6.1                   3scale-operator.v0.6.0   Succeeded

# oc get csv 3scale-operator.v0.6.1 -n test -o json | jq '.spec.customresourcedefinitions.owned[2].specDescriptors'
[
  {
    "description": "Wildcard domain as configured in the API Manager object",
    "displayName": "Wildcard Domain",
    "path": "wildcardDomain",
    "x-descriptors": [
      "urn:alm:descriptor:com.tectonic.ui:label"
    ]
  }
]

3. Change displayName in specDescriptors to `3scale APIcast Operator` and save the changes
# oc get csv 3scale-operator.v0.6.1 -n test -o json | jq '.spec.customresourcedefinitions.owned[2].specDescriptors'
[
  {
    "description": "Wildcard domain as configured in the API Manager object",
    "displayName": "3scale APIcast Operator Wildcard Domain",      // updated displayName 
    "path": "wildcardDomain",
    "x-descriptors": [
      "urn:alm:descriptor:com.tectonic.ui:label"
    ]
  }
]

4. goes to Installed Operators -> click on Red Hat Integration - 3scale -> click 'API Manager' tab and hit 'Create APIManager' button, in the form we can see the field display name is `3scale APIcast Operator Wildcard Domain` (see attachment)


Above steps are checked against 4.6.0-0.nightly-2020-12-06-095114

Comment 3 Yadan Pei 2020-12-07 07:34:31 UTC
Hi abrianik

I didn't reproduce your issue on 4.6.0-0.nightly-2020-12-06-095114 which should not have the fix, could you help check if my reproduce steps in comment 2 is correct or not?

Comment 4 Alexandre Kieling 2020-12-07 11:54:23 UTC
@yapei I wasn't able reproduce the issue using your steps but managed to reproduce it using a different Operator, the Red Hat Integration - Service Registry Operator. Try that one.

Comment 5 Yadan Pei 2020-12-08 02:02:41 UTC
Created attachment 1737471 [details]
specDescriptor displayName is respected

1. Install Red Hat Integration - Service Registry Operator
2. Update specDescriptor in CSV
# oc get csv service-registry-operator.v1.1.0 -n default -o json | jq '.spec.customresourcedefinitions.owned[0].specDescriptors'
[
  {
    "description": "Configuration",
    "displayName": "3scale APIcast Operator Configuration",
    "path": "configuration"
  },
  {
    "description": "Deployment",
    "displayName": "3scale APIcast Operator Deployment",
    "path": "deployment"
  },
  {
    "description": "Image",
    "displayName": "Image",
    "path": "image"
  }
]
3. Create instance in Form view, the display name is showing exactly the same as we defined `3scale APIcast Operator Configuration`, see attachment

Verified on 4.7.0-0.nightly-2020-12-04-013308

Comment 6 Yadan Pei 2020-12-08 02:12:20 UTC
Sorry, moving Assignee back and clear my NEEDINFO

Comment 9 errata-xmlrpc 2021-02-24 15:34:16 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