mirror of
https://github.com/zalando/postgres-operator.git
synced 2026-10-22 02:49:32 +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 == "" {
|
if user.Password == "" {
|
||||||
isHuman = true
|
isHuman = true
|
||||||
|
flags = append(flags, "SUPERUSER")
|
||||||
flags = append(flags, fmt.Sprintf("IN ROLE \"%s\"", constants.PamRoleName))
|
flags = append(flags, fmt.Sprintf("IN ROLE \"%s\"", constants.PamRoleName))
|
||||||
} else {
|
} else {
|
||||||
isHuman = false
|
isHuman = false
|
||||||
|
|||||||
@@ -270,6 +270,7 @@ func (c *Cluster) deleteSecret(secret *v1.Secret) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *Cluster) createUsers() 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 {
|
for username, user := range c.pgUsers {
|
||||||
if username == constants.SuperuserName || username == constants.ReplicationUsername {
|
if username == constants.SuperuserName || username == constants.ReplicationUsername {
|
||||||
continue
|
continue
|
||||||
@@ -283,7 +284,7 @@ func (c *Cluster) createUsers() error {
|
|||||||
userType = "robot"
|
userType = "robot"
|
||||||
}
|
}
|
||||||
if err != nil {
|
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