Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion operator/cmd/pgskipper-operator/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion operator/pkg/upgrade/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
17 changes: 14 additions & 3 deletions operator/pkg/util/wait_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
})
}
Expand All @@ -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
}
Expand Down
Loading