Merge pull request #134104 from aditigupta96/refactor-cloud-node-controllers

refactor(controller): Use WithContext variants in cloud node controllers
This commit is contained in:
Kubernetes Prow Robot
2025-09-18 10:32:22 -07:00
committed by GitHub
4 changed files with 3 additions and 4 deletions

View File

@@ -36,7 +36,6 @@ package names
// 2.1. [TODO] logging should use a canonical controller name when referencing a controller (Eg. Starting X, Shutting down X)
// 2.2. [TODO] emitted events should have an EventSource.Component set to the controller name (usually when initializing an EventRecorder)
// 2.3. [TODO] registering ControllerManagerMetrics with ControllerStarted and ControllerStopped
// 2.4. [TODO] calling WaitForNamedCacheSync
// 3. defining controller options for "--help" command or generated documentation
// 3.1. controller name should be used to create a pflag.FlagSet when registering controller options (the name is rendered in a controller flag group header) in options.KubeControllerManagerOptions
// 3.2. when defined flag's help mentions a controller name

View File

@@ -183,7 +183,7 @@ func (r *rangeAllocator) Run(ctx context.Context) {
logger.Info("Starting range CIDR allocator")
defer logger.Info("Shutting down range CIDR allocator")
if !cache.WaitForNamedCacheSync("cidrallocator", ctx.Done(), r.nodesSynced) {
if !cache.WaitForNamedCacheSyncWithContext(ctx, r.nodesSynced) {
return
}

View File

@@ -141,7 +141,7 @@ func (nc *Controller) Run(ctx context.Context) {
klog.FromContext(ctx).Info("Starting ipam controller")
defer klog.FromContext(ctx).Info("Shutting down ipam controller")
if !cache.WaitForNamedCacheSync("node", ctx.Done(), nc.nodeInformerSynced) {
if !cache.WaitForNamedCacheSyncWithContext(ctx, nc.nodeInformerSynced) {
return
}

View File

@@ -464,7 +464,7 @@ func (nc *Controller) Run(ctx context.Context) {
logger.Info("Starting node controller")
defer logger.Info("Shutting down node controller")
if !cache.WaitForNamedCacheSync("taint", ctx.Done(), nc.leaseInformerSynced, nc.nodeInformerSynced, nc.podInformerSynced, nc.daemonSetInformerSynced) {
if !cache.WaitForNamedCacheSyncWithContext(ctx, nc.leaseInformerSynced, nc.nodeInformerSynced, nc.podInformerSynced, nc.daemonSetInformerSynced) {
return
}