Uploaded image for project: 'OpenShift Bugs'
  1. OpenShift Bugs
  2. OCPBUGS-3952

The form view fills up properties of schema from children default values even if no defaults are specified for parent schema

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not a Bug
    • Icon: Undefined Undefined
    • None
    • 4.9
    • Management Console
    • None
    • Low
    • False
    • Hide

      None

      Show
      None

      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

      Additional info:

      Migrated from https://bugzilla.redhat.com/show_bug.cgi?id=2102735

            rh-ee-jonjacks Jon Jackson
            rh-ee-jonjacks Jon Jackson
            YaDan Pei YaDan Pei
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: