Skip to content

Commit 27376ec

Browse files
committed
Use unique controller name
1 parent 170a095 commit 27376ec

File tree

4 files changed

+5
-1
lines changed

4 files changed

+5
-1
lines changed

internal/framework/controller/register.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ func defaultConfig() config {
8484
func Register(
8585
ctx context.Context,
8686
objectType ngftypes.ObjectType,
87+
name string,
8788
mgr manager.Manager,
8889
eventCh chan<- interface{},
8990
options ...Option,
@@ -114,7 +115,7 @@ func Register(
114115
forOpts = append(forOpts, ctlrBuilder.OnlyMetadata)
115116
}
116117

117-
builder := ctlr.NewControllerManagedBy(mgr).For(objectType, forOpts...)
118+
builder := ctlr.NewControllerManagedBy(mgr).Named(name).For(objectType, forOpts...)
118119

119120
if cfg.k8sPredicate != nil {
120121
builder = builder.WithEventFilter(cfg.k8sPredicate)

internal/framework/controller/register_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ func TestRegister(t *testing.T) {
139139
return controller.Register(
140140
context.Background(),
141141
test.objectType,
142+
test.msg, // unique controller name for each loop iteration
142143
test.fakes.mgr,
143144
eventCh,
144145
controller.WithNamespacedNameFilter(nsNameFilter),

internal/mode/provisioner/manager.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ func StartManager(cfg Config) error {
9494
if err := controller.Register(
9595
ctx,
9696
regCfg.objectType,
97+
regCfg.objectType.GetObjectKind().GroupVersionKind().Kind,
9798
mgr,
9899
eventCh,
99100
regCfg.options...,

internal/mode/static/manager.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -524,6 +524,7 @@ func registerControllers(
524524
if err := controller.Register(
525525
ctx,
526526
regCfg.objectType,
527+
regCfg.objectType.GetObjectKind().GroupVersionKind().Kind,
527528
mgr,
528529
eventCh,
529530
regCfg.options...,

0 commit comments

Comments
 (0)