Skip to content

Commit

Permalink
Make leader election setting configurable.
Browse files Browse the repository at this point in the history
  • Loading branch information
inelpandzic committed Dec 24, 2024
1 parent df44034 commit 0161b4c
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion cmd/postgres-operator/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -106,6 +105,7 @@ func main() {
namespaces,
cfg,
false,
false,
features,
)
assertNoError(err)
Expand Down
2 changes: 1 addition & 1 deletion percona/controller/pgcluster/controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())

Expand Down
4 changes: 2 additions & 2 deletions percona/runtime/runtime.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
}

Expand Down

0 comments on commit 0161b4c

Please sign in to comment.