You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
for _, servicePort := range svc.Spec.Ports {
// targetPort could be a string, use the name or the port (int)
if strconv.Itoa(int(servicePort.Port)) == backendPort ||
servicePort.TargetPort.String() == backendPort ||
servicePort.Name == backendPort {
So backendPort is the backendPort of the ingress. We match against the service's exposed port (good), or the service's Name (good) or the service's TargetPort (which I think is wrong, but is not the issue here).
endps := ic.getEndpoints(svc, servicePort.TargetPort, api.ProtocolTCP, hz)
if len(endps) == 0 {
glog.Warningf("service %v does not have any active endpoints", svcKey)
}
We then get the endpoints using servicePort.TargetPort ... but that is not correct. It should be servicePort.Name, because it is the service port Name that is stored in the Endpoint, not the targetport Name.
We were hitting the "no endpoints for X" issue after upgrading from beta.5 to beta.7.
I think the problem is that there are too many names floating around, but I think that actually ingress has made a mistake here: https://github.com/kubernetes/ingress/blob/master/core/pkg/ingress/controller/controller.go#L840-L848
So backendPort is the backendPort of the ingress. We match against the service's exposed port (good), or the service's Name (good) or the service's TargetPort (which I think is wrong, but is not the issue here).
We then get the endpoints using servicePort.TargetPort ... but that is not correct. It should be servicePort.Name, because it is the service port Name that is stored in the Endpoint, not the targetport Name.
https://github.com/kubernetes/kubernetes/blob/master/pkg/api/types.go#L2833-L2835
Also note that there might be no name at all, if the service only defines a single port.
(For the record, I also thought it was the TargetPort in the Endpoint)
The text was updated successfully, but these errors were encountered: