Feature/infrastructure roles (#91)

* Add infrastructure roles configured globally.

Those are the roles defined in the operator itself. The operator's
configuration refers to the secret containing role names, passwords
and membership information. While they are referred to as roles, in
reality those are users.

In addition, improve the regex to filter out invalid users and
make sure user secret names are compatible with DNS name spec.

Add an example manifest for the infrastructure roles.
This commit is contained in:
Oleksii Kliukin
2017-05-12 11:41:33 +02:00
committed by Murat Kabilov
parent b8fba429df
commit 71b93b4cc2
13 changed files with 129 additions and 33 deletions
+2 -2
View File
@@ -79,7 +79,7 @@ type PostgresSpec struct {
NumberOfInstances int32 `json:"numberOfInstances"`
Users map[string]UserFlags `json:"users"`
MaintenanceWindows []MaintenanceWindow `json:"maintenanceWindows,omitempty"`
ClusterName string `json:"-"`
ClusterName string `json:"-"`
}
type PostgresqlList struct {
@@ -193,7 +193,7 @@ type PostgresqlCopy Postgresql
func clusterName(clusterName string, teamName string) (string, error) {
teamNameLen := len(teamName)
if len(clusterName) < teamNameLen + 2 {
if len(clusterName) < teamNameLen+2 {
return "", fmt.Errorf("Name is too short")
}
if strings.ToLower(clusterName[:teamNameLen]) != strings.ToLower(teamName) {
+1
View File
@@ -37,4 +37,5 @@ type PgUser struct {
Name string
Password string
Flags []string
MemberOf string
}