Use intstr.Parse instead of reimplementing it
Signed-off-by: Stephen Kitt <skitt@redhat.com> Kubernetes-commit: 7f53f7649e178622ad1a64988913f025399f152b
This commit is contained in:
parent
0266cec8bc
commit
4729836f7f
|
@ -532,12 +532,7 @@ func (o *ExposeServiceOptions) createService() (*corev1.Service, error) {
|
|||
}
|
||||
targetPortString := o.TargetPort
|
||||
if len(targetPortString) > 0 {
|
||||
var targetPort intstr.IntOrString
|
||||
if portNum, err := strconv.Atoi(targetPortString); err != nil {
|
||||
targetPort = intstr.FromString(targetPortString)
|
||||
} else {
|
||||
targetPort = intstr.FromInt(portNum)
|
||||
}
|
||||
targetPort := intstr.Parse(targetPortString)
|
||||
// Use the same target-port for every port
|
||||
for i := range service.Spec.Ports {
|
||||
service.Spec.Ports[i].TargetPort = targetPort
|
||||
|
|
Loading…
Reference in New Issue