@@ -596,6 +596,7 @@ func (c *Cluster) enforceMinResourceLimits(spec *acidv1.PostgresSpec) error {
596
596
// for a cluster that had no such job before. In this case a missing job is not an error.
597
597
func (c * Cluster ) Update (oldSpec , newSpec * acidv1.Postgresql ) error {
598
598
updateFailed := false
599
+ syncStatetfulSet := false
599
600
600
601
c .mu .Lock ()
601
602
defer c .mu .Unlock ()
@@ -623,6 +624,7 @@ func (c *Cluster) Update(oldSpec, newSpec *acidv1.Postgresql) error {
623
624
} else if oldSpec .Spec .PostgresqlParam .PgVersion < newSpec .Spec .PostgresqlParam .PgVersion {
624
625
c .logger .Infof ("postgresql version increased (%q -> %q), major version upgrade can be done manually after StatefulSet Sync" ,
625
626
oldSpec .Spec .PostgresqlParam .PgVersion , newSpec .Spec .PostgresqlParam .PgVersion )
627
+ syncStatetfulSet = true
626
628
}
627
629
628
630
// Service
@@ -699,8 +701,9 @@ func (c *Cluster) Update(oldSpec, newSpec *acidv1.Postgresql) error {
699
701
updateFailed = true
700
702
return
701
703
}
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 ) {
703
705
c .logger .Debugf ("syncing statefulsets" )
706
+ syncStatetfulSet = false
704
707
// TODO: avoid generating the StatefulSet object twice by passing it to syncStatefulSet
705
708
if err := c .syncStatefulSet (); err != nil {
706
709
c .logger .Errorf ("could not sync statefulsets: %v" , err )
0 commit comments