mirror of
https://github.com/zalando/postgres-operator.git
synced 2026-10-19 04:30:55 +02:00
update individual role secrets from infrastructure roles (#206)
* Track origin of roles. * Propagate changes on infrastructure roles to corresponding secrets. When the password in the infrastructure role is updated, re-generate the secret for that role. Previously, the password for an infrastructure role was always fetched from the secret, making any updates to such role a no-op after the corresponding secret had been generated.
This commit is contained in:
@@ -656,10 +656,12 @@ func (c *Cluster) initSystemUsers() {
|
||||
// secrets, therefore, setting flags like SUPERUSER or REPLICATION
|
||||
// is not necessary here
|
||||
c.systemUsers[constants.SuperuserKeyName] = spec.PgUser{
|
||||
Origin: spec.RoleOriginSystem,
|
||||
Name: c.OpConfig.SuperUsername,
|
||||
Password: util.RandomPassword(constants.PasswordLength),
|
||||
}
|
||||
c.systemUsers[constants.ReplicationUserKeyName] = spec.PgUser{
|
||||
Origin: spec.RoleOriginSystem,
|
||||
Name: c.OpConfig.ReplicationUsername,
|
||||
Password: util.RandomPassword(constants.PasswordLength),
|
||||
}
|
||||
@@ -680,6 +682,7 @@ func (c *Cluster) initRobotUsers() error {
|
||||
}
|
||||
if _, present := c.pgUsers[username]; !present {
|
||||
c.pgUsers[username] = spec.PgUser{
|
||||
Origin: spec.RoleOriginManifest,
|
||||
Name: username,
|
||||
Password: util.RandomPassword(constants.PasswordLength),
|
||||
Flags: flags,
|
||||
@@ -723,6 +726,7 @@ func (c *Cluster) initHumanUsers() error {
|
||||
}
|
||||
|
||||
c.pgUsers[username] = spec.PgUser{
|
||||
Origin: spec.RoleOriginTeamsAPI,
|
||||
Name: username,
|
||||
Flags: flags,
|
||||
MemberOf: memberOf,
|
||||
|
||||
Reference in New Issue
Block a user