Skip to content

Commit

Permalink
source: Drop spec.host check from OCP Route impl
Browse files Browse the repository at this point in the history
On OpenShift, a route resource cannot have the
`spec.host` field be set to the empty string. This commit clarifies
the FQDN template logic in the OCP Route source implementation
by removing the explicit `spec.host` check and adding comments.

Signed-off-by: Stephen Greene <sgreene@redhat.com>
  • Loading branch information
sgreene570 committed Jun 28, 2021
1 parent d273066 commit b24b8d0
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions source/ocproute.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,12 @@ func (ors *ocpRouteSource) Endpoints(ctx context.Context) ([]*endpoint.Endpoint,

orEndpoints := endpointsFromOcpRoute(ocpRoute, ors.ignoreHostnameAnnotation)

// apply template if host is missing on OpenShift Route
if (ors.combineFQDNAnnotation || len(orEndpoints) == 0) && ors.fqdnTemplate != nil {
// apply template if combineFQDNAnnotation is set
// and if we have a fqdnTemplate.
// A route's spec.host field cannot be empty, so checking
// that field when determining whether or not to use the fqdn
// template is futile.
if ors.combineFQDNAnnotation && ors.fqdnTemplate != nil {
oEndpoints, err := ors.endpointsFromTemplate(ocpRoute)
if err != nil {
return nil, err
Expand Down

0 comments on commit b24b8d0

Please sign in to comment.