Skip to content

Commit

Permalink
listeners -> httpsListeners
Browse files Browse the repository at this point in the history
  • Loading branch information
kate-osborn committed Dec 13, 2022
1 parent 7da6982 commit 17251e1
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions internal/state/configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -245,23 +245,23 @@ func buildServers(listeners map[string]*listener) (http, ssl []VirtualServer) {
type hostPathRules struct {
rulesPerHost map[string]map[string]PathRule
listenersForHost map[string]*listener
listeners []*listener
httpsListeners []*listener
listenersExist bool
}

func newHostPathRules() *hostPathRules {
return &hostPathRules{
rulesPerHost: make(map[string]map[string]PathRule),
listenersForHost: make(map[string]*listener),
listeners: make([]*listener, 0),
httpsListeners: make([]*listener, 0),
}
}

func (hpr *hostPathRules) upsertListener(l *listener) {
hpr.listenersExist = true

if l.Source.Protocol == v1beta1.HTTPSProtocolType {
hpr.listeners = append(hpr.listeners, l)
hpr.httpsListeners = append(hpr.httpsListeners, l)
}

for _, r := range l.Routes {
Expand Down Expand Up @@ -309,7 +309,7 @@ func (hpr *hostPathRules) upsertListener(l *listener) {
}

func (hpr *hostPathRules) buildServers() []VirtualServer {
servers := make([]VirtualServer, 0, len(hpr.rulesPerHost)+len(hpr.listeners))
servers := make([]VirtualServer, 0, len(hpr.rulesPerHost)+len(hpr.httpsListeners))

for h, rules := range hpr.rulesPerHost {
s := VirtualServer{
Expand Down Expand Up @@ -340,7 +340,7 @@ func (hpr *hostPathRules) buildServers() []VirtualServer {
servers = append(servers, s)
}

for _, l := range hpr.listeners {
for _, l := range hpr.httpsListeners {
hostname := getListenerHostname(l.Source.Hostname)
// generate a 404 ssl server block for listeners with no routes or listeners with wildcard (match-all) routes
// FIXME(kate-osborn): when we support regex hostnames (e.g. *.example.com)
Expand Down

0 comments on commit 17251e1

Please sign in to comment.