only skip upgrade if failed before after recheck version (#2755)
This commit is contained in:
		
							parent
							
								
									2e398120d2
								
							
						
					
					
						commit
						c25dc57b96
					
				|  | @ -127,11 +127,6 @@ func (c *Cluster) majorVersionUpgrade() error { | ||||||
| 		return nil | 		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) { | 	if !isInMainternanceWindow(c.Spec.MaintenanceWindows) { | ||||||
| 		c.logger.Infof("skipping major version upgrade, not in maintenance window") | 		c.logger.Infof("skipping major version upgrade, not in maintenance window") | ||||||
| 		return nil | 		return nil | ||||||
|  | @ -162,10 +157,19 @@ func (c *Cluster) majorVersionUpgrade() error { | ||||||
| 
 | 
 | ||||||
| 	// Recheck version with newest data from Patroni
 | 	// Recheck version with newest data from Patroni
 | ||||||
| 	if c.currentMajorVersion >= desiredVersion { | 	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) | 		c.logger.Infof("recheck cluster version is already up to date. current: %d, min desired: %d", c.currentMajorVersion, desiredVersion) | ||||||
| 		return nil | 		return nil | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  | 	if _, exists := c.ObjectMeta.Annotations[majorVersionUpgradeFailureAnnotation]; exists { | ||||||
|  | 		c.logger.Infof("last major upgrade failed, skipping upgrade") | ||||||
|  | 		return nil | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
| 	isUpgradeSuccess := true | 	isUpgradeSuccess := true | ||||||
| 	numberOfPods := len(pods) | 	numberOfPods := len(pods) | ||||||
| 	if allRunning && masterPod != nil { | 	if allRunning && masterPod != nil { | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue