Skip to content

K8SPSMDB-1318: Support concurrent reconciles #1938

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions cmd/manager/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import (
"sigs.k8s.io/controller-runtime/pkg/webhook"

"github.com/percona/percona-server-mongodb-operator/pkg/apis"
psmdbv1 "github.com/percona/percona-server-mongodb-operator/pkg/apis/psmdb/v1"
"github.com/percona/percona-server-mongodb-operator/pkg/controller"
"github.com/percona/percona-server-mongodb-operator/pkg/k8s"
"github.com/percona/percona-server-mongodb-operator/pkg/mcs"
Expand Down Expand Up @@ -103,6 +104,23 @@ func main() {
}),
}

options.Controller.GroupKindConcurrency = map[string]int{
"PerconaServerMongoDB." + psmdbv1.SchemeGroupVersion.Group: 1,
"PerconaServerMongoDBBackup." + psmdbv1.SchemeGroupVersion.Group: 1,
"PerconaServerMongoDBRestore." + psmdbv1.SchemeGroupVersion.Group: 1,
}

if s := os.Getenv("MAX_CONCURRENT_RECONCILES"); s != "" {
if i, err := strconv.Atoi(s); err == nil && i > 0 {
options.Controller.GroupKindConcurrency["PerconaServerMongoDB."+psmdbv1.SchemeGroupVersion.Group] = i
options.Controller.GroupKindConcurrency["PerconaServerMongoDBBackup."+psmdbv1.SchemeGroupVersion.Group] = i
options.Controller.GroupKindConcurrency["PerconaServerMongoDBRestore."+psmdbv1.SchemeGroupVersion.Group] = i
} else {
setupLog.Error(err, "MAX_CONCURRENT_RECONCILES must be a positive number")
os.Exit(1)
}
}

// Add support for MultiNamespace set in WATCH_NAMESPACE
if len(namespace) > 0 {
namespaces := make(map[string]cache.Config)
Expand Down
2 changes: 2 additions & 0 deletions deploy/bundle.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19836,3 +19836,5 @@ spec:
value: 5s
- name: DISABLE_TELEMETRY
value: "false"
- name: MAX_CONCURRENT_RECONCILES
value: "1"
2 changes: 2 additions & 0 deletions deploy/cw-bundle.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19855,3 +19855,5 @@ spec:
value: 5s
- name: DISABLE_TELEMETRY
value: "false"
- name: MAX_CONCURRENT_RECONCILES
value: "1"
2 changes: 2 additions & 0 deletions deploy/cw-operator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,5 @@ spec:
value: 5s
- name: DISABLE_TELEMETRY
value: "false"
- name: MAX_CONCURRENT_RECONCILES
value: "1"
2 changes: 2 additions & 0 deletions deploy/operator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,5 @@ spec:
value: 5s
- name: DISABLE_TELEMETRY
value: "false"
- name: MAX_CONCURRENT_RECONCILES
value: "1"
Loading