Refactor IntOrString into a new pkg

pkg/util/intstr is a cleaner encapsulation for this type and supporting
functions.  No behavioral change.
This commit is contained in:
Tim Hockin
2015-11-09 22:28:45 -08:00
parent 3a07af0b28
commit ba383bcfeb
63 changed files with 676 additions and 656 deletions

View File

@@ -31,6 +31,7 @@ import (
servicecontroller "k8s.io/kubernetes/pkg/registry/service/ipallocator/controller"
portallocatorcontroller "k8s.io/kubernetes/pkg/registry/service/portallocator/controller"
"k8s.io/kubernetes/pkg/util"
"k8s.io/kubernetes/pkg/util/intstr"
"github.com/golang/glog"
)
@@ -157,7 +158,7 @@ func createPortAndServiceSpec(servicePort int, nodePort int, servicePortName str
servicePorts := []api.ServicePort{{Protocol: api.ProtocolTCP,
Port: servicePort,
Name: servicePortName,
TargetPort: util.NewIntOrStringFromInt(servicePort)}}
TargetPort: intstr.FromInt(servicePort)}}
serviceType := api.ServiceTypeClusterIP
if nodePort > 0 {
servicePorts[0].NodePort = nodePort