@@ -294,59 +294,60 @@ func (h *eventHandlerImpl) waitForStatusUpdates(ctx context.Context) {
294
294
return
295
295
}
296
296
297
+ // TODO(sberman): once we support multiple Gateways, we'll have to get
298
+ // the correct Graph for the Deployment contained in the update message
297
299
gr := h .cfg .processor .GetLatestGraph ()
298
300
if gr == nil {
299
301
continue
300
302
}
301
303
302
- deploymentName := item .Deployment
303
- gw := gr .Gateways [deploymentName ]
304
-
305
304
var nginxReloadRes graph.NginxReloadResult
306
- switch {
307
- case item .Error != nil :
308
- h .cfg .logger .Error (item .Error , "Failed to update NGINX configuration" )
309
- nginxReloadRes .Error = item .Error
310
- case gw != nil :
311
- h .cfg .logger .Info ("NGINX configuration was successfully updated" )
312
- }
313
- gr .LatestReloadResult [deploymentName ] = nginxReloadRes
314
-
315
- switch item .UpdateType {
316
- case status .UpdateAll :
317
- h .updateStatuses (ctx , gr , gw )
318
- case status .UpdateGateway :
319
- gwAddresses , err := getGatewayAddresses (
320
- ctx ,
321
- h .cfg .k8sClient ,
322
- item .GatewayService ,
323
- gw ,
324
- h .cfg .gatewayClassName ,
325
- )
326
- if err != nil {
327
- msg := "error getting Gateway Service IP address"
328
- h .cfg .logger .Error (err , msg )
329
- h .cfg .eventRecorder .Eventf (
305
+ for _ , gw := range gr .Gateways {
306
+ switch {
307
+ case item .Error != nil :
308
+ h .cfg .logger .Error (item .Error , "Failed to update NGINX configuration" )
309
+ nginxReloadRes .Error = item .Error
310
+ case gw != nil :
311
+ h .cfg .logger .Info ("NGINX configuration was successfully updated" )
312
+ }
313
+ gw .LatestReloadResult = nginxReloadRes
314
+
315
+ switch item .UpdateType {
316
+ case status .UpdateAll :
317
+ h .updateStatuses (ctx , gr , gw )
318
+ case status .UpdateGateway :
319
+ gwAddresses , err := getGatewayAddresses (
320
+ ctx ,
321
+ h .cfg .k8sClient ,
330
322
item .GatewayService ,
331
- v1 .EventTypeWarning ,
332
- "GetServiceIPFailed" ,
333
- msg + ": %s" ,
334
- err .Error (),
323
+ gw ,
324
+ h .cfg .gatewayClassName ,
335
325
)
336
- continue
326
+ if err != nil {
327
+ msg := "error getting Gateway Service IP address"
328
+ h .cfg .logger .Error (err , msg )
329
+ h .cfg .eventRecorder .Eventf (
330
+ item .GatewayService ,
331
+ v1 .EventTypeWarning ,
332
+ "GetServiceIPFailed" ,
333
+ msg + ": %s" ,
334
+ err .Error (),
335
+ )
336
+ continue
337
+ }
338
+
339
+ transitionTime := metav1 .Now ()
340
+
341
+ gatewayStatuses := status .PrepareGatewayRequests (
342
+ gw ,
343
+ transitionTime ,
344
+ gwAddresses ,
345
+ gw .LatestReloadResult ,
346
+ )
347
+ h .cfg .statusUpdater .UpdateGroup (ctx , groupGateways , gatewayStatuses ... )
348
+ default :
349
+ panic (fmt .Sprintf ("unknown event type %T" , item .UpdateType ))
337
350
}
338
-
339
- transitionTime := metav1 .Now ()
340
-
341
- gatewayStatuses := status .PrepareGatewayRequests (
342
- gw ,
343
- transitionTime ,
344
- gwAddresses ,
345
- gr .LatestReloadResult [deploymentName ],
346
- )
347
- h .cfg .statusUpdater .UpdateGroup (ctx , groupGateways , gatewayStatuses ... )
348
- default :
349
- panic (fmt .Sprintf ("unknown event type %T" , item .UpdateType ))
350
351
}
351
352
}
352
353
}
@@ -377,7 +378,7 @@ func (h *eventHandlerImpl) updateStatuses(ctx context.Context, gr *graph.Graph,
377
378
gr .L4Routes ,
378
379
gr .Routes ,
379
380
transitionTime ,
380
- gr . LatestReloadResult [ gw .DeploymentName ] ,
381
+ gw .LatestReloadResult ,
381
382
h .cfg .gatewayCtlrName ,
382
383
)
383
384
@@ -408,7 +409,7 @@ func (h *eventHandlerImpl) updateStatuses(ctx context.Context, gr *graph.Graph,
408
409
gw ,
409
410
transitionTime ,
410
411
gwAddresses ,
411
- gr . LatestReloadResult [ gw .DeploymentName ] ,
412
+ gw .LatestReloadResult ,
412
413
)
413
414
h .cfg .statusUpdater .UpdateGroup (ctx , groupGateways , gwReqs ... )
414
415
}
0 commit comments