Remove localhost calls from external names
Signed-off-by: Ricardo Pchevuzinske Katz <ricardo.katz@gmail.com>
This commit is contained in:
parent
22ae0d3848
commit
0dceedfad7
6 changed files with 74 additions and 1 deletions
|
|
@ -50,6 +50,12 @@ func getEndpoints(s *corev1.Service, port *corev1.ServicePort, proto corev1.Prot
|
|||
|
||||
// ExternalName services
|
||||
if s.Spec.Type == corev1.ServiceTypeExternalName {
|
||||
if ip := net.ParseIP(s.Spec.ExternalName); s.Spec.ExternalName == "localhost" ||
|
||||
(ip != nil && ip.IsLoopback()) {
|
||||
klog.Errorf("Invalid attempt to use localhost name %s in %q", s.Spec.ExternalName, svcKey)
|
||||
return upsServers
|
||||
}
|
||||
|
||||
klog.V(3).Infof("Ingress using Service %q of type ExternalName.", svcKey)
|
||||
targetPort := port.TargetPort.IntValue()
|
||||
// if the externalName is not an IP address we need to validate is a valid FQDN
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue