Skip to content

Commit b9e7eaf

Browse files
committed
Avoid rotating pods for PGVERSION change outside of maintenance window
1 parent 421bd6d commit b9e7eaf

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

pkg/cluster/sync.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,12 @@ func (c *Cluster) Sync(newSpec *acidv1.Postgresql) error {
4141
defer c.mu.Unlock()
4242

4343
oldSpec := c.Postgresql
44+
45+
if !c.isInMaintenanceWindow(newSpec.Spec.MaintenanceWindows) {
46+
// do not apply any major version related changes yet
47+
newSpec.Spec.PostgresqlParam.PgVersion = oldSpec.Spec.PostgresqlParam.PgVersion
48+
}
49+
4450
c.setSpec(newSpec)
4551

4652
defer func() {
@@ -97,11 +103,6 @@ func (c *Cluster) Sync(newSpec *acidv1.Postgresql) error {
97103
}
98104
}
99105

100-
if !c.isInMaintenanceWindow(newSpec.Spec.MaintenanceWindows) {
101-
// do not apply any major version related changes yet
102-
newSpec.Spec.PostgresqlParam.PgVersion = oldSpec.Spec.PostgresqlParam.PgVersion
103-
}
104-
105106
if err = c.syncStatefulSet(); err != nil {
106107
if !k8sutil.ResourceAlreadyExists(err) {
107108
err = fmt.Errorf("could not sync statefulsets: %v", err)

0 commit comments

Comments
 (0)