Bug 2102735 - The form view fills up properties of schema from children default values even if no defaults are specified for parent schema
Summary: The form view fills up properties of schema from children default values even...
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: Management Console
Version: 4.9
Hardware: Unspecified
OS: Unspecified
unspecified
low
Target Milestone: ---
: ---
Assignee: Jon Jackson
QA Contact: Yadan Pei
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2022-06-30 13:46 UTC by roarora
Modified: 2022-11-21 20:28 UTC (History)
0 users

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2022-11-21 20:28:33 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker OCPBUGS-3952 0 None None None 2022-11-21 20:28:32 UTC

Description roarora 2022-06-30 13:46:28 UTC
Description of problem:

Here is one of the affected CRD from certified hazelcast-platform-operator : 
https://github.com/hazelcast/hazelcast-platform-operator/blob/main/config/crd/bases/hazelcast.com_hazelcasts.yaml

in spec, there is a schema "exposeExternally" which does not have defaults specified for itself  : 
-----------------
              exposeExternally:
                description: Configuration to expose Hazelcast cluster to external
                  clients.
                properties:
                  discoveryServiceType:
                    default: LoadBalancer
                    description: Type of the service used to discover Hazelcast cluster.
                    type: string
                  memberAccess:
                    description: 'How each member is accessed from the external client.
                      Only available for "Smart" client and valid values are: - "NodePortExternalIP"
                      (default): each member is accessed by the NodePort service and
                      the node external IP/hostname - "NodePortNodeName": each member
                      is accessed by the NodePort service and the node name - "LoadBalancer":
                      each member is accessed by the LoadBalancer service external
                      address'
                    enum:
                    - NodePortExternalIP
                    - NodePortNodeName
                    - LoadBalancer
                    type: string
                  type:
                    default: Smart
                    description: 'Specifies how members are exposed. Valid values
                      are: - "Smart" (default): each member pod is exposed with a
                      separate external address - "Unisocket": all member pods are
                      exposed with one external address'
                    enum:
                    - Smart
                    - Unisocket
                    type: string
                type: object
-----------------

If we go to the form view to create "Hazelcast" Custom Resource, and then switch back to the yaml view, here is the yaml rendered :
-----------------
spec:
  agent:
    repository: docker.io/hazelcast/platform-operator-agent
    version: 0.1.0
  clusterName: dev
  repository: docker.io/hazelcast/hazelcast-enterprise
  imagePullPolicy: IfNotPresent
  version: 5.1.2
  clusterSize: 3
  exposeExternally:
    discoveryServiceType: LoadBalancer
    type: Smart
  persistence:
    autoForceStart: false
    backupType: Local
    clusterDataRecoveryPolicy: FullRecoveryOnly
  licenseKeySecret: hazelcast-license-key
-----------------

For the operator to work, "exposeExternally" is not required and should be completely optional unless explicitly defined and there is no default specifed for it but it gets filled up using the default values of the child properties "discoveryServiceType" and "type". The expectation of the developer is to make this optional. Adding an empty default for exposeExternally does not work.

Also this conflicts with how the custom resources are created by default by k8s. if we create using the following spec : 
----------
kind: Hazelcast
apiVersion: hazelcast.com/v1alpha1
metadata:
  name: hazelcast
  namespace: default
spec:
  clusterSize: 3
  licenseKeySecret: hazelcast-license-key
  repository: docker.io/hazelcast/hazelcast-enterprise
  version: 5.1.2
----------

k8s does not add exposeExternally to the resource by default. It fills up default values for the child properties only if one of the properties are given. Example if "discoveryServiceType" is specified in yaml, "type" also gets filled up. So "exposeExternally" remains optional unless specified.


Version-Release number of selected component (if applicable):
4.9
4.10


How reproducible:
Always


Steps to Reproduce:
1. Install 4.9/4.10 and Hazelcast Platform Operator platform operator
2. create "Hazelcast" resource from UI, click form view and then check yaml view, it has "exposeExternally

Actual results:
exposeExternally gets filled up

Expected results:
exposeExternally should not be filled up or there should be a way to mark this schema as optional by default

Comment 5 Jon Jackson 2022-11-21 20:28:33 UTC
Migrated to JIRA: https://issues.redhat.com/browse/OCPBUGS-3952


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