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

oc expose can't set the hostname of a route and label on the route in the same command.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Obsolete
    • Icon: Normal Normal
    • None
    • 4.12.z
    • oc
    • None
    • Quality / Stability / Reliability
    • False
    • Hide

      None

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

      Description of problem:

      When creating a route (from a service) using `oc expose` (to align with our corporate cluster standards, we must label the route (to place the route on the correct router shard (using https://docs.openshift.com/container-platform/4.14/networking/ingress-sharding.html#nw-ingress-sharding-route-labels_ingress-sharding) thus we can use `oc expose -l LABEL` to accomplish this. 
      
      However in addition to this each shard in our deployment also only provides routing to specific domains (IE: shard one (label=shard1 hosts foo.com, while shard two label=shard2 hosts bar.com). 
      
      Thus we attempt combine `--hostname` and `--label` on the `oc expose` command to achieve the desired result of creating a route in one command; however this doesn't work.
      
      You can use `--hostname` or `--label` independently but not together. 
      
      Example (doesn't work): 
      
      ❯ NAME=foo SERVICE=service/$NAME oc expose $SERVICE --hostname $(oc get $SERVICE -o go-template="{{ .metadata.name }}")-$(oc project -q).foo.com -l shard=shard1

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

      ❯ oc version
      Client Version: 4.11.0-202304181642.p0.gdea6f47.assembly.stream-dea6f47
      Kustomize Version: v4.5.4
      Kubernetes Version: v1.27.6+d548052
      
      
      Cluster Version: v1.27.6+d548052

      Steps to Reproduce:

      1. Set up Router Sharding (with labels) 
      
      https://docs.openshift.com/container-platform/4.14/networking/ingress-sharding.html#nw-ingress-sharding-route-labels_ingress-sharding
      
      2. Create a route using both the '--label` and '--hostname' cli options
          

      Actual results:

      You create a route with the proper hostname; but it doesn't have a label applied to it. 

      Expected results:

      You should get a route with both the correct (non default hostname) and with the correct sharding label

              mmasters1@redhat.com Miciah Masters
              rhn-support-edrich Eric Rich
              None
              Ahmed Mohamed
              Ying Zhou Ying Zhou
              None
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: