Description of problem:
oc expose service apparently ignores --labels command-line option. The resulting Route resource uses the service's selector as its .metadata.labels.
Version-Release number of selected component (if applicable):
4.20.12
How reproducible:
- Create a deployment
- Create a service exposing the deployment - service should have a selector
- Expose the service using oc expose service, having --labels to override .metadata.labels
- Check the resulting Route resource, its .metadata.labels reflects service's selector instead of the one(s) configured via --labels
Steps to Reproduce:
$ oc create deployment example --image k8s.gcr.io/echoserver:1.3 deployment.apps/example created $ oc expose deployment example --port 8080 service/example exposed $ oc expose service example --labels key=value route.route.openshift.io/example exposed $ oc get route example --show-labels NAME ... LABELS example ... app=example
Actual results:
oc expose apparently ignores --labels when creating a Route.
Expected results:
.metadata.labels configured according to the --labels command-line option.
Additional info:
This issue apparently happens only when creating Routes, from oc expose service. When exposing a deployment and creating a service, oc expose works as expected and configures .metadata.labels correctly.