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

oc patch command for global ip forwarding is incorrect on cluster network operator

    • None
    • 1
    • OSDOCS Sprint 269
    • 1
    • False
    • Hide

      None

      Show
      None

      Description of problem:

          The patch command:
      ```
      oc patch network.operator cluster -p '{"spec":{"defaultNetwork":{"ovnKubernetesConfig":{"gatewayConfig":{"ipForwarding": "Global"}}}}}
      ```
      From the docs: https://docs.redhat.com/en/documentation/openshift_container_platform/4.18/html/networking/networking-operators#nw-cno-enable-ip-forwarding_cluster-network-operator 
      does not work.
      
      The correct command is:
      ``` 
      oc patch network.operator cluster  -p '{"spec":{"defaultNetwork":{"ovnKubernetesConfig":{"gatewayConfig":{"ipForwarding": "Global"}}}}}' --type=merge 
      ```
      Note: The --type and missing quotation at the end
      
      Without the --type you will receive:
      ```
      oc patch network.operator cluster  -p '{"spec":{"defaultNetwork":{"ovnKubernetesConfig":{"gatewayConfig":{"ipForwarding": "Global"}}}}}' 
      error: application/strategic-merge-patch+json is not supported by operator.openshift.io/v1, Kind=Network: the body of the request was in an unknown format - accepted media types include: application/json-patch+json, application/merge-patch+json, application/apply-patch+yaml
      ```

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

          

      How reproducible:

          

      Steps to Reproduce:

          1.
          2.
          3.
          

      Actual results:

              Cannot execute proposed command:
      ```
      oc patch network.operator cluster -p '{"spec":{"defaultNetwork":{"ovnKubernetesConfig":{"gatewayConfig":{"ipForwarding": "Global"}}}}}quote> 
      ```
      

      Expected results:

      Patch command should succeed.
      Using the following patch command does succeed:
      ```
      oc patch network.operator cluster --type='merge' -p '{"spec":{"defaultNetwork":{"ovnKubernetesConfig":{"gatewayConfig":{"ipForwarding": "Global"}}}}}'
      ```
      
      ```
      $ oc get network.operator/cluster -ojson | jq '.spec.defaultNetwork.ovnKubernetesConfig.gatewayConfig'
      {
        "ipv4": {},
        "ipv6": {},
        "routingViaHost": false
      }
      
      $ oc patch network.operator cluster  -p '{"spec":{"defaultNetwork":{"ovnKubernetesConfig":{"gatewayConfig":{"ipForwarding": "Global"}}}}}' --type=merge
      network.operator.openshift.io/cluster patched
      
      $ oc get network.operator/cluster -ojson | jq '.spec.defaultNetwork.ovnKubernetesConfig.gatewayConfig'
      {
        "ipForwarding": "Global",
        "ipv4": {},
        "ipv6": {},
        "routingViaHost": false
      }
      ```    

      Additional info:

      4.18 docs: https://docs.redhat.com/en/documentation/openshift_container_platform/4.18/html/networking/networking-operators#nw-cno-enable-ip-forwarding_cluster-network-operator
      
      4.17 docs: https://docs.redhat.com/en/documentation/openshift_container_platform/4.17/html/networking/networking-operators#nw-cno-enable-ip-forwarding_cluster-network-operator
      
      4.16 docs: https://docs.redhat.com/en/documentation/openshift_container_platform/4.16/html/networking/networking-operators#nw-cno-enable-ip-forwarding_cluster-network-operator

              rh-ee-kniederw Kevin Niederwanger
              rh-ee-kniederw Kevin Niederwanger
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: