@@ -129,37 +129,38 @@ func (s *LabelSelectorValue) Type() string {
129129
130130func Command () * cobra.Command {
131131 var (
132- clusterDomain string
133- metricsAddr string
134- secureMetrics bool
135- enableHTTP2 bool
136- probeAddr string
137- pprofAddr string
138- enableLeaderElection bool
139- webhookEnabled bool
140- configuratorBaseImage string
141- configuratorTag string
142- configuratorImagePullPolicy string
143- decommissionWaitInterval time.Duration
144- metricsTimeout time.Duration
145- restrictToRedpandaVersion string
146- namespace string
147- additionalControllers []string
148- operatorMode bool
149- enableHelmControllers bool
150- ghostbuster bool
151- unbindPVCsAfter time.Duration
152- unbinderSelector LabelSelectorValue
153- autoDeletePVCs bool
154- forceDefluxedMode bool
155- helmRepositoryURL string
156- webhookCertPath string
157- webhookCertName string
158- webhookCertKey string
159- metricsCertPath string
160- metricsCertName string
161- metricsCertKey string
162- enableGhostBrokerDecommissioner bool
132+ clusterDomain string
133+ metricsAddr string
134+ secureMetrics bool
135+ enableHTTP2 bool
136+ probeAddr string
137+ pprofAddr string
138+ enableLeaderElection bool
139+ webhookEnabled bool
140+ configuratorBaseImage string
141+ configuratorTag string
142+ configuratorImagePullPolicy string
143+ decommissionWaitInterval time.Duration
144+ metricsTimeout time.Duration
145+ restrictToRedpandaVersion string
146+ namespace string
147+ additionalControllers []string
148+ operatorMode bool
149+ enableHelmControllers bool
150+ ghostbuster bool
151+ unbindPVCsAfter time.Duration
152+ unbinderSelector LabelSelectorValue
153+ autoDeletePVCs bool
154+ forceDefluxedMode bool
155+ helmRepositoryURL string
156+ webhookCertPath string
157+ webhookCertName string
158+ webhookCertKey string
159+ metricsCertPath string
160+ metricsCertName string
161+ metricsCertKey string
162+ enableGhostBrokerDecommissioner bool
163+ ghostBrokerDecommissionerSyncPeriod time.Duration
163164 )
164165
165166 cmd := & cobra.Command {
@@ -201,6 +202,7 @@ func Command() *cobra.Command {
201202 metricsCertName ,
202203 metricsCertKey ,
203204 enableGhostBrokerDecommissioner ,
205+ ghostBrokerDecommissionerSyncPeriod ,
204206 )
205207 },
206208 }
@@ -246,6 +248,7 @@ func Command() *cobra.Command {
246248 cmd .Flags ().StringVar (& metricsCertName , "metrics-cert-name" , "tls.crt" , "The name of the metrics server certificate file." )
247249 cmd .Flags ().StringVar (& metricsCertKey , "metrics-cert-key" , "tls.key" , "The name of the metrics server key file." )
248250 cmd .Flags ().BoolVar (& enableGhostBrokerDecommissioner , "enable-ghost-broker-decommissioner" , false , "Enable ghost broker decommissioner." )
251+ cmd .Flags ().DurationVar (& ghostBrokerDecommissionerSyncPeriod , "ghost-broker-decommissioner-sync-period" , time .Minute * 5 , "Ghost broker sync period. The Ghost Broker Decommissioner is guaranteed to be called after this period." )
249252
250253 // 3rd party flags.
251254 clientOptions .BindFlags (cmd .Flags ())
@@ -307,6 +310,7 @@ func Run(
307310 metricsCertName string ,
308311 metricsCertKey string ,
309312 enableGhostBrokerDecommissioner bool ,
313+ ghostBrokerDecommissionerSyncPeriod time.Duration ,
310314) error {
311315 setupLog := ctrl .LoggerFrom (ctx ).WithName ("setup" )
312316
@@ -671,6 +675,7 @@ func Run(
671675
672676 if enableGhostBrokerDecommissioner {
673677 d := decommissioning .NewStatefulSetDecommissioner (mgr , & v1Fetcher {client : mgr .GetClient ()},
678+ decommissioning .WithSyncPeriod (ghostBrokerDecommissionerSyncPeriod ),
674679 decommissioning .WithCleanupPVCs (false ),
675680 decommissioning .WithFactory (internalclient .NewFactory (mgr .GetConfig (), mgr .GetClient ())),
676681 decommissioning .WithFilter (func (ctx context.Context , sts * appsv1.StatefulSet ) (bool , error ) {
0 commit comments