Skip to content

Commit

Permalink
Merge pull request #376 from ngrok/bob/cache
Browse files Browse the repository at this point in the history
Add GatewayClass to cachestore
  • Loading branch information
bobzilladev authored May 16, 2024
2 parents 482d499 + 929a817 commit ef27dd1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
16 changes: 12 additions & 4 deletions internal/store/cachestores.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,9 @@ type CacheStores struct {
ServiceV1 cache.Store

// Gateway API Stores
Gateway cache.Store
HTTPRoute cache.Store
Gateway cache.Store
GatewayClass cache.Store
HTTPRoute cache.Store

// Ngrok Stores
DomainV1 cache.Store
Expand All @@ -59,8 +60,9 @@ func NewCacheStores(logger logr.Logger) CacheStores {
IngressClassV1: cache.NewStore(clusterResourceKeyFunc),
ServiceV1: cache.NewStore(keyFunc),
// Gateway API Stores
Gateway: cache.NewStore(keyFunc),
HTTPRoute: cache.NewStore(keyFunc),
Gateway: cache.NewStore(keyFunc),
GatewayClass: cache.NewStore(keyFunc),
HTTPRoute: cache.NewStore(keyFunc),
// Ngrok Stores
DomainV1: cache.NewStore(keyFunc),
TunnelV1: cache.NewStore(keyFunc),
Expand Down Expand Up @@ -112,6 +114,8 @@ func (c CacheStores) Get(obj runtime.Object) (item interface{}, exists bool, err
return c.HTTPRoute.Get(obj)
case *gatewayv1.Gateway:
return c.Gateway.Get(obj)
case *gatewayv1.GatewayClass:
return c.GatewayClass.Get(obj)

// ----------------------------------------------------------------------------
// Ngrok API Support
Expand Down Expand Up @@ -155,6 +159,8 @@ func (c CacheStores) Add(obj runtime.Object) error {
return c.HTTPRoute.Add(obj)
case *gatewayv1.Gateway:
return c.Gateway.Add(obj)
case *gatewayv1.GatewayClass:
return c.GatewayClass.Add(obj)

// ----------------------------------------------------------------------------
// Ngrok API Support
Expand Down Expand Up @@ -199,6 +205,8 @@ func (c CacheStores) Delete(obj runtime.Object) error {
return c.HTTPRoute.Delete(obj)
case *gatewayv1.Gateway:
return c.Gateway.Delete(obj)
case *gatewayv1.GatewayClass:
return c.GatewayClass.Delete(obj)

// ----------------------------------------------------------------------------
// Ngrok API Support
Expand Down
1 change: 1 addition & 0 deletions internal/store/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -752,6 +752,7 @@ func (d *Driver) calculateHTTPSEdges(ingressDomains *[]ingressv1alpha1.Domain, g
gatewayDomains[string(*listener.Hostname)] = string(*listener.Hostname)
}
if len(gatewayDomains) == 0 {
d.log.Info("no usable domains in gateway, may be missing https listener", "gateway", gtw.Name)
continue
}
for _, httproute := range httproutes {
Expand Down

0 comments on commit ef27dd1

Please sign in to comment.