Skip to content

Commit

Permalink
Validate external names
Browse files Browse the repository at this point in the history
  • Loading branch information
aledbf committed Sep 24, 2017
1 parent 27d4e8b commit f8b213c
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 f8b213c

Please sign in to comment.