Skip to content

Commit

Permalink
add comments where inherited annotations could be added
Browse files Browse the repository at this point in the history
  • Loading branch information
FxKu committed Nov 30, 2020
1 parent 2b5382e commit c4b1d69
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 14 deletions.
20 changes: 12 additions & 8 deletions pkg/cluster/connection_pooler.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down
19 changes: 13 additions & 6 deletions pkg/cluster/k8sres.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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{
Expand Down Expand Up @@ -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{
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit c4b1d69

Please sign in to comment.