Handle update path and renaming

- handle the update path to update sts and connection pooler deployment.
  This way no need to wait for sync
- rename the parameter to downscaler_annotations
- handle other review comments
This commit is contained in:
Rafia Sabih
2020-04-30 13:20:44 +02:00
parent 1745c44c5e
commit 11ef0cf722
15 changed files with 41 additions and 45 deletions
+1 -2
View File
@@ -711,8 +711,7 @@ func (c *Cluster) Update(oldSpec, newSpec *acidv1.Postgresql) error {
updateFailed = true
return
}
if !reflect.DeepEqual(oldSs, newSs) {
if !reflect.DeepEqual(oldSs, newSs) || !reflect.DeepEqual(oldSpec.Annotations, newSpec.Annotations) {
c.logger.Debugf("syncing statefulsets")
// TODO: avoid generating the StatefulSet object twice by passing it to syncStatefulSet
if err := c.syncStatefulSet(); err != nil {
+1 -1
View File
@@ -34,7 +34,7 @@ var cl = New(
SuperUsername: superUserName,
ReplicationUsername: replicationUserName,
},
StatefulsetPropagateAnnotations: []string{"downscaler/*"},
DownscalerAnnotations: []string{"downscaler/*"},
},
},
k8sutil.NewMockKubernetesClient(),
+1 -1
View File
@@ -403,7 +403,7 @@ func (c *Cluster) syncStatefulSet() error {
// AnnotationsToPropagate get the annotations to update if required
// based on the annotations in postgres CRD
func (c *Cluster) AnnotationsToPropagate(annotations map[string]string) map[string]string {
toPropagateAnnotations := c.OpConfig.StatefulsetPropagateAnnotations
toPropagateAnnotations := c.OpConfig.DownscalerAnnotations
pgCRDAnnotations := c.Postgresql.ObjectMeta.GetAnnotations()
if toPropagateAnnotations != nil && pgCRDAnnotations != nil {