Skip to content

Commit 0da913c

Browse files
egeguneshors
andauthored
K8SPSMDB-1318: Support concurrent reconciles (#1938)
Co-authored-by: Viacheslav Sarzhan <slava.sarzhan@percona.com>
1 parent a2cf493 commit 0da913c

File tree

5 files changed

+26
-0
lines changed

5 files changed

+26
-0
lines changed

cmd/manager/main.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import (
2727
"sigs.k8s.io/controller-runtime/pkg/webhook"
2828

2929
"github.com/percona/percona-server-mongodb-operator/pkg/apis"
30+
psmdbv1 "github.com/percona/percona-server-mongodb-operator/pkg/apis/psmdb/v1"
3031
"github.com/percona/percona-server-mongodb-operator/pkg/controller"
3132
"github.com/percona/percona-server-mongodb-operator/pkg/k8s"
3233
"github.com/percona/percona-server-mongodb-operator/pkg/mcs"
@@ -103,6 +104,23 @@ func main() {
103104
}),
104105
}
105106

107+
options.Controller.GroupKindConcurrency = map[string]int{
108+
"PerconaServerMongoDB." + psmdbv1.SchemeGroupVersion.Group: 1,
109+
"PerconaServerMongoDBBackup." + psmdbv1.SchemeGroupVersion.Group: 1,
110+
"PerconaServerMongoDBRestore." + psmdbv1.SchemeGroupVersion.Group: 1,
111+
}
112+
113+
if s := os.Getenv("MAX_CONCURRENT_RECONCILES"); s != "" {
114+
if i, err := strconv.Atoi(s); err == nil && i > 0 {
115+
options.Controller.GroupKindConcurrency["PerconaServerMongoDB."+psmdbv1.SchemeGroupVersion.Group] = i
116+
options.Controller.GroupKindConcurrency["PerconaServerMongoDBBackup."+psmdbv1.SchemeGroupVersion.Group] = i
117+
options.Controller.GroupKindConcurrency["PerconaServerMongoDBRestore."+psmdbv1.SchemeGroupVersion.Group] = i
118+
} else {
119+
setupLog.Error(err, "MAX_CONCURRENT_RECONCILES must be a positive number")
120+
os.Exit(1)
121+
}
122+
}
123+
106124
// Add support for MultiNamespace set in WATCH_NAMESPACE
107125
if len(namespace) > 0 {
108126
namespaces := make(map[string]cache.Config)

deploy/bundle.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19842,3 +19842,5 @@ spec:
1984219842
value: 5s
1984319843
- name: DISABLE_TELEMETRY
1984419844
value: "false"
19845+
- name: MAX_CONCURRENT_RECONCILES
19846+
value: "1"

deploy/cw-bundle.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19861,3 +19861,5 @@ spec:
1986119861
value: 5s
1986219862
- name: DISABLE_TELEMETRY
1986319863
value: "false"
19864+
- name: MAX_CONCURRENT_RECONCILES
19865+
value: "1"

deploy/cw-operator.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,5 @@ spec:
4646
value: 5s
4747
- name: DISABLE_TELEMETRY
4848
value: "false"
49+
- name: MAX_CONCURRENT_RECONCILES
50+
value: "1"

deploy/operator.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,5 @@ spec:
4848
value: 5s
4949
- name: DISABLE_TELEMETRY
5050
value: "false"
51+
- name: MAX_CONCURRENT_RECONCILES
52+
value: "1"

0 commit comments

Comments
 (0)