Validate external names
@@ -19,6 +19,7 @@ package controller
import (
"fmt"
"math/rand"
+ "net"
"reflect"
"sort"
"strconv"
@@ -1090,6 +1091,14 @@ func (ic *GenericController) getEndpoints(
return upsServers
}
+ if net.ParseIP(s.Spec.ExternalName) == nil {
+ _, err := net.LookupHost(s.Spec.ExternalName)
+ if err != nil {
+ glog.Errorf("unexpected error resolving host %v: %v", s.Spec.ExternalName, err)
+ return upsServers
+ }
+ }
+
return append(upsServers, ingress.Endpoint{
Address: s.Spec.ExternalName,
Port: fmt.Sprintf("%v", targetPort),
