Repository navigation
Use service port name as route targetPort in 'oc expose service' - #6274
Conversation
|
@Kargakis PTAL |
|
[test] |
There was a problem hiding this comment.
ugly, I don't see a better way to explicitly tell the route generator we want it to leave out the port
There was a problem hiding this comment.
Can we decide on using port vs target-port as the name of the parameter (and subsequently the name of the flag for setting the route port)? I think the intention is to use target-port. Then we will not require portString to not be zero in the generator, instead of introducing another field to explicitly pass info.
There was a problem hiding this comment.
I think I agree, updated
|
You also need to update ParamsNames to include |
And then update the unit tests for the route generator. I always forget those and being reminded by Jenkins is disturbing:) |
|
updated tests and cmd tests |
There was a problem hiding this comment.
Is this <no value> what is really returned?
|
A question, LGTM in general |
|
that's what template rendering returns when you reference something that doesn't exist in the struct |
[merge] @liggitt thanks for this |
|
continuous-integration/openshift-jenkins/merge SUCCESS (https://ci.openshift.redhat.com/jenkins/job/merge_pull_requests_origin/4334/) (Image: devenv-rhel7_2949) |
|
#6312 flake [merge] |
|
Evaluated for origin merge up to 419cca5 |
|
Evaluated for origin test up to 419cca5 |
|
continuous-integration/openshift-jenkins/test SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pull_requests_origin/7817/) |
Merged by openshift-bot
Fixes #6265
There are 6 possible scenarios for services with ports we will hit in
oc exposeWhenever a service port is named (cases 3,4,5,6), we should use the name as the route targetPort
When a service port is unnamed (which means it is the only port), we could try to set a targetPort that will point to the right containers, or we could omit the targetPort and let the route "round-robin" to the single port. In case 1 (numbered container port), we could set a numbered targetPort, but the route would break if the service was edited to set a different targetPort. In case 2 (named container port), we have no choice but to round-robin (container port names aren't available in the endpoints).
This PR updates
oc expose service <svc>to generate a route that has a named targetPort when possible, and no targetPort otherwise.