Skip to content
Snippets Groups Projects
Unverified Commit 41f5fe1d authored by Polina Bungina's avatar Polina Bungina Committed by GitHub
Browse files

More major upgrade prechecks (#2775)

Skip when 
- it is a standby clusters
- there is no master in the cluster
parent 3ca86678
No related branches found
No related tags found
No related merge requests found
...@@ -145,6 +145,11 @@ func (c *Cluster) majorVersionUpgrade() error { ...@@ -145,6 +145,11 @@ func (c *Cluster) majorVersionUpgrade() error {
for i, pod := range pods { for i, pod := range pods {
ps, _ := c.patroni.GetMemberData(&pod) 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" { if ps.State != "running" {
allRunning = false allRunning = false
c.logger.Infof("identified non running pod, potentially skipping major version upgrade") c.logger.Infof("identified non running pod, potentially skipping major version upgrade")
...@@ -156,6 +161,11 @@ func (c *Cluster) majorVersionUpgrade() error { ...@@ -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 // 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 if _, exists := c.ObjectMeta.Annotations[majorVersionUpgradeFailureAnnotation]; exists { // if failure annotation exists, remove it
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment