revert some changes
This commit is contained in:
parent
f3f389c586
commit
45a6c4603b
|
|
@ -957,6 +957,10 @@ func (c *Cluster) initSystemUsers() {
|
|||
Password: util.RandomPassword(constants.PasswordLength),
|
||||
}
|
||||
|
||||
if _, exists := c.pgUsers[username]; !exists {
|
||||
c.pgUsers[username] = connectionPoolerUser
|
||||
}
|
||||
|
||||
if _, exists := c.systemUsers[constants.ConnectionPoolerUserKeyName]; !exists {
|
||||
c.systemUsers[constants.ConnectionPoolerUserKeyName] = connectionPoolerUser
|
||||
}
|
||||
|
|
|
|||
|
|
@ -528,9 +528,6 @@ 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.ConnectionPoolerUserName].Name {
|
||||
secretUsername = constants.ConnectionPoolerUserName
|
||||
userMap = c.systemUsers
|
||||
} else {
|
||||
userMap = c.pgUsers
|
||||
}
|
||||
|
|
@ -580,7 +577,9 @@ func (c *Cluster) syncRoles() (err error) {
|
|||
}()
|
||||
|
||||
for _, u := range c.systemUsers {
|
||||
systemUserNames = append(systemUserNames, u.Name)
|
||||
if u.Origin == spec.RoleOriginSystem {
|
||||
systemUserNames = append(systemUserNames, u.Name)
|
||||
}
|
||||
}
|
||||
|
||||
dbUsers, err = c.readPgUsersFromDatabase(systemUserNames)
|
||||
|
|
@ -588,6 +587,13 @@ func (c *Cluster) syncRoles() (err error) {
|
|||
return fmt.Errorf("error getting users from the database: %v", err)
|
||||
}
|
||||
|
||||
if needMasterConnectionPooler(&c.Spec) || needReplicaConnectionPooler(&c.Spec) {
|
||||
connectionPoolerUser := c.systemUsers[constants.ConnectionPoolerUserKeyName]
|
||||
if _, exists := c.pgUsers[connectionPoolerUser.Name]; !exists {
|
||||
c.pgUsers[connectionPoolerUser.Name] = connectionPoolerUser
|
||||
}
|
||||
}
|
||||
|
||||
pgSyncRequests := c.userSyncStrategy.ProduceSyncRequests(dbUsers, c.pgUsers)
|
||||
if err = c.userSyncStrategy.ExecuteSyncRequests(pgSyncRequests, c.pgDb); err != nil {
|
||||
return fmt.Errorf("error executing sync statements: %v", err)
|
||||
|
|
|
|||
Loading…
Reference in New Issue