Avoid syncing when possible (#1274)

Avoid extra syncing in case there are no changes in pooler requirements.
Add pooler specific labels to pooler secrets.
Add test case to check for pooler secret creation and deletion.

Co-authored-by: Rafia Sabih <rafia.sabih@zalando.de>
This commit is contained in:
Rafia Sabih
2021-01-14 09:53:09 +01:00
committed by GitHub
co-authored by Rafia Sabih
parent ff46bb069b
commit e398cf8c7e
4 changed files with 55 additions and 8 deletions
+8 -1
View File
@@ -1561,11 +1561,17 @@ func (c *Cluster) generateSingleUserSecret(namespace string, pgUser spec.PgUser)
}
username := pgUser.Name
lbls := c.labelsSet(true)
if username == constants.ConnectionPoolerUserName {
lbls = c.connectionPoolerLabels("", false).MatchLabels
}
secret := v1.Secret{
ObjectMeta: metav1.ObjectMeta{
Name: c.credentialSecretName(username),
Namespace: namespace,
Labels: c.labelsSet(true),
Labels: lbls,
Annotations: c.annotationsSet(nil),
},
Type: v1.SecretTypeOpaque,
@@ -1574,6 +1580,7 @@ func (c *Cluster) generateSingleUserSecret(namespace string, pgUser spec.PgUser)
"password": []byte(pgUser.Password),
},
}
return &secret
}