Skip to content

Commit

Permalink
Check for custom user names uniqueness.
Browse files Browse the repository at this point in the history
  • Loading branch information
inelpandzic committed Dec 11, 2024
1 parent 416e912 commit 2f80478
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions pkg/apis/pxc/v1/pxc_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,14 @@ func (cr *PerconaXtraDBCluster) Validate() error {
return errors.Errorf("ProxySQL or HAProxy should be enabled if SmartUpdate set")
}

customUsers := make(map[string]int8, len(c.Users))
for _, user := range c.Users {
customUsers[user.Name]++
if customUsers[user.Name] > 1 {
return errors.Errorf("user %s is duplicated", user.Name)
}
}

return nil
}

Expand Down

0 comments on commit 2f80478

Please sign in to comment.