Skip to content

Commit 5bafe05

Browse files
committed
SQUASH: cluster.{AwareRunnable -> Aware}
Signed-off-by: Dr. Stefan Schimanski <[email protected]>
1 parent 6db0f6f commit 5bafe05

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

pkg/builder/controller.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ func (blder *Builder) Build(r reconcile.Reconciler) (controller.Controller, erro
263263

264264
ctrl := blder.ctrl
265265
if *blder.ctrlOptions.EngageWithProviderClusters {
266-
// wrap as cluster.AwareRunnable to be engaged with provider clusters on demand
266+
// wrap as cluster.Aware to be engaged with provider clusters on demand
267267
ctrl = controller.NewMultiClusterController(ctrl, &blder.clusterWatcher)
268268
}
269269
if err := blder.mgr.Add(ctrl); err != nil {

pkg/cluster/cluster.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@ import (
3535
intrec "sigs.k8s.io/controller-runtime/pkg/internal/recorder"
3636
)
3737

38-
// AwareRunnable is an interface that can be implemented by runnable types
39-
// that are cluster-aware.
40-
type AwareRunnable interface {
41-
// Engage gets called when the runnable should start operations for the given Cluster.
38+
// Aware is an interface that can be implemented by components that
39+
// can engage and disengange when clusters are added or removed.
40+
type Aware interface {
41+
// Engage gets called when the component should start operations for the given Cluster.
4242
// The given context is tied to the Cluster's lifecycle and will be cancelled when the
4343
// Cluster is removed or an error occurs.
4444
//
@@ -53,7 +53,7 @@ type AwareRunnable interface {
5353
// `--------'
5454
Engage(context.Context, Cluster) error
5555

56-
// Disengage gets called when the runnable should stop operations for the given Cluster.
56+
// Disengage gets called when the component should stop operations for the given Cluster.
5757
Disengage(context.Context, Cluster) error
5858
}
5959

pkg/controller/multicluster.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import (
2727
// running in. It engage and disengage clusters dynamically, starting the
2828
// watches and stopping them.
2929
type MultiClusterController interface {
30-
cluster.AwareRunnable
30+
cluster.Aware
3131
Controller
3232
}
3333

@@ -65,7 +65,7 @@ func (c *multiClusterController) Engage(clusterCtx context.Context, cl cluster.C
6565
}
6666

6767
// pass through in case the controller itself is cluster aware
68-
if ctrl, ok := c.Controller.(cluster.AwareRunnable); ok {
68+
if ctrl, ok := c.Controller.(cluster.Aware); ok {
6969
if err := ctrl.Engage(clusterCtx, cl); err != nil {
7070
return err
7171
}

pkg/manager/internal.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ type controllerManager struct {
8686

8787
clusterLock sync.RWMutex // protects clusters
8888
clusters map[string]*engagedCluster
89-
clusterAwareRunnables []cluster.AwareRunnable
89+
clusterAwareRunnables []cluster.Aware
9090

9191
// recorderProvider is used to generate event recorders that will be injected into Controllers
9292
// (and EventHandlers, Sources and Predicates).
@@ -193,7 +193,7 @@ func (cm *controllerManager) Add(r Runnable) error {
193193
}
194194

195195
func (cm *controllerManager) add(r Runnable) error {
196-
if aware, ok := r.(cluster.AwareRunnable); ok {
196+
if aware, ok := r.(cluster.Aware); ok {
197197
cm.clusterAwareRunnables = append(cm.clusterAwareRunnables, aware)
198198
}
199199
return cm.runnables.Add(r)

0 commit comments

Comments
 (0)