Skip to content

Commit

Permalink
only skip upgrade if failed before after recheck version (#2755)
Browse files Browse the repository at this point in the history
  • Loading branch information
idanovinda authored Sep 10, 2024
1 parent 2e39812 commit c25dc57
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions pkg/cluster/majorversionupgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,11 +127,6 @@ func (c *Cluster) majorVersionUpgrade() error {
return nil
}

if _, exists := c.ObjectMeta.Annotations[majorVersionUpgradeFailureAnnotation]; exists {
c.logger.Infof("last major upgrade failed, skipping upgrade")
return nil
}

if !isInMainternanceWindow(c.Spec.MaintenanceWindows) {
c.logger.Infof("skipping major version upgrade, not in maintenance window")
return nil
Expand Down Expand Up @@ -162,10 +157,19 @@ func (c *Cluster) majorVersionUpgrade() error {

// Recheck version with newest data from Patroni
if c.currentMajorVersion >= desiredVersion {
if _, exists := c.ObjectMeta.Annotations[majorVersionUpgradeFailureAnnotation]; exists { // if failure annotation exists, remove it
c.removeFailuresAnnotation()
c.logger.Infof("removing failure annotation as the cluster is already up to date")
}
c.logger.Infof("recheck cluster version is already up to date. current: %d, min desired: %d", c.currentMajorVersion, desiredVersion)
return nil
}

if _, exists := c.ObjectMeta.Annotations[majorVersionUpgradeFailureAnnotation]; exists {
c.logger.Infof("last major upgrade failed, skipping upgrade")
return nil
}

isUpgradeSuccess := true
numberOfPods := len(pods)
if allRunning && masterPod != nil {
Expand Down

0 comments on commit c25dc57

Please sign in to comment.