@@ -596,6 +596,7 @@ func (c *Cluster) enforceMinResourceLimits(spec *acidv1.PostgresSpec) error {
596596// for a cluster that had no such job before. In this case a missing job is not an error.
597597func (c * Cluster ) Update (oldSpec , newSpec * acidv1.Postgresql ) error {
598598 updateFailed := false
599+ syncStatetfulSet := false
599600
600601 c .mu .Lock ()
601602 defer c .mu .Unlock ()
@@ -623,6 +624,7 @@ func (c *Cluster) Update(oldSpec, newSpec *acidv1.Postgresql) error {
623624 } else if oldSpec .Spec .PostgresqlParam .PgVersion < newSpec .Spec .PostgresqlParam .PgVersion {
624625 c .logger .Infof ("postgresql version increased (%q -> %q), major version upgrade can be done manually after StatefulSet Sync" ,
625626 oldSpec .Spec .PostgresqlParam .PgVersion , newSpec .Spec .PostgresqlParam .PgVersion )
627+ syncStatetfulSet = true
626628 }
627629
628630 // Service
@@ -699,8 +701,9 @@ func (c *Cluster) Update(oldSpec, newSpec *acidv1.Postgresql) error {
699701 updateFailed = true
700702 return
701703 }
702- if ! reflect .DeepEqual (oldSs , newSs ) || ! reflect .DeepEqual (oldSpec .Annotations , newSpec .Annotations ) {
704+ if syncStatetfulSet || ! reflect .DeepEqual (oldSs , newSs ) || ! reflect .DeepEqual (oldSpec .Annotations , newSpec .Annotations ) {
703705 c .logger .Debugf ("syncing statefulsets" )
706+ syncStatetfulSet = false
704707 // TODO: avoid generating the StatefulSet object twice by passing it to syncStatefulSet
705708 if err := c .syncStatefulSet (); err != nil {
706709 c .logger .Errorf ("could not sync statefulsets: %v" , err )
0 commit comments