diff --git a/pkg/builder/controller.go b/pkg/builder/controller.go index 10e1b5ecf5..92504d9d34 100644 --- a/pkg/builder/controller.go +++ b/pkg/builder/controller.go @@ -263,7 +263,7 @@ func (blder *Builder) Build(r reconcile.Reconciler) (controller.Controller, erro ctrl := blder.ctrl if *blder.ctrlOptions.EngageWithProviderClusters { - // wrap as cluster.AwareRunnable to be engaged with provider clusters on demand + // wrap as cluster.Aware to be engaged with provider clusters on demand ctrl = controller.NewMultiClusterController(ctrl, &blder.clusterWatcher) } if err := blder.mgr.Add(ctrl); err != nil { diff --git a/pkg/cluster/cluster.go b/pkg/cluster/cluster.go index 730299d31e..0e92697989 100644 --- a/pkg/cluster/cluster.go +++ b/pkg/cluster/cluster.go @@ -35,10 +35,10 @@ import ( intrec "sigs.k8s.io/controller-runtime/pkg/internal/recorder" ) -// AwareRunnable is an interface that can be implemented by runnable types -// that are cluster-aware. -type AwareRunnable interface { - // Engage gets called when the runnable should start operations for the given Cluster. +// Aware is an interface that can be implemented by components that +// can engage and disengange when clusters are added or removed. +type Aware interface { + // Engage gets called when the component should start operations for the given Cluster. // The given context is tied to the Cluster's lifecycle and will be cancelled when the // Cluster is removed or an error occurs. // @@ -53,7 +53,7 @@ type AwareRunnable interface { // `--------' Engage(context.Context, Cluster) error - // Disengage gets called when the runnable should stop operations for the given Cluster. + // Disengage gets called when the component should stop operations for the given Cluster. Disengage(context.Context, Cluster) error } diff --git a/pkg/controller/multicluster.go b/pkg/controller/multicluster.go index fcabeae104..078834f9e3 100644 --- a/pkg/controller/multicluster.go +++ b/pkg/controller/multicluster.go @@ -27,7 +27,7 @@ import ( // running in. It engage and disengage clusters dynamically, starting the // watches and stopping them. type MultiClusterController interface { - cluster.AwareRunnable + cluster.Aware Controller } @@ -65,7 +65,7 @@ func (c *multiClusterController) Engage(clusterCtx context.Context, cl cluster.C } // pass through in case the controller itself is cluster aware - if ctrl, ok := c.Controller.(cluster.AwareRunnable); ok { + if ctrl, ok := c.Controller.(cluster.Aware); ok { if err := ctrl.Engage(clusterCtx, cl); err != nil { return err } diff --git a/pkg/manager/internal.go b/pkg/manager/internal.go index e258ef935e..c1801c27d1 100644 --- a/pkg/manager/internal.go +++ b/pkg/manager/internal.go @@ -86,7 +86,7 @@ type controllerManager struct { clusterLock sync.RWMutex // protects clusters clusters map[string]*engagedCluster - clusterAwareRunnables []cluster.AwareRunnable + clusterAwareRunnables []cluster.Aware // recorderProvider is used to generate event recorders that will be injected into Controllers // (and EventHandlers, Sources and Predicates). @@ -193,7 +193,7 @@ func (cm *controllerManager) Add(r Runnable) error { } func (cm *controllerManager) add(r Runnable) error { - if aware, ok := r.(cluster.AwareRunnable); ok { + if aware, ok := r.(cluster.Aware); ok { cm.clusterAwareRunnables = append(cm.clusterAwareRunnables, aware) } return cm.runnables.Add(r)