Change int <->int32 for godeps

This commit is contained in:
Prashanth Balasubramanian 2016-05-09 12:06:09 -07:00
parent 9168a67324
commit 0d4f49e50e
3 changed files with 11 additions and 11 deletions

View file

@ -184,11 +184,11 @@ func addIngress(lbc *LoadBalancerController, ing *extensions.Ingress, pm *nodePo
var svcPort api.ServicePort var svcPort api.ServicePort
switch path.Backend.ServicePort.Type { switch path.Backend.ServicePort.Type {
case intstr.Int: case intstr.Int:
svcPort = api.ServicePort{Port: int(path.Backend.ServicePort.IntVal)} svcPort = api.ServicePort{Port: path.Backend.ServicePort.IntVal}
default: default:
svcPort = api.ServicePort{Name: path.Backend.ServicePort.StrVal} svcPort = api.ServicePort{Name: path.Backend.ServicePort.StrVal}
} }
svcPort.NodePort = pm.getNodePort(path.Backend.ServiceName) svcPort.NodePort = int32(pm.getNodePort(path.Backend.ServiceName))
svc.Spec.Ports = []api.ServicePort{svcPort} svc.Spec.Ports = []api.ServicePort{svcPort}
lbc.svcLister.Store.Add(svc) lbc.svcLister.Store.Add(svc)
} }

View file

@ -267,13 +267,13 @@ func (t *GCETranslator) getServiceNodePort(be extensions.IngressBackend, namespa
for _, p := range obj.(*api.Service).Spec.Ports { for _, p := range obj.(*api.Service).Spec.Ports {
switch be.ServicePort.Type { switch be.ServicePort.Type {
case intstr.Int: case intstr.Int:
if p.Port == int(be.ServicePort.IntVal) { if p.Port == be.ServicePort.IntVal {
nodePort = p.NodePort nodePort = int(p.NodePort)
break break
} }
default: default:
if p.Name == be.ServicePort.StrVal { if p.Name == be.ServicePort.StrVal {
nodePort = p.NodePort nodePort = int(p.NodePort)
break break
} }
} }

View file

@ -496,7 +496,7 @@ func (lbc *loadBalancerController) getStreamServices(data map[string]string, pro
} else { } else {
// we need to use the TargetPort (where the endpoints are running) // we need to use the TargetPort (where the endpoints are running)
for _, sp := range svc.Spec.Ports { for _, sp := range svc.Spec.Ports {
if sp.Port == targetPort { if sp.Port == int32(targetPort) {
endps = lbc.getEndpoints(svc, sp.TargetPort, proto) endps = lbc.getEndpoints(svc, sp.TargetPort, proto)
break break
} }
@ -692,7 +692,7 @@ func (lbc *loadBalancerController) createUpstreams(data []interface{}) map[strin
bp := path.Backend.ServicePort.String() bp := path.Backend.ServicePort.String()
for _, servicePort := range svc.Spec.Ports { for _, servicePort := range svc.Spec.Ports {
// targetPort could be a string, use the name or the port (int) // targetPort could be a string, use the name or the port (int)
if strconv.Itoa(servicePort.Port) == bp || servicePort.TargetPort.String() == bp || servicePort.Name == bp { if strconv.Itoa(int(servicePort.Port)) == bp || servicePort.TargetPort.String() == bp || servicePort.Name == bp {
endps := lbc.getEndpoints(svc, servicePort.TargetPort, api.ProtocolTCP) endps := lbc.getEndpoints(svc, servicePort.TargetPort, api.ProtocolTCP)
if len(endps) == 0 { if len(endps) == 0 {
glog.Warningf("service %v does no have any active endpoints", svcKey) glog.Warningf("service %v does no have any active endpoints", svcKey)
@ -822,10 +822,10 @@ func (lbc *loadBalancerController) getEndpoints(s *api.Service, servicePort ints
continue continue
} }
var targetPort int var targetPort int32
switch servicePort.Type { switch servicePort.Type {
case intstr.Int: case intstr.Int:
if epPort.Port == servicePort.IntValue() { if int(epPort.Port) == servicePort.IntValue() {
targetPort = epPort.Port targetPort = epPort.Port
} }
case intstr.String: case intstr.String:
@ -838,7 +838,7 @@ func (lbc *loadBalancerController) getEndpoints(s *api.Service, servicePort ints
continue continue
} }
targetPort = port targetPort = int32(port)
} else { } else {
newnp, err := lbc.checkSvcForUpdate(s) newnp, err := lbc.checkSvcForUpdate(s)
if err != nil { if err != nil {
@ -853,7 +853,7 @@ func (lbc *loadBalancerController) getEndpoints(s *api.Service, servicePort ints
continue continue
} }
targetPort = port targetPort = int32(port)
} }
} }
} }