Skip to content

Commit

Permalink
Merge pull request kubernetes#1413 from aledbf/resolve-external-names
Browse files Browse the repository at this point in the history
Validate external names
  • Loading branch information
aledbf committed Sep 24, 2017
2 parents 27d4e8b + f8b213c commit e43641f
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions core/pkg/ingress/controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package controller
import (
"fmt"
"math/rand"
"net"
"reflect"
"sort"
"strconv"
Expand Down Expand Up @@ -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),
Expand Down

0 comments on commit e43641f

Please sign in to comment.