operator: allow setting concurrent cluster reconciles

The cephcluster controller allows setting concurrent reconciles
with a setting in the operator configmap.

Signed-off-by: Travis Nielsen <tnielsen@redhat.com>
This commit is contained in:
Travis Nielsen committed 2025-11-17 11:46:33 -07:00
1 parent f252bf68af
commit b1ce9f226e
3 files changed
+23 -1

No files matched your search

+5
View File
@@ -3,3 +3,8 @@
## Breaking Changes
## Features
- Experimental: Allow concurrent reconciles of the CephCluster CR when there multiple clusters
being managed by the same Rook operator. Concurrency is enabled by increasing
the operator setting `ROOK_RECONCILE_CONCURRENT_CLUSTERS` to a value greater
than `1`.
+8
View File
@@ -636,6 +636,14 @@ spec:
- name: ROOK_CURRENT_NAMESPACE_ONLY
value: "false"
# Experimental: The number of Ceph clusters to reconcile in parallel.
# The default is 1, which means each cluster is reconciled sequentially within the operator.
# When set to a value greater than 1, the operator can reconcile multiple clusters concurrently,
# and all logging will be interleaved in the same operator log.
# Changing this value requires restarting the operator pod.
- name: ROOK_RECONCILE_CONCURRENT_CLUSTERS
value: "1"
# Whether to start pods as privileged that mount a host path, which includes the Ceph mon, osd pods and csi provisioners(if logrotation is on).
# Set this to true if SELinux is enabled (e.g. OpenShift) to workaround the anyuid issues.
# For more details see https://github.com/rook/rook/issues/1314#issuecomment-355799641
+10 -1
View File
@@ -20,6 +20,8 @@ package cluster
import (
"context"
"fmt"
"os"
"strconv"
csiopv1 "github.com/ceph/ceph-csi-operator/api/v1"
"github.com/coreos/pkg/capnslog"
@@ -143,8 +145,15 @@ func watchOwnedCoreObject[T client.Object](c controller.Controller, mgr manager.
}
func add(opManagerContext context.Context, mgr manager.Manager, r reconcile.Reconciler, context *clusterd.Context, opConfig opcontroller.OperatorConfig) error {
concurrentClusters := os.Getenv("ROOK_RECONCILE_CONCURRENT_CLUSTERS")
concurrentReconciles := 1
if i, err := strconv.Atoi(concurrentClusters); err == nil && i > 1 {
logger.Infof("Setting concurrent cluster reconciles to %d", i)
concurrentReconciles = i
}
// Create a new controller
c, err := controller.New(controllerName, mgr, controller.Options{Reconciler: r})
c, err := controller.New(controllerName, mgr, controller.Options{Reconciler: r, MaxConcurrentReconciles: concurrentReconciles})
if err != nil {
return err
}