mirror of
https://github.com/zalando/postgres-operator.git
synced 2026-09-30 12:34:32 +02:00
make sure name of the cluster matches format {teamname}-{clustername}
This commit is contained in:
@@ -196,8 +196,8 @@ func clusterName(clusterName string, teamName string) (string, error) {
|
||||
if len(clusterName) < teamNameLen+2 {
|
||||
return "", fmt.Errorf("Name is too short")
|
||||
}
|
||||
if strings.ToLower(clusterName[:teamNameLen]) != strings.ToLower(teamName) {
|
||||
return "", fmt.Errorf("Name must start with the team name")
|
||||
if strings.ToLower(clusterName[:teamNameLen+1]) != strings.ToLower(teamName) + "-" {
|
||||
return "", fmt.Errorf("Name must start with the team name and dash")
|
||||
}
|
||||
|
||||
return clusterName[teamNameLen+1:], nil
|
||||
|
||||
Reference in New Issue
Block a user