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 (
|
||||
"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),
|
||||
|
|
Loading…
Reference in a new issue