Sync other way around
This commit is contained in:
parent
2e023799e1
commit
c0a840c3ed
|
|
@ -413,17 +413,13 @@ func (c *Cluster) syncSecrets() error {
|
|||
} else if secretUsername == c.systemUsers[constants.ReplicationUserKeyName].Name {
|
||||
secretUsername = constants.ReplicationUserKeyName
|
||||
userMap = c.systemUsers
|
||||
} else if secretUsername == c.systemUsers[constants.ConnectionPoolUserKeyName].Name {
|
||||
secretUsername = constants.ConnectionPoolUserKeyName
|
||||
userMap = c.systemUsers
|
||||
} else {
|
||||
userMap = c.pgUsers
|
||||
}
|
||||
pwdUser := userMap[secretUsername]
|
||||
// if this secret belongs to the infrastructure role and the password has changed - replace it in the secret
|
||||
if pwdUser.Password != string(secret.Data["password"]) &&
|
||||
(pwdUser.Origin == spec.RoleOriginInfrastructure ||
|
||||
pwdUser.Origin == spec.RoleConnectionPool) {
|
||||
pwdUser.Origin == spec.RoleOriginInfrastructure {
|
||||
|
||||
c.logger.Debugf("updating the secret %q from the infrastructure roles", secretSpec.Name)
|
||||
if _, err = c.KubeClient.Secrets(secretSpec.Namespace).Update(secretSpec); err != nil {
|
||||
|
|
@ -472,8 +468,11 @@ func (c *Cluster) syncRoles() (err error) {
|
|||
if c.needConnectionPool() {
|
||||
connPoolUser := c.systemUsers[constants.ConnectionPoolUserKeyName]
|
||||
userNames = append(userNames, connPoolUser.Name)
|
||||
|
||||
if _, exists := c.pgUsers[constants.ConnectionPoolUserKeyName]; !exists {
|
||||
c.pgUsers[connPoolUser.Name] = connPoolUser
|
||||
}
|
||||
}
|
||||
|
||||
dbUsers, err = c.readPgUsersFromDatabase(userNames)
|
||||
if err != nil {
|
||||
|
|
|
|||
Loading…
Reference in New Issue