Skip to content

Commit

Permalink
add context to signatures
Browse files Browse the repository at this point in the history
  • Loading branch information
stevenctl committed Jul 24, 2024
1 parent 00b3212 commit c41563c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions projects/gateway2/extensions/extensions.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ import (
// which have Enterprise variants.
type K8sGatewayExtensions interface {
// CreatePluginRegistry exposes the plugins supported by this implementation.
CreatePluginRegistry() registry.PluginRegistry
CreatePluginRegistry(context.Context) registry.PluginRegistry

// GetTranslator allows an extension to provide custom translation for
// different gateway classes.
GetTranslator(*apiv1.Gateway, registry.PluginRegistry) translator.K8sGwTranslator
GetTranslator(context.Context, *apiv1.Gateway, registry.PluginRegistry) translator.K8sGwTranslator
}

// K8sGatewayExtensionsFactoryParameters contains the parameters required to start Gloo K8s Gateway Extensions (including Translator Plugins)
Expand Down Expand Up @@ -69,11 +69,11 @@ type k8sGatewayExtensions struct {
queries query.GatewayQueries
}

func (e *k8sGatewayExtensions) GetTranslator(_ *apiv1.Gateway, pluginRegistry registry.PluginRegistry) translator.K8sGwTranslator {
func (e *k8sGatewayExtensions) GetTranslator(_ context.Context, _ *apiv1.Gateway, pluginRegistry registry.PluginRegistry) translator.K8sGwTranslator {
return translator.NewTranslator(e.queries, pluginRegistry)
}

func (e *k8sGatewayExtensions) CreatePluginRegistry() registry.PluginRegistry {
func (e *k8sGatewayExtensions) CreatePluginRegistry(_ context.Context) registry.PluginRegistry {
plugins := registry.BuildPlugins(
e.queries,
e.mgr.GetClient(),
Expand Down
4 changes: 2 additions & 2 deletions projects/gateway2/proxy_syncer/proxy_syncer.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ func (s *ProxySyncer) Start(ctx context.Context) error {
return
}

pluginRegistry := s.k8sGwExtensions.CreatePluginRegistry()
pluginRegistry := s.k8sGwExtensions.CreatePluginRegistry(ctx)
rm := reports.NewReportMap()
r := reports.NewReporter(&rm)

Expand All @@ -123,7 +123,7 @@ func (s *ProxySyncer) Start(ctx context.Context) error {
translatedGateways []gwplugins.TranslatedGateway
)
for _, gw := range gwl.Items {
gatewayTranslator := s.k8sGwExtensions.GetTranslator(&gw, pluginRegistry)
gatewayTranslator := s.k8sGwExtensions.GetTranslator(ctx, &gw, pluginRegistry)
if gatewayTranslator == nil {
contextutils.LoggerFrom(ctx).Errorf("no translator found for Gateway %s (gatewayClass %s)", gw.Name, gw.Spec.GatewayClassName)
continue
Expand Down

0 comments on commit c41563c

Please sign in to comment.