fix the same udp port and tcp port, update nginx.conf error

This commit is contained in:
Chen Peng 2017-08-07 11:22:06 +08:00
parent 9b80d3b6b0
commit fa2c422a68

View file

@ -305,7 +305,6 @@ func newIngressController(config *Configuration) *GenericController {
} else { } else {
glog.Warning("Update of ingress status is disabled (flag --update-status=false was specified)") glog.Warning("Update of ingress status is disabled (flag --update-status=false was specified)")
} }
ic.annotations = newAnnotationExtractor(ic) ic.annotations = newAnnotationExtractor(ic)
ic.cfg.Backend.SetListers(ingress.StoreLister{ ic.cfg.Backend.SetListers(ingress.StoreLister{
@ -506,20 +505,24 @@ func (ic *GenericController) getStreamServices(configmapName string, proto api.P
glog.V(3).Infof("searching service %v/%v endpoints using the name '%v'", svcNs, svcName, svcPort) glog.V(3).Infof("searching service %v/%v endpoints using the name '%v'", svcNs, svcName, svcPort)
for _, sp := range svc.Spec.Ports { for _, sp := range svc.Spec.Ports {
if sp.Name == svcPort { if sp.Name == svcPort {
if sp.Protocol == proto {
endps = ic.getEndpoints(svc, &sp, proto, &healthcheck.Upstream{}) endps = ic.getEndpoints(svc, &sp, proto, &healthcheck.Upstream{})
break break
} }
} }
}
} else { } else {
// we need to use the TargetPort (where the endpoints are running) // we need to use the TargetPort (where the endpoints are running)
glog.V(3).Infof("searching service %v/%v endpoints using the target port '%v'", svcNs, svcName, targetPort) glog.V(3).Infof("searching service %v/%v endpoints using the target port '%v'", svcNs, svcName, targetPort)
for _, sp := range svc.Spec.Ports { for _, sp := range svc.Spec.Ports {
if sp.Port == int32(targetPort) { if sp.Port == int32(targetPort) {
if sp.Protocol == proto {
endps = ic.getEndpoints(svc, &sp, proto, &healthcheck.Upstream{}) endps = ic.getEndpoints(svc, &sp, proto, &healthcheck.Upstream{})
break break
} }
} }
} }
}
// stream services cannot contain empty upstreams and there is no // stream services cannot contain empty upstreams and there is no
// default backend equivalent // default backend equivalent