Merge pull request #1413 from aledbf/resolve-external-names
Validate external names
This commit is contained in:
commit
e43641f7c0
1 changed files with 9 additions and 0 deletions
|
@ -19,6 +19,7 @@ package controller
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"math/rand"
|
"math/rand"
|
||||||
|
"net"
|
||||||
"reflect"
|
"reflect"
|
||||||
"sort"
|
"sort"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
@ -1090,6 +1091,14 @@ func (ic *GenericController) getEndpoints(
|
||||||
return upsServers
|
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{
|
return append(upsServers, ingress.Endpoint{
|
||||||
Address: s.Spec.ExternalName,
|
Address: s.Spec.ExternalName,
|
||||||
Port: fmt.Sprintf("%v", targetPort),
|
Port: fmt.Sprintf("%v", targetPort),
|
||||||
|
|
Loading…
Reference in a new issue