mirror of
https://github.com/zalando/postgres-operator.git
synced 2026-09-30 11:27:17 +02:00
More major upgrade prechecks (#2775)
Skip when - it is a standby clusters - there is no master in the cluster
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user