Merge pull request #2599 from lonelyCZ/pr-clean-client-name
Unify the dynamic client name for work_status_controller
This commit is contained in:
commit
f00b3ebed2
|
@ -305,18 +305,18 @@ func startExecutionController(ctx controllerscontext.Context) (bool, error) {
|
|||
|
||||
func startWorkStatusController(ctx controllerscontext.Context) (bool, error) {
|
||||
workStatusController := &status.WorkStatusController{
|
||||
Client: ctx.Mgr.GetClient(),
|
||||
EventRecorder: ctx.Mgr.GetEventRecorderFor(status.WorkStatusControllerName),
|
||||
RESTMapper: ctx.Mgr.GetRESTMapper(),
|
||||
InformerManager: genericmanager.GetInstance(),
|
||||
StopChan: ctx.StopChan,
|
||||
ObjectWatcher: ctx.ObjectWatcher,
|
||||
PredicateFunc: helper.NewExecutionPredicateOnAgent(),
|
||||
ClusterClientSetFunc: util.NewClusterDynamicClientSetForAgent,
|
||||
ClusterCacheSyncTimeout: ctx.Opts.ClusterCacheSyncTimeout,
|
||||
ConcurrentWorkStatusSyncs: ctx.Opts.ConcurrentWorkSyncs,
|
||||
RateLimiterOptions: ctx.Opts.RateLimiterOptions,
|
||||
ResourceInterpreter: ctx.ResourceInterpreter,
|
||||
Client: ctx.Mgr.GetClient(),
|
||||
EventRecorder: ctx.Mgr.GetEventRecorderFor(status.WorkStatusControllerName),
|
||||
RESTMapper: ctx.Mgr.GetRESTMapper(),
|
||||
InformerManager: genericmanager.GetInstance(),
|
||||
StopChan: ctx.StopChan,
|
||||
ObjectWatcher: ctx.ObjectWatcher,
|
||||
PredicateFunc: helper.NewExecutionPredicateOnAgent(),
|
||||
ClusterDynamicClientSetFunc: util.NewClusterDynamicClientSetForAgent,
|
||||
ClusterCacheSyncTimeout: ctx.Opts.ClusterCacheSyncTimeout,
|
||||
ConcurrentWorkStatusSyncs: ctx.Opts.ConcurrentWorkSyncs,
|
||||
RateLimiterOptions: ctx.Opts.RateLimiterOptions,
|
||||
ResourceInterpreter: ctx.ResourceInterpreter,
|
||||
}
|
||||
workStatusController.RunWorkQueue()
|
||||
if err := workStatusController.SetupWithManager(ctx.Mgr); err != nil {
|
||||
|
|
|
@ -348,18 +348,18 @@ func startExecutionController(ctx controllerscontext.Context) (enabled bool, err
|
|||
func startWorkStatusController(ctx controllerscontext.Context) (enabled bool, err error) {
|
||||
opts := ctx.Opts
|
||||
workStatusController := &status.WorkStatusController{
|
||||
Client: ctx.Mgr.GetClient(),
|
||||
EventRecorder: ctx.Mgr.GetEventRecorderFor(status.WorkStatusControllerName),
|
||||
RESTMapper: ctx.Mgr.GetRESTMapper(),
|
||||
InformerManager: genericmanager.GetInstance(),
|
||||
StopChan: ctx.StopChan,
|
||||
ObjectWatcher: ctx.ObjectWatcher,
|
||||
PredicateFunc: helper.NewExecutionPredicate(ctx.Mgr),
|
||||
ClusterClientSetFunc: util.NewClusterDynamicClientSet,
|
||||
ClusterCacheSyncTimeout: opts.ClusterCacheSyncTimeout,
|
||||
ConcurrentWorkStatusSyncs: opts.ConcurrentWorkSyncs,
|
||||
RateLimiterOptions: ctx.Opts.RateLimiterOptions,
|
||||
ResourceInterpreter: ctx.ResourceInterpreter,
|
||||
Client: ctx.Mgr.GetClient(),
|
||||
EventRecorder: ctx.Mgr.GetEventRecorderFor(status.WorkStatusControllerName),
|
||||
RESTMapper: ctx.Mgr.GetRESTMapper(),
|
||||
InformerManager: genericmanager.GetInstance(),
|
||||
StopChan: ctx.StopChan,
|
||||
ObjectWatcher: ctx.ObjectWatcher,
|
||||
PredicateFunc: helper.NewExecutionPredicate(ctx.Mgr),
|
||||
ClusterDynamicClientSetFunc: util.NewClusterDynamicClientSet,
|
||||
ClusterCacheSyncTimeout: opts.ClusterCacheSyncTimeout,
|
||||
ConcurrentWorkStatusSyncs: opts.ConcurrentWorkSyncs,
|
||||
RateLimiterOptions: ctx.Opts.RateLimiterOptions,
|
||||
ResourceInterpreter: ctx.ResourceInterpreter,
|
||||
}
|
||||
workStatusController.RunWorkQueue()
|
||||
if err := workStatusController.SetupWithManager(ctx.Mgr); err != nil {
|
||||
|
|
|
@ -47,13 +47,13 @@ type WorkStatusController struct {
|
|||
StopChan <-chan struct{}
|
||||
worker util.AsyncWorker // worker process resources periodic from rateLimitingQueue.
|
||||
// ConcurrentWorkStatusSyncs is the number of Work status that are allowed to sync concurrently.
|
||||
ConcurrentWorkStatusSyncs int
|
||||
ObjectWatcher objectwatcher.ObjectWatcher
|
||||
PredicateFunc predicate.Predicate
|
||||
ClusterClientSetFunc func(clusterName string, client client.Client) (*util.DynamicClusterClient, error)
|
||||
ClusterCacheSyncTimeout metav1.Duration
|
||||
RateLimiterOptions ratelimiterflag.Options
|
||||
ResourceInterpreter resourceinterpreter.ResourceInterpreter
|
||||
ConcurrentWorkStatusSyncs int
|
||||
ObjectWatcher objectwatcher.ObjectWatcher
|
||||
PredicateFunc predicate.Predicate
|
||||
ClusterDynamicClientSetFunc func(clusterName string, client client.Client) (*util.DynamicClusterClient, error)
|
||||
ClusterCacheSyncTimeout metav1.Duration
|
||||
RateLimiterOptions ratelimiterflag.Options
|
||||
ResourceInterpreter resourceinterpreter.ResourceInterpreter
|
||||
}
|
||||
|
||||
// Reconcile performs a full reconciliation for the object referred to by the Request.
|
||||
|
@ -462,7 +462,7 @@ func (c *WorkStatusController) getSingleClusterManager(cluster *clusterv1alpha1.
|
|||
// the cache in informer manager should be updated.
|
||||
singleClusterInformerManager := c.InformerManager.GetSingleClusterManager(cluster.Name)
|
||||
if singleClusterInformerManager == nil {
|
||||
dynamicClusterClient, err := c.ClusterClientSetFunc(cluster.Name, c.Client)
|
||||
dynamicClusterClient, err := c.ClusterDynamicClientSetFunc(cluster.Name, c.Client)
|
||||
if err != nil {
|
||||
klog.Errorf("Failed to build dynamic cluster client for cluster %s.", cluster.Name)
|
||||
return nil, err
|
||||
|
|
Loading…
Reference in New Issue