Merge pull request #113471 from ncdc/gc-contextual-logging

garbagecollector: use contextual logging
This commit is contained in:
Kubernetes Prow Robot
2023-03-10 04:34:39 -08:00
committed by GitHub
8 changed files with 253 additions and 123 deletions

View File

@@ -506,6 +506,8 @@ func startGarbageCollectorController(ctx context.Context, controllerContext Cont
return nil, false, nil
}
ctx = klog.NewContext(ctx, klog.LoggerWithName(klog.FromContext(ctx), "garbagecollector"))
gcClientset := controllerContext.ClientBuilder.ClientOrDie("generic-garbage-collector")
discoveryClient := controllerContext.ClientBuilder.DiscoveryClientOrDie("generic-garbage-collector")
@@ -540,7 +542,7 @@ func startGarbageCollectorController(ctx context.Context, controllerContext Cont
// Periodically refresh the RESTMapper with new discovery information and sync
// the garbage collector.
go garbageCollector.Sync(discoveryClient, 30*time.Second, ctx.Done())
go garbageCollector.Sync(ctx, discoveryClient, 30*time.Second)
return garbageCollector, true, nil
}