@@ -19,6 +19,7 @@ package main
19
19
import (
20
20
"context"
21
21
"flag"
22
+ "fmt"
22
23
"math/rand"
23
24
"net/http"
24
25
_ "net/http/pprof"
68
69
leaderElectionLeaseDuration time.Duration
69
70
leaderElectionRenewDeadline time.Duration
70
71
leaderElectionRetryPeriod time.Duration
72
+ watchFilterValue string
71
73
watchNamespace string
72
74
profilerAddress string
73
75
kubeadmControlPlaneConcurrency int
@@ -106,6 +108,9 @@ func InitFlags(fs *pflag.FlagSet) {
106
108
fs .DurationVar (& syncPeriod , "sync-period" , 10 * time .Minute ,
107
109
"The minimum interval at which watched resources are reconciled (e.g. 15m)" )
108
110
111
+ fs .StringVar (& watchFilterValue , "watch-filter" , "" ,
112
+ fmt .Sprintf ("Label value that the controller watches to reconcile cluster-api objects. Label key is always %s. If unspecified, the controller watches for all cluster-api objects." , clusterv1 .WatchLabel ))
113
+
109
114
fs .IntVar (& webhookPort , "webhook-port" , 9443 ,
110
115
"Webhook Server port" )
111
116
@@ -193,17 +198,19 @@ func setupReconcilers(ctx context.Context, mgr ctrl.Manager) {
193
198
os .Exit (1 )
194
199
}
195
200
if err := (& remote.ClusterCacheReconciler {
196
- Client : mgr .GetClient (),
197
- Log : ctrl .Log .WithName ("remote" ).WithName ("ClusterCacheReconciler" ),
198
- Tracker : tracker ,
201
+ Client : mgr .GetClient (),
202
+ Log : ctrl .Log .WithName ("remote" ).WithName ("ClusterCacheReconciler" ),
203
+ Tracker : tracker ,
204
+ WatchFilterValue : watchFilterValue ,
199
205
}).SetupWithManager (ctx , mgr , concurrency (kubeadmControlPlaneConcurrency )); err != nil {
200
206
setupLog .Error (err , "unable to create controller" , "controller" , "ClusterCacheReconciler" )
201
207
os .Exit (1 )
202
208
}
203
209
204
210
if err := (& kubeadmcontrolplanecontrollers.KubeadmControlPlaneReconciler {
205
- Client : mgr .GetClient (),
206
- Tracker : tracker ,
211
+ Client : mgr .GetClient (),
212
+ Tracker : tracker ,
213
+ WatchFilterValue : watchFilterValue ,
207
214
}).SetupWithManager (ctx , mgr , concurrency (kubeadmControlPlaneConcurrency )); err != nil {
208
215
setupLog .Error (err , "unable to create controller" , "controller" , "KubeadmControlPlane" )
209
216
os .Exit (1 )
0 commit comments