proxy/iptables: don't proxy ExternalName services

The API docs say:

	// ServiceTypeExternalName means a service consists of only a reference to
	// an external name that kubedns or equivalent will return as a CNAME
	// record, with no exposing or proxying of any pods involved.

which implies that ExternalName services should be ignored for proxy
purposes.
This commit is contained in:
Dan Williams
2016-12-19 17:12:32 -06:00
parent eae2b8e9ba
commit 433f6830f8
2 changed files with 31 additions and 0 deletions

View File

@@ -471,6 +471,11 @@ func buildServiceMap(allServices []api.Service, oldServiceMap proxyServiceMap) (
glog.V(3).Infof("Skipping service %s due to clusterIP = %q", svcName, service.Spec.ClusterIP)
continue
}
// Even if ClusterIP is set, ServiceTypeExternalName services don't get proxied
if service.Spec.Type == api.ServiceTypeExternalName {
glog.V(3).Infof("Skipping service %s due to Type=ExternalName", svcName)
continue
}
for i := range service.Spec.Ports {
servicePort := &service.Spec.Ports[i]