mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-07-18 04:54:54 +00:00
Merge pull request #134104 from aditigupta96/refactor-cloud-node-controllers
refactor(controller): Use WithContext variants in cloud node controllers
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user