From adb1fe6e3c6d06a7c362ef871dd67e49cbdefe21 Mon Sep 17 00:00:00 2001 From: Tvion Date: Thu, 12 Mar 2026 14:46:21 +0500 Subject: [PATCH 1/2] fix: [PSUPCLCAP-3530] Increase postgres initialization time after upgrade --- operator/cmd/pgskipper-operator/main.go | 2 +- operator/pkg/upgrade/upgrade.go | 2 +- operator/pkg/util/wait_util.go | 17 ++++++++++++++--- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/operator/cmd/pgskipper-operator/main.go b/operator/cmd/pgskipper-operator/main.go index 0b0d37c..846e3d1 100644 --- a/operator/cmd/pgskipper-operator/main.go +++ b/operator/cmd/pgskipper-operator/main.go @@ -71,7 +71,7 @@ func main() { "Enable leader election for controller manager. "+ "Enabling this will ensure there is only one active controller manager.") opts := zap.Options{ - Development: true, + Development: false, } opts.BindFlags(flag.CommandLine) flag.Parse() diff --git a/operator/pkg/upgrade/upgrade.go b/operator/pkg/upgrade/upgrade.go index 3907959..ea3a2ac 100644 --- a/operator/pkg/upgrade/upgrade.go +++ b/operator/pkg/upgrade/upgrade.go @@ -485,7 +485,7 @@ func (u *Upgrade) ProceedUpgrade(cr *v1.PatroniCore, cluster *v1.PatroniClusterS logger.Info("Leader Upgrade completed") - if err := opUtil.WaitForPatroni(cr, cluster.PatroniMasterSelectors, cluster.PatroniReplicasSelector); err != nil { + if err := opUtil.WaitForPatroniWithReplicaTimeout(cr, cluster.PatroniMasterSelectors, cluster.PatroniReplicasSelector, 600*time.Minute); err != nil { return err } diff --git a/operator/pkg/util/wait_util.go b/operator/pkg/util/wait_util.go index 6a3fabb..590cdab 100644 --- a/operator/pkg/util/wait_util.go +++ b/operator/pkg/util/wait_util.go @@ -244,8 +244,8 @@ func WaitForLeader(patroniMasterSelector map[string]string) error { }) } -func waitForReplicas(patroniReplicasSelector map[string]string, numberOfReplicas int) error { - return wait.PollUntilContextTimeout(context.Background(), time.Second, getWaitTimeout(), true, func(ctx context.Context) (done bool, err error) { +func waitForReplicas(patroniReplicasSelector map[string]string, numberOfReplicas int, timeout time.Duration) error { + return wait.PollUntilContextTimeout(context.Background(), time.Second, timeout, true, func(ctx context.Context) (done bool, err error) { return checkPodsByLabel(patroniReplicasSelector, numberOfReplicas) }) } @@ -263,12 +263,23 @@ func WaitForMetricCollector() error { } func WaitForPatroni(cr *v1.PatroniCore, patroniMasterSelector map[string]string, patroniReplicasSelector map[string]string) error { + return WaitForPatroniWithReplicaTimeout(cr, patroniMasterSelector, patroniReplicasSelector, 0) +} + +func WaitForPatroniWithReplicaTimeout(cr *v1.PatroniCore, patroniMasterSelector map[string]string, patroniReplicasSelector map[string]string, timeout time.Duration) error { if cr.Spec.Patroni.Dcs.Type == "kubernetes" { if err := WaitForLeader(patroniMasterSelector); err != nil { uLog.Error("Failed to wait for master, exiting", zap.Error(err)) return err } - if err := waitForReplicas(patroniReplicasSelector, cr.Spec.Patroni.Replicas-1); err != nil { + + // use biggest timeout for replicas + operatorTimeout := getWaitTimeout() + if timeout < operatorTimeout { + timeout = operatorTimeout + } + + if err := waitForReplicas(patroniReplicasSelector, cr.Spec.Patroni.Replicas-1, timeout); err != nil { uLog.Error("Failed to wait for replicas, exiting", zap.Error(err)) return err } From 17c53cf481fafca35e0d8f7e43f59d251e6c5798 Mon Sep 17 00:00:00 2001 From: Tvion Date: Thu, 12 Mar 2026 15:14:39 +0500 Subject: [PATCH 2/2] fix: [PSUPCLCAP-3530] Increase postgres initialization time after upgrade --- .github/workflows/build.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 39f76d5..c114de1 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -39,7 +39,7 @@ concurrency: cancel-in-progress: ${{ github.ref_name != 'main' }} env: - TAG_NAME: ${{ github.event.release.tag_name || github.ref_name }} + TAG_NAME: ${{ github.event.release.tag_name || github.head_ref || github.ref_name }} PUSH: ${{ (github.event_name != 'workflow_dispatch' || inputs.publish_docker) && github.actor != 'dependabot[bot]' }} jobs: