@@ -307,7 +307,8 @@ func WatchGPUNodes(ctx context.Context, clientset kubernetes.Interface) (<-chan
307307 return clientset .CoreV1 ().Nodes ().Watch (ctx , opts )
308308 },
309309 )
310- openers := []func (context.Context ) (watch.Interface , error ){nodeOpener }
310+ openers := make ([]func (context.Context ) (watch.Interface , error ), 0 , 1 + len (gpuPodSelectors ))
311+ openers = append (openers , nodeOpener )
311312 openers = append (openers , gpuPodWatchOpeners (clientset )... )
312313 return watchTrigger (ctx , DebounceWindow , openers ... )
313314}
@@ -320,10 +321,8 @@ func WatchGPUWorkloads(ctx context.Context, clientset kubernetes.Interface) (<-c
320321// WatchDedicatedAIClusters triggers on DAC CR changes (both API
321322// versions) plus GPU pod changes (pods drive replica stats).
322323func WatchDedicatedAIClusters (ctx context.Context , client dynamic.Interface , clientset kubernetes.Interface ) (<- chan struct {}, error ) {
323- openers := []func (context.Context ) (watch.Interface , error ){
324- crWatchOpener (client , dacV1GVR ),
325- crWatchOpener (client , dacV2GVR ),
326- }
324+ openers := make ([]func (context.Context ) (watch.Interface , error ), 0 , 2 + len (gpuPodSelectors ))
325+ openers = append (openers , crWatchOpener (client , dacV1GVR ), crWatchOpener (client , dacV2GVR ))
327326 openers = append (openers , gpuPodWatchOpeners (clientset )... )
328327 return watchTrigger (ctx , DebounceWindow , openers ... )
329328}
0 commit comments