Skip to content

Commit 0617f27

Browse files
committed
Index metadata.name for cluster-name label
Signed-off-by: Vince Prignano <[email protected]>
1 parent a9f44d0 commit 0617f27

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

pkg/controller/machine/controller.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@ func newReconciler(mgr manager.Manager, actuator Actuator) reconcile.Reconciler
5858
actuator: actuator,
5959
}
6060

61+
mgr.GetFieldIndexer().IndexField(&clusterv1.Cluster{}, "metadata.name", func(obj runtime.Object) []string {
62+
return []string{obj.(*clusterv1.Cluster).Name}
63+
})
64+
6165
if r.nodeName == "" {
6266
klog.Warningf("environment variable %v is not set, this controller will not protect against deleting its own machine", NodeNameEnvVar)
6367
}

0 commit comments

Comments
 (0)