From c4b1d69ef9743cd51b27d6c06ff9d1e57a12f033 Mon Sep 17 00:00:00 2001 From: Felix Kunde Date: Fri, 27 Nov 2020 17:43:04 +0100 Subject: [PATCH] add comments where inherited annotations could be added --- pkg/cluster/connection_pooler.go | 20 ++++++++++++-------- pkg/cluster/k8sres.go | 19 +++++++++++++------ 2 files changed, 25 insertions(+), 14 deletions(-) diff --git a/pkg/cluster/connection_pooler.go b/pkg/cluster/connection_pooler.go index 10354ca32..cd25fe3cb 100644 --- a/pkg/cluster/connection_pooler.go +++ b/pkg/cluster/connection_pooler.go @@ -284,8 +284,9 @@ func (c *Cluster) generateConnectionPoolerPodTemplate(role PostgresRole) ( podTemplate := &v1.PodTemplateSpec{ ObjectMeta: metav1.ObjectMeta{ - Labels: c.connectionPoolerLabels(role, true).MatchLabels, - Namespace: c.Namespace, + Labels: c.connectionPoolerLabels(role, true).MatchLabels, + Namespace: c.Namespace, + // Annotations: c.annotationsSet(c.generatePodAnnotations(spec)), Annotations: c.generatePodAnnotations(spec), }, Spec: v1.PodSpec{ @@ -336,9 +337,10 @@ func (c *Cluster) generateConnectionPoolerDeployment(connectionPooler *Connectio deployment := &appsv1.Deployment{ ObjectMeta: metav1.ObjectMeta{ - Name: connectionPooler.Name, - Namespace: connectionPooler.Namespace, - Labels: c.connectionPoolerLabels(connectionPooler.Role, true).MatchLabels, + Name: connectionPooler.Name, + Namespace: connectionPooler.Namespace, + Labels: c.connectionPoolerLabels(connectionPooler.Role, true).MatchLabels, + // Annotations: c.annotationsSet(map[string]string{}), Annotations: map[string]string{}, // make StatefulSet object its owner to represent the dependency. // By itself StatefulSet is being deleted with "Orphaned" @@ -387,9 +389,11 @@ func (c *Cluster) generateConnectionPoolerService(connectionPooler *ConnectionPo service := &v1.Service{ ObjectMeta: metav1.ObjectMeta{ - Name: connectionPooler.Name, - Namespace: connectionPooler.Namespace, - Labels: c.connectionPoolerLabels(connectionPooler.Role, false).MatchLabels, + Name: connectionPooler.Name, + Namespace: connectionPooler.Namespace, + Labels: c.connectionPoolerLabels(connectionPooler.Role, false).MatchLabels, + // TODO add generateServiceAnnotations? + // TODO c.annotationsSet(map[string]string{}) Annotations: map[string]string{}, // make StatefulSet object its owner to represent the dependency. // By itself StatefulSet is being deleted with "Orphaned" diff --git a/pkg/cluster/k8sres.go b/pkg/cluster/k8sres.go index 798e163dd..f518f0eb9 100644 --- a/pkg/cluster/k8sres.go +++ b/pkg/cluster/k8sres.go @@ -1180,6 +1180,7 @@ func (c *Cluster) generateStatefulSet(spec *acidv1.PostgresSpec) (*appsv1.Statef podTemplate, err = c.generatePodTemplate( c.Namespace, c.labelsSet(true), + // TODO c.annotationsSet(annotations), annotations, spiloContainer, initContainers, @@ -1231,9 +1232,10 @@ func (c *Cluster) generateStatefulSet(spec *acidv1.PostgresSpec) (*appsv1.Statef statefulSet := &appsv1.StatefulSet{ ObjectMeta: metav1.ObjectMeta{ - Name: c.statefulSetName(), - Namespace: c.Namespace, - Labels: c.labelsSet(true), + Name: c.statefulSetName(), + Namespace: c.Namespace, + Labels: c.labelsSet(true), + // TODO Annotations: c.annotationsSet(c.AnnotationsToPropagate(annotations)), Annotations: c.AnnotationsToPropagate(annotations), }, Spec: appsv1.StatefulSetSpec{ @@ -1530,6 +1532,7 @@ func (c *Cluster) generateSingleUserSecret(namespace string, pgUser spec.PgUser) Name: c.credentialSecretName(username), Namespace: namespace, Labels: c.labelsSet(true), + // TODO Annotations: c.annotationsSet(map[string]string{}), }, Type: v1.SecretTypeOpaque, Data: map[string][]byte{ @@ -1600,9 +1603,10 @@ func (c *Cluster) generateService(role PostgresRole, spec *acidv1.PostgresSpec) service := &v1.Service{ ObjectMeta: metav1.ObjectMeta{ - Name: c.serviceName(role), - Namespace: c.Namespace, - Labels: c.roleLabelsSet(true, role), + Name: c.serviceName(role), + Namespace: c.Namespace, + Labels: c.roleLabelsSet(true, role), + // TODO Annotations: c.annotationsSet(c.generateServiceAnnotations(role, spec)), Annotations: c.generateServiceAnnotations(role, spec), }, Spec: serviceSpec, @@ -1653,6 +1657,7 @@ func (c *Cluster) generateEndpoint(role PostgresRole, subsets []v1.EndpointSubse Name: c.endpointName(role), Namespace: c.Namespace, Labels: c.roleLabelsSet(true, role), + // TODO Annotations: c.annotationsSet(map[string]string{}), }, } if len(subsets) > 0 { @@ -1809,6 +1814,7 @@ func (c *Cluster) generatePodDisruptionBudget() *policybeta1.PodDisruptionBudget Name: c.podDisruptionBudgetName(), Namespace: c.Namespace, Labels: c.labelsSet(true), + // TODO Annotations: c.annotationsSet(map[string]string{}), }, Spec: policybeta1.PodDisruptionBudgetSpec{ MinAvailable: &minAvailable, @@ -1931,6 +1937,7 @@ func (c *Cluster) generateLogicalBackupJob() (*batchv1beta1.CronJob, error) { Name: c.getLogicalBackupJobName(), Namespace: c.Namespace, Labels: c.labelsSet(true), + // TODO Annotations: c.annotationsSet(map[string]string{}), }, Spec: batchv1beta1.CronJobSpec{ Schedule: schedule,