diff --git a/cmd/postgres-operator/main.go b/cmd/postgres-operator/main.go index 50faf7f2ad..1447b8e8cd 100644 --- a/cmd/postgres-operator/main.go +++ b/cmd/postgres-operator/main.go @@ -27,7 +27,6 @@ import ( "sigs.k8s.io/controller-runtime/pkg/manager" //"github.com/percona/percona-postgresql-operator/internal/controller/pgupgrade" - "github.com/percona/percona-postgresql-operator/internal/controller/pgupgrade" "github.com/percona/percona-postgresql-operator/internal/controller/postgrescluster" "github.com/percona/percona-postgresql-operator/internal/controller/runtime" @@ -106,6 +105,7 @@ func main() { namespaces, cfg, false, + false, features, ) assertNoError(err) diff --git a/percona/controller/pgcluster/controller_test.go b/percona/controller/pgcluster/controller_test.go index e6b3770b71..95642a807e 100644 --- a/percona/controller/pgcluster/controller_test.go +++ b/percona/controller/pgcluster/controller_test.go @@ -484,7 +484,7 @@ var _ = Describe("Watching secrets", Ordered, func() { Expect(err).NotTo(HaveOccurred()) Expect(err).To(Not(HaveOccurred())) - mgr, err := runtime.CreateRuntimeManager(namespace.Name, cfg, true, gate) + mgr, err := runtime.CreateRuntimeManager(namespace.Name, cfg, true, true, gate) Expect(err).To(Succeed()) Expect(v2.AddToScheme(mgr.GetScheme())).To(Succeed()) diff --git a/percona/runtime/runtime.go b/percona/runtime/runtime.go index f8e8181680..6c36603bc3 100644 --- a/percona/runtime/runtime.go +++ b/percona/runtime/runtime.go @@ -19,14 +19,14 @@ var refreshInterval = 60 * time.Minute // CreateRuntimeManager does the same thing as `internal/controller/runtime.CreateRuntimeManager`, // excet it configures the manager to watch multiple namespaces. -func CreateRuntimeManager(namespaces string, config *rest.Config, disableMetrics bool, features feature.MutableGate) (manager.Manager, error) { +func CreateRuntimeManager(namespaces string, config *rest.Config, disableMetrics, disableLeaderElection bool, features feature.MutableGate) (manager.Manager, error) { options := manager.Options{ Cache: cache.Options{ SyncPeriod: &refreshInterval, }, Scheme: r.Scheme, - LeaderElection: true, + LeaderElection: disableLeaderElection, LeaderElectionID: "08db3feb.percona.com", }