mirror of
https://github.com/zalando/postgres-operator.git
synced 2026-09-30 15:46:44 +02:00
Assign SUPERUSER to human users by default.
This commit is contained in:
committed by
Murat Kabilov
parent
34ac47aed9
commit
45fcb2adc9
@@ -50,6 +50,7 @@ func (c *Cluster) createPgUser(user spec.PgUser) (isHuman bool, err error) {
|
||||
|
||||
if user.Password == "" {
|
||||
isHuman = true
|
||||
flags = append(flags, "SUPERUSER")
|
||||
flags = append(flags, fmt.Sprintf("IN ROLE \"%s\"", constants.PamRoleName))
|
||||
} else {
|
||||
isHuman = false
|
||||
|
||||
@@ -270,6 +270,7 @@ func (c *Cluster) deleteSecret(secret *v1.Secret) error {
|
||||
}
|
||||
|
||||
func (c *Cluster) createUsers() error {
|
||||
// TODO: figure out what to do with duplicate names (humans and robots) among pgUsers
|
||||
for username, user := range c.pgUsers {
|
||||
if username == constants.SuperuserName || username == constants.ReplicationUsername {
|
||||
continue
|
||||
@@ -283,7 +284,7 @@ func (c *Cluster) createUsers() error {
|
||||
userType = "robot"
|
||||
}
|
||||
if err != nil {
|
||||
return fmt.Errorf("Can't create %s user '%s': %s", userType, username, err)
|
||||
c.logger.Warnf("Can't create %s user '%s': %s", userType, username, err)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user