Skip to content

Commit

Permalink
Merge branch 'main' into K8SPG-586-delete-backups-finalizer
Browse files Browse the repository at this point in the history
  • Loading branch information
inelpandzic authored Jan 2, 2025
2 parents 7634c62 + 78c3d22 commit 04ff7a5
Show file tree
Hide file tree
Showing 3 changed files with 11 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
11 changes: 9 additions & 2 deletions percona/runtime/runtime.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,20 @@ 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,
Scheme: r.Scheme,
LeaderElection: disableLeaderElection,
LeaderElectionID: "08db3feb.percona.com",
}

if disableLeaderElection {
options.LeaderElection = false
options.LeaderElectionID = ""
}

options.BaseContext = func() context.Context {
Expand Down

0 comments on commit 04ff7a5

Please sign in to comment.