Skip to content

Commit

Permalink
More major upgrade prechecks (#2775)
Browse files Browse the repository at this point in the history
Skip when 
- it is a standby clusters
- there is no master in the cluster
  • Loading branch information
hughcapet authored Oct 15, 2024
1 parent 3ca8667 commit 41f5fe1
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions pkg/cluster/majorversionupgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,11 @@ func (c *Cluster) majorVersionUpgrade() error {
for i, pod := range pods {
ps, _ := c.patroni.GetMemberData(&pod)

if ps.Role == "standby_leader" {
c.logger.Errorf("skipping major version upgrade for %s/%s standby cluster. Re-deploy standby cluster with the required Postgres version specified", c.Namespace, c.Name)
return nil
}

if ps.State != "running" {
allRunning = false
c.logger.Infof("identified non running pod, potentially skipping major version upgrade")
Expand All @@ -156,6 +161,11 @@ func (c *Cluster) majorVersionUpgrade() error {
}
}

if masterPod == nil {
c.logger.Infof("no master in the cluster, skipping major version upgrade")
return nil
}

// Recheck version with newest data from Patroni
if c.currentMajorVersion >= desiredVersion {
if _, exists := c.ObjectMeta.Annotations[majorVersionUpgradeFailureAnnotation]; exists { // if failure annotation exists, remove it
Expand Down

0 comments on commit 41f5fe1

Please sign in to comment.