Skip to content

Move version in event handler #1622

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions internal/mode/static/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,6 @@ type eventHandlerConfig struct {
nginxConfiguredOnStartChecker *nginxConfiguredOnStartChecker
// controlConfigNSName is the NamespacedName of the NginxGateway config for this controller.
controlConfigNSName types.NamespacedName
// version is the current version number of the nginx config.
version int
}

// filterKey is the `kind_namespace_name" of an object being filtered.
Expand Down Expand Up @@ -107,6 +105,9 @@ type eventHandlerImpl struct {

cfg eventHandlerConfig
lock sync.Mutex

// version is the current version number of the nginx config.
version int
}

// newEventHandlerImpl creates a new eventHandlerImpl.
Expand Down Expand Up @@ -177,8 +178,8 @@ func (h *eventHandlerImpl) HandleEventBatch(ctx context.Context, logger logr.Log
}
return
case state.EndpointsOnlyChange:
h.cfg.version++
cfg := dataplane.BuildConfiguration(ctx, graph, h.cfg.serviceResolver, h.cfg.version)
h.version++
cfg := dataplane.BuildConfiguration(ctx, graph, h.cfg.serviceResolver, h.version)

h.setLatestConfiguration(&cfg)

Expand All @@ -188,8 +189,8 @@ func (h *eventHandlerImpl) HandleEventBatch(ctx context.Context, logger logr.Log
cfg,
)
case state.ClusterStateChange:
h.cfg.version++
cfg := dataplane.BuildConfiguration(ctx, graph, h.cfg.serviceResolver, h.cfg.version)
h.version++
cfg := dataplane.BuildConfiguration(ctx, graph, h.cfg.serviceResolver, h.version)

h.setLatestConfiguration(&cfg)

Expand Down