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

Default value seems to be set to false for the parameters enableInjector and enableOperatorWebhook in SriovOperatorConfig.spec. which gives <none> output.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done-Errata
    • Icon: Major Major
    • None
    • 4.18.z
    • Networking / SR-IOV
    • None
    • Quality / Stability / Reliability
    • False
    • Hide

      None

      Show
      None
    • 3
    • Important
    • None
    • None
    • CNF Network Sprint 269
    • 1
    • Done
    • Bug Fix
    • Hide
      * Previously, the `SriovOperatorConfig` Operator removed any parameters that had default values in the `SriovOperatorConfig` resources. This situation caused certain information to be missing from the output of a resource. With this release, the Operator uses the PATCH method for API servers to preserve parameters with default values so that no information is missing from the output for a resource. (link:https://issues.redhat.com/browse/OCPBUGS-53346[OCPBUGS-53346])
      Show
      * Previously, the `SriovOperatorConfig` Operator removed any parameters that had default values in the `SriovOperatorConfig` resources. This situation caused certain information to be missing from the output of a resource. With this release, the Operator uses the PATCH method for API servers to preserve parameters with default values so that no information is missing from the output for a resource. (link: https://issues.redhat.com/browse/OCPBUGS-53346 [ OCPBUGS-53346 ])
    • None
    • None
    • None
    • None

      Description of problem:

      1. what is the "default value"
      I think the meaning of "default value" should describe the behavior when the value is not explicit set by user in the SriovOperatorConfig object. In my Test 4 and 5, both functions are disabled in the operator when the object creation does not include the attributes in question.
      The value of '<none>' , i.e. not returned, should match with the "default value". In your my 3 even when the user has set false for both, '<none>' is still returned, which to me indicates default value is false for both.  
      
      2. attribute value returned in get should be consistent.
      The get behaviour should not change resulting documentation regardless of how the attributes are set.
      In my Test 3, when both attributes are set to false in initial object creation, get does not return any value for those attributes.
      However, if object attribute was patched to false, the get returns them.

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

          4.18.z

      How reproducible:

          Easily on both SNO and multi-node cluster. 

      Steps to Reproduce:

         I checked in different ways, please check all the tests and scenarios and my observations. 
      
      
      Test 3: Setting the values FALSE at the time of creating CR.
      
      
      1]
      ~~~
      [root@vm-236-142 ~]# cat << EOF| oc create -f -
      apiVersion: v1
      kind: Namespace
      metadata:
        name: openshift-sriov-network-operator
        annotations:
          workload.openshift.io/allowed: management
      EOF
      namespace/openshift-sriov-network-operator created
      
      
      2]
      ~~~
      [root@vm-236-142 ~]# cat << EOF| oc create -f -
      apiVersion: operators.coreos.com/v1
      kind: OperatorGroup
      metadata:
        name: sriov-network-operators
        namespace: openshift-sriov-network-operator
      spec:
        targetNamespaces:
        - openshift-sriov-network-operator
      EOF
      operatorgroup.operators.coreos.com/sriov-network-operators created
      
      
      3]
      ~~~
      [root@vm-236-142 ~]# cat << EOF| oc create -f -
      apiVersion: operators.coreos.com/v1alpha1
      kind: Subscription
      metadata:
        name: sriov-network-operator-subscription
        namespace: openshift-sriov-network-operator
      spec:
        channel: stable
        name: sriov-network-operator
        source: redhat-operators
        sourceNamespace: openshift-marketplace
      EOF
      subscription.operators.coreos.com/sriov-network-operator-subscription created
      
      
      4] CR does not get created automatically, we need to create manually as mentioned in the documentation.
      ~~~
      [root@vm-236-142 ~]# oc get SriovOperatorConfig
      No resources found in test namespace.
      
      
      5] While creating the CR, I set the values in the spec field to be false. 
      ~~~
      [root@vm-236-142 ~]# cat <<EOF | oc create -f -
      apiVersion: sriovnetwork.openshift.io/v1
      kind: SriovOperatorConfig
      metadata:
        name: default
        namespace: openshift-sriov-network-operator
      spec:
        enableInjector: false           <<<
        enableOperatorWebhook: false           <<<
        logLevel: 2
        disableDrain: false
      EOF
      sriovoperatorconfig.sriovnetwork.openshift.io/default created
      
      
      VERIFICATION:
      ~~~
      
      1] There are no injector and webhook pods are running in the namespace. 
      ~~~
      [root@vm-236-142 ~]# oc get pods
      NAME                                      READY   STATUS    RESTARTS   AGE
      sriov-network-config-daemon-2lv5l         1/1     Running   0          62s
      sriov-network-operator-548c568f46-v4zd5   1/1     Running   0          10m
      
      
      2] Setting the values false at the time of CR creation, gives the <none> output. However as per the behaviour 'none' is equivalent to false as per the testing. 
      ~~~
      [root@vm-236-142 ~]# oc -n openshift-sriov-network-operator get SriovOperatorConfig -o custom-columns='Name:.metadata.name,Injector:.spec.enableInjector,OperatorWebhook:spec.enableOperatorWebhook'
      Name      Injector   OperatorWebhook
      default   <none>     <none>           <<<
      
      
      3] Deleted the CR and recreated it again by setting the values true.
      ~~~
      [root@vm-236-142 ~]# oc delete SriovOperatorConfig default
      sriovoperatorconfig.sriovnetwork.openshift.io "default" deleted
      
      [root@vm-236-142 ~]# oc get SriovOperatorConfig
      No resources found in openshift-sriov-network-operator namespace.
      
      
      4] Recreated CR with true. 
      ~~~
      [root@vm-236-142 ~]# cat <<EOF | oc create -f -
      apiVersion: sriovnetwork.openshift.io/v1
      kind: SriovOperatorConfig
      metadata:
        name: default
        namespace: openshift-sriov-network-operator
      spec:
        enableInjector: true           <<<
        enableOperatorWebhook: true           <<<
        logLevel: 2
        disableDrain: false
      EOF
      sriovoperatorconfig.sriovnetwork.openshift.io/default created
      
      
      5] Here I observed, if we create the CR with default values which are supposed to be true then it shows 'true'. Later on we can perform the patch to make it false, post patching it updates the value and set to false. 
      ~~~
      [root@vm-236-142 ~]# oc get pods
      NAME                                      READY   STATUS    RESTARTS   AGE
      network-resources-injector-shqnk          1/1     Running   0          9s
      operator-webhook-lrzwf                    1/1     Running   0          9s
      sriov-network-config-daemon-pwnvk         1/1     Running   0          9s
      sriov-network-operator-548c568f46-v4zd5   1/1     Running   0          17m
      
      [root@vm-236-142 ~]# oc -n openshift-sriov-network-operator get SriovOperatorConfig -o custom-columns='Name:.metadata.name,Injector:.spec.enableInjector,OperatorWebhook:spec.enableOperatorWebhook'
      Name      Injector   OperatorWebhook
      default   true       true           <<<
      
      [root@vm-236-142 ~]# oc patch sriovoperatorconfig default --type=merge -n openshift-sriov-network-operator --patch '{ "spec": { "enableInjector": false } }'
      sriovoperatorconfig.sriovnetwork.openshift.io/default patched
      
      [root@vm-236-142 ~]# oc patch sriovoperatorconfig default   --type=merge -n openshift-sriov-network-operator   --patch '{ "spec": { "enableOperatorWebhook": false } }'
      sriovoperatorconfig.sriovnetwork.openshift.io/default patched
      
      [root@vm-236-142 ~]# oc -n openshift-sriov-network-operator get SriovOperatorConfig -o custom-columns='Name:.metadata.name,Injector:.spec.enableInjector,OperatorWebhook:spec.enableOperatorWebhook'
      Name      Injector   OperatorWebhook
      default   false      false           <<<
      
      
      Test 4: <none> SCENARIO on SNO cluster:
      ~~~
      
      1] Created CR without the parameters "enableInjector and enableOperatorWebhook". 
      ~~~
      [root@vm-236-142 ~]#  cat <<EOF | oc create -f -
      apiVersion: sriovnetwork.openshift.io/v1
      kind: SriovOperatorConfig
      metadata:
        name: default
        namespace: openshift-sriov-network-operator
      spec:
        logLevel: 2
        disableDrain: true
      EOF
      sriovoperatorconfig.sriovnetwork.openshift.io/default created
      
      
      2] VERIFICATION: Default value seems to be set to false. The Documentation says "By default, this field is set to true." However in practical the default value is false which gives <none> output; unless we specify expilicitly to be true. 
      ~~~
      [root@vm-236-142 ~]# oc get pods
      NAME                                      READY   STATUS    RESTARTS   AGE
      sriov-network-config-daemon-x5jf2         1/1     Running   0          9s
      sriov-network-operator-548c568f46-v4zd5   1/1     Running   0          60m
      
      [root@vm-236-142 ~]#  oc -n openshift-sriov-network-operator get SriovOperatorConfig -o custom-columns='Name:.metadata.name,Injector:.spec.enableInjector,OperatorWebhook:spec.enableOperatorWebhook'
      Name      Injector   OperatorWebhook
      default   <none>     <none>           <<<
      
      
      
      Test 5: <none> SCENARIO on multi-node cluster:
      ~~~
      
      MULTI-NODE CLUSTER:
      ~~~
      [ocp418@vm-236-142 ~]$   cat <<EOF | oc create -f -
      apiVersion: sriovnetwork.openshift.io/v1
      kind: SriovOperatorConfig
      metadata:
        name: default
        namespace: openshift-sriov-network-operator
      spec:
        logLevel: 2
        disableDrain: true
      EOF
      sriovoperatorconfig.sriovnetwork.openshift.io/default created
      
      [ocp418@vm-236-142 ~]$ oc get pods
      NAME                                      READY   STATUS            RESTARTS   AGE
      sriov-network-config-daemon-642g9         0/1     PodInitializing   0          4s
      sriov-network-config-daemon-979cr         0/1     PodInitializing   0          4s
      sriov-network-config-daemon-p8b5v         0/1     PodInitializing   0          4s
      sriov-network-operator-548c568f46-vmvnq   1/1     Running           0          2d3h
      
      [ocp418@vm-236-142 ~]$ oc get pods
      NAME                                      READY   STATUS    RESTARTS   AGE
      sriov-network-config-daemon-642g9         1/1     Running   0          8s
      sriov-network-config-daemon-979cr         1/1     Running   0          8s
      sriov-network-config-daemon-p8b5v         1/1     Running   0          8s
      sriov-network-operator-548c568f46-vmvnq   1/1     Running   0          2d3h
      
      [ocp418@vm-236-142 ~]$   oc -n openshift-sriov-network-operator get SriovOperatorConfig -o custom-columns='Name:.metadata.name,Injector:.spec.enableInjector,OperatorWebhook:spec.enableOperatorWebhook'
      Name      Injector   OperatorWebhook
      default   <none>     <none>    <<<
      ~~~     

      Actual results:

          [ocp418@vm-236-142 ~]$ oc -n openshift-sriov-network-operator get SriovOperatorConfig -o custom-columns='Name:.metadata.name,Injector:.spec.enableInjector,OperatorWebhook:spec.enableOperatorWebhook' Name Injector OperatorWebhook default <none> <none> <<<

      Expected results:

          [root@vm-236-142 ~]# oc -n openshift-sriov-network-operator get SriovOperatorConfig -o custom-columns='Name:.metadata.name,Injector:.spec.enableInjector,OperatorWebhook:spec.enableOperatorWebhook' Name Injector OperatorWebhook default false false <<<

      Additional info:

          REFERENCE: https://docs.redhat.com/en/documentation/openshift_container_platform/4.18/html/networking/networking-operators#sr-iov-operator
      

              rhn-cnf-elevin Evgeny Levin
              rhn-support-zekhan Zeba Khan
              None
              None
              Evgeny Levin Evgeny Levin
              None
              Votes:
              0 Vote for this issue
              Watchers:
              13 Start watching this issue

                Created:
                Updated:
                Resolved: