mirror of https://github.com/k3s-io/k3s
Merge pull request #26554 from kargakis/fix-expose-container-port
Automatic merge from submit-queue kubectl: make --container-port actually work for expose Even if it was recently deprecated, it should work as expected. @kubernetes/kubectlpull/6/head
commit
b543e61215
|
@ -180,11 +180,11 @@ func generate(genericParams map[string]interface{}) (runtime.Object, error) {
|
||||||
Ports: ports,
|
Ports: ports,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
targetPortString, found := params["target-port"]
|
targetPortString := params["target-port"]
|
||||||
if !found {
|
if len(targetPortString) == 0 {
|
||||||
targetPortString, found = params["container-port"]
|
targetPortString = params["container-port"]
|
||||||
}
|
}
|
||||||
if found && len(targetPortString) > 0 {
|
if len(targetPortString) > 0 {
|
||||||
var targetPort intstr.IntOrString
|
var targetPort intstr.IntOrString
|
||||||
if portNum, err := strconv.Atoi(targetPortString); err != nil {
|
if portNum, err := strconv.Atoi(targetPortString); err != nil {
|
||||||
targetPort = intstr.FromString(targetPortString)
|
targetPort = intstr.FromString(targetPortString)
|
||||||
|
|
Loading…
Reference in New Issue