Skip to content

Commit 4ff441a

Browse files
authored
chore: rename runner methods that no longer subscribe (#7164)
Signed-off-by: Rudrakh Panigrahi <[email protected]>
1 parent c7cc6ce commit 4ff441a

File tree

7 files changed

+11
-12
lines changed

7 files changed

+11
-12
lines changed

internal/globalratelimit/runner/runner.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ func (r *Runner) Start(ctx context.Context) (err error) {
102102
// Do not call .Subscribe() inside Goroutine since it is supposed to be called from the same
103103
// Goroutine where Close() is called.
104104
c := r.XdsIR.Subscribe(ctx)
105-
go r.subscribeAndTranslate(ctx, c)
105+
go r.translateFromSubscription(ctx, c)
106106

107107
r.Logger.Info("started")
108108
return
@@ -136,7 +136,7 @@ func buildXDSResourceFromCache(rateLimitConfigsCache map[string][]cachetype.Reso
136136
return xdsResourcesToUpdate
137137
}
138138

139-
func (r *Runner) subscribeAndTranslate(ctx context.Context, c <-chan watchable.Snapshot[string, *ir.Xds]) {
139+
func (r *Runner) translateFromSubscription(ctx context.Context, c <-chan watchable.Snapshot[string, *ir.Xds]) {
140140
// rateLimitConfigsCache is a cache of the rate limit config, which is keyed by the xdsIR key.
141141
rateLimitConfigsCache := map[string][]cachetype.Resource{}
142142

internal/globalratelimit/runner/runner_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ func Test_subscribeAndTranslate(t *testing.T) {
220220
})
221221

222222
c := xdsIR.Subscribe(ctx)
223-
go r.subscribeAndTranslate(ctx, c)
223+
go r.translateFromSubscription(ctx, c)
224224

225225
for _, xds := range tt.xdsIRs {
226226
if xds.Delete {

internal/infrastructure/runner/runner.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ func (r *Runner) Start(ctx context.Context) (err error) {
6161
subscribeInitInfraAndCloseInfraIRMessage := func() {
6262
// Subscribe and Close in same goroutine to avoid race condition.
6363
sub := r.InfraIR.Subscribe(ctx)
64-
go r.subscribeToProxyInfraIR(ctx, sub)
64+
go r.updateProxyInfraFromSubscription(ctx, sub)
6565

6666
// Enable global ratelimit if it has been configured.
6767
if r.EnvoyGateway.RateLimit != nil {
@@ -102,7 +102,7 @@ func (r *Runner) Start(ctx context.Context) (err error) {
102102
return
103103
}
104104

105-
func (r *Runner) subscribeToProxyInfraIR(ctx context.Context, sub <-chan watchable.Snapshot[string, *ir.Infra]) {
105+
func (r *Runner) updateProxyInfraFromSubscription(ctx context.Context, sub <-chan watchable.Snapshot[string, *ir.Infra]) {
106106
// Subscribe to resources
107107
message.HandleSubscription(message.Metadata{Runner: r.Name(), Message: message.InfraIRMessageName}, sub,
108108
func(update message.Update[string, *ir.Infra], errChan chan error) {

internal/provider/kubernetes/controller.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ func newGatewayAPIController(ctx context.Context, mgr manager.Manager, cfg *conf
203203
// Subscribe to resource updates
204204
r.subscribeToResources(ctx)
205205
// Update status
206-
go r.subscribeAndUpdateStatus(ctx, cfg.EnvoyGateway.ExtensionManager != nil)
206+
go r.updateStatusFromSubscriptions(ctx, cfg.EnvoyGateway.ExtensionManager != nil)
207207
r.log.Info("started")
208208
// Close resources if the context is done.
209209
<-ctx.Done()

internal/provider/kubernetes/controller_offline.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ func NewOfflineGatewayAPIController(
100100
r.subscribeToResources(ctx)
101101

102102
if su != nil {
103-
r.subscribeAndUpdateStatus(ctx, cfg.EnvoyGateway.ExtensionManager != nil)
103+
r.updateStatusFromSubscriptions(ctx, cfg.EnvoyGateway.ExtensionManager != nil)
104104
}
105105

106106
return &OfflineGatewayAPIReconciler{

internal/provider/kubernetes/status.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,8 @@ import (
2323
"github.com/envoyproxy/gateway/internal/utils"
2424
)
2525

26-
// subscribeAndUpdateStatus subscribes to gateway API object status updates and
27-
// writes it into the Kubernetes API Server.
28-
func (r *gatewayAPIReconciler) subscribeAndUpdateStatus(ctx context.Context, extensionManagerEnabled bool) {
26+
// updateStatusFromSubscriptions writes gateway API object status updates to the Kubernetes API server.
27+
func (r *gatewayAPIReconciler) updateStatusFromSubscriptions(ctx context.Context, extensionManagerEnabled bool) {
2928
// GatewayClass object status updater
3029
go func() {
3130
message.HandleSubscription(

internal/xds/runner/runner.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ func (r *Runner) Start(ctx context.Context) (err error) {
182182
// Do not call .Subscribe() inside Goroutine since it is supposed to be called from the same
183183
// Goroutine where Close() is called.
184184
sub := r.XdsIR.Subscribe(ctx)
185-
go r.subscribeAndTranslate(sub)
185+
go r.translateFromSubscription(sub)
186186
r.Logger.Info("started")
187187
return
188188
}
@@ -223,7 +223,7 @@ func registerServer(srv serverv3.Server, g *grpc.Server) {
223223
runtimev3.RegisterRuntimeDiscoveryServiceServer(g, srv)
224224
}
225225

226-
func (r *Runner) subscribeAndTranslate(sub <-chan watchable.Snapshot[string, *ir.Xds]) {
226+
func (r *Runner) translateFromSubscription(sub <-chan watchable.Snapshot[string, *ir.Xds]) {
227227
// Subscribe to resources
228228
message.HandleSubscription(message.Metadata{Runner: r.Name(), Message: message.XDSIRMessageName}, sub,
229229
func(update message.Update[string, *ir.Xds], errChan chan error) {

0 commit comments

Comments
 (0)