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

Get an error when introducing command oc command with deprecated option

    • Icon: Bug Bug
    • Resolution: Not a Bug
    • Icon: Minor Minor
    • None
    • 4.10, 4.9
    • oc
    • None
    • Quality / Stability / Reliability
    • False
    • Hide

      None

      Show
      None
    • None
    • None
    • No
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Description of problem:

      Exposing a service by creating a route cannot be done with the --generator option if the oc client version is 4.12:

       

      $ oc get clusterversions.config.openshift.io 
      NAME      VERSION   AVAILABLE   PROGRESSING   SINCE   STATUS
      version   4.12.2    True        False         2d     Cluster version is 4.12.2
      
      $ oc version
      Client Version: 4.12.2
      Kustomize Version: v4.5.7
      Server Version: 4.12.2
      Kubernetes Version: v1.25.4+a34b9e9
      
      $ oc expose service nodejs-ex  --type=NodePort --name=nodejs-ex-nodeport --generator="service/v2"
      error: unknown flag: --generator
      See 'oc expose --help' for usage. 

       

       

      Managing a cluster of a certain version should be done with the same version of the oc client. See remark at Installing the OpenShift CLI by downloading the binary .

      However, although it is not recommended, you can use older versions of the oc client in an OCP cluster version 4.12. So, in case the oc client version is 4.10 or lower, you will be able to use the --generator  to configure NodePort Service resource to expose a service:

      $ ./oc get clusterversions.config.openshift.io 
      NAME      VERSION   AVAILABLE   PROGRESSING   SINCE   STATUS
      version   4.12.2    True        False         2d     Cluster version is 4.12.2
      
      $ ./oc version
      Client Version: 4.10.55
      Server Version: 4.12.2
      Kubernetes Version: v1.25.4+a34b9e9
      
      $ ./oc expose service nodejs-ex  --type=NodePort --name=nodejs-ex-nodeport --generator="service/v2"
      service/nodejs-ex-nodeport exposed$ ./oc get svc 
      NAME                 TYPE        CLUSTER-IP     EXTERNAL-IP   PORT(S)          AGE
      nodejs-ex            ClusterIP   172.30.200.3   <none>        8080/TCP         2m12s
      nodejs-ex-nodeport   NodePort    172.30.77.76   <none>        8080:30863/TCP   23s 

      In order to avoid misuse, our recommendation it is that Custumers will get an error when introducing command 

      oc expose service nodejs-ex  --type=NodePort --name=nodejs-ex-nodeport --generator="service/v2" 

      in OCP4.12. In this way we avoid that a not allowed command in 4.12 is used. 

       

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

      4.10

      How reproducible:

      Always

      Steps to Reproduce:

      1. OCP version 4.12 + co client version 4.10 or lower
      2. oc expose service nodejs-ex  --type=NodePort --name=nodejs-ex-nodeport --generator="service/v2"
      3. service exposed 

      Actual results:

      service exposed 

      Expected results:

      error

      Additional info:

      Managing a cluster of a certain version should be done with the same version of the oc client. 

              jchaloup@redhat.com Jan Chaloupka
              rhn-support-malonsof Montserrat Alonso Ferrero
              Ying Zhou Ying Zhou
              None
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: