More major upgrade prechecks (#2775)
Skip when - it is a standby clusters - there is no master in the cluster
This commit is contained in:
		
							parent
							
								
									3ca86678cc
								
							
						
					
					
						commit
						41f5fe1dc9
					
				|  | @ -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") | ||||
|  | @ -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
 | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue