mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-07 11:13:48 +00:00
Use intstr.Parse instead of reimplementing it
Signed-off-by: Stephen Kitt <skitt@redhat.com>
This commit is contained in:
parent
d4fde1e92a
commit
7f53f7649e
@ -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
Block a user