kubectl: make --container-port actually work for expose
Even if it was recently deprecated, it should work as expected.
This commit is contained in:
@@ -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)
|
||||||
|
Reference in New Issue
Block a user