mirror of
https://github.com/zalando/postgres-operator.git
synced 2026-10-05 21:21:43 +02:00
make annotations setter one liners
This commit is contained in:
@@ -334,15 +334,12 @@ func (c *Cluster) generateConnectionPoolerDeployment(connectionPooler *Connectio
|
||||
return nil, err
|
||||
}
|
||||
|
||||
annotations := c.annotationsSet(nil)
|
||||
annotations = c.AnnotationsToPropagate(annotations)
|
||||
|
||||
deployment := &appsv1.Deployment{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: connectionPooler.Name,
|
||||
Namespace: connectionPooler.Namespace,
|
||||
Labels: c.connectionPoolerLabels(connectionPooler.Role, true).MatchLabels,
|
||||
Annotations: annotations,
|
||||
Annotations: c.AnnotationsToPropagate(c.annotationsSet(nil)),
|
||||
// make StatefulSet object its owner to represent the dependency.
|
||||
// By itself StatefulSet is being deleted with "Orphaned"
|
||||
// propagation policy, which means that it's deletion will not
|
||||
@@ -869,8 +866,7 @@ func (c *Cluster) syncConnectionPoolerWorker(oldSpec, newSpec *acidv1.Postgresql
|
||||
}
|
||||
}
|
||||
|
||||
newAnnotations := c.annotationsSet(c.ConnectionPooler[role].Deployment.Annotations)
|
||||
newAnnotations = c.AnnotationsToPropagate(newAnnotations)
|
||||
newAnnotations := c.AnnotationsToPropagate(c.annotationsSet(c.ConnectionPooler[role].Deployment.Annotations))
|
||||
if newAnnotations != nil && len(newAnnotations) > 0 {
|
||||
deployment, err = updateConnectionPoolerAnnotations(c.KubeClient, c.ConnectionPooler[role].Deployment, newAnnotations)
|
||||
if err != nil {
|
||||
|
||||
@@ -1226,9 +1226,9 @@ func (c *Cluster) generateStatefulSet(spec *acidv1.PostgresSpec) (*appsv1.Statef
|
||||
return nil, fmt.Errorf("could not set the pod management policy to the unknown value: %v", c.OpConfig.PodManagementPolicy)
|
||||
}
|
||||
|
||||
stsAnnotations := c.annotationsSet(nil)
|
||||
stsAnnotations = c.AnnotationsToPropagate(stsAnnotations)
|
||||
stsAnnotations := make(map[string]string)
|
||||
stsAnnotations[rollingUpdateStatefulsetAnnotationKey] = strconv.FormatBool(false)
|
||||
stsAnnotations = c.AnnotationsToPropagate(c.annotationsSet(nil))
|
||||
|
||||
statefulSet := &appsv1.StatefulSet{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
|
||||
+7
-4
@@ -353,9 +353,8 @@ func (c *Cluster) syncStatefulSet() error {
|
||||
}
|
||||
}
|
||||
}
|
||||
annotations := c.annotationsSet(c.Statefulset.Annotations)
|
||||
annotations = c.AnnotationsToPropagate(annotations)
|
||||
c.updateStatefulSetAnnotations(annotations)
|
||||
|
||||
c.updateStatefulSetAnnotations(c.AnnotationsToPropagate(c.annotationsSet(c.Statefulset.Annotations)))
|
||||
|
||||
if !podsRollingUpdateRequired && !c.OpConfig.EnableLazySpiloUpgrade {
|
||||
// even if desired and actual statefulsets match
|
||||
@@ -420,7 +419,11 @@ func (c *Cluster) AnnotationsToPropagate(annotations map[string]string) map[stri
|
||||
}
|
||||
}
|
||||
|
||||
return annotations
|
||||
if len(annotations) > 0 {
|
||||
return annotations
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// checkAndSetGlobalPostgreSQLConfiguration checks whether cluster-wide API parameters
|
||||
|
||||
Reference in New Issue
Block a user