88 "context"
99 "fmt"
1010 "io"
11- "os"
1211 "time"
1312
1413 "github.com/pkg/errors"
@@ -17,6 +16,7 @@ import (
1716 "k8s.io/apimachinery/pkg/util/intstr"
1817 "sigs.k8s.io/controller-runtime/pkg/client"
1918
19+ "github.com/percona/percona-postgresql-operator/internal/feature"
2020 "github.com/percona/percona-postgresql-operator/internal/initialize"
2121 "github.com/percona/percona-postgresql-operator/internal/logging"
2222 "github.com/percona/percona-postgresql-operator/internal/naming"
@@ -103,8 +103,8 @@ func (r *Reconciler) handlePatroniRestarts(
103103 role = "master"
104104 }
105105
106- // If FEAT_PATRONI_PREFER_HTTP is active , try HTTP first, then fallback
107- if os . Getenv ( "FEAT_PATRONI_PREFER_HTTP" ) == "true" {
106+ // If PatroniPreferHTTP feature is enabled , try HTTP first, then fallback
107+ if feature . Enabled ( ctx , feature . PatroniPreferHTTP ) {
108108 log .Info ("Attempting HTTP call..." )
109109
110110 if client , err := patroni .NewHttpClient (ctx , r .Client , pod .Name ); err == nil {
@@ -144,8 +144,8 @@ func (r *Reconciler) handlePatroniRestarts(
144144 if replicaNeedsRestart != nil {
145145 pod := replicaNeedsRestart .Pods [0 ]
146146
147- // If FEAT_PATRONI_PREFER_HTTP is active , try HTTP first, then fallback
148- if os . Getenv ( "FEAT_PATRONI_PREFER_HTTP" ) == "true" {
147+ // If PatroniPreferHTTP feature is enabled , try HTTP first, then fallback
148+ if feature . Enabled ( ctx , feature . PatroniPreferHTTP ) {
149149 log .Info ("Attempting HTTP call..." )
150150
151151 if client , err := patroni .NewHttpClient (ctx , r .Client , pod .Name ); err == nil {
@@ -253,8 +253,8 @@ func (r *Reconciler) reconcilePatroniDynamicConfiguration(
253253
254254 configuration = patroni .DynamicConfiguration (cluster , configuration , pgHBAs , pgParameters )
255255
256- // If FEAT_PATRONI_PREFER_HTTP is active , try HTTP first, then fallback
257- if os . Getenv ( "FEAT_PATRONI_PREFER_HTTP" ) == "true" {
256+ // If PatroniPreferHTTP feature is enabled , try HTTP first, then fallback
257+ if feature . Enabled ( ctx , feature . PatroniPreferHTTP ) {
258258 log .Info ("Attempting HTTP call..." )
259259
260260 if client , err := patroni .NewHttpClient (ctx , r .Client , pod .Name ); err == nil {
@@ -605,8 +605,8 @@ func (r *Reconciler) reconcilePatroniSwitchover(ctx context.Context,
605605 var timeline int64
606606 var err error
607607
608- // If FEAT_PATRONI_PREFER_HTTP is active , try HTTP first, then fallback
609- if os . Getenv ( "FEAT_PATRONI_PREFER_HTTP" ) == "true" {
608+ // If PatroniPreferHTTP feature is enabled , try HTTP first, then fallback
609+ if feature . Enabled ( ctx , feature . PatroniPreferHTTP ) {
610610 log .Info ("Attempting HTTP call..." )
611611
612612 if res , httpErr := patroni .NewHttpClient (ctx , r .Client , runningPod .Name ); httpErr == nil {
0 commit comments