Skip to content

Commit

Permalink
Prefix etcd cluster names with letters
Browse files Browse the repository at this point in the history
  • Loading branch information
Ciprian Hacman committed Dec 3, 2020
1 parent 1b45f87 commit df857cc
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
7 changes: 7 additions & 0 deletions upup/pkg/fi/cloudup/new_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -692,6 +692,13 @@ func trimCommonPrefix(names []string) []string {
}
}

for i := range names {
_, err := strconv.Atoi(names[i])
if err == nil {
names[i] = "e" + names[i]
}
}

return names
}

Expand Down
4 changes: 4 additions & 0 deletions upup/pkg/fi/cloudup/new_cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ func TestRemoveSharedPrefix(t *testing.T) {
Input: []string{"zza", "zzb", ""},
Output: []string{"zza", "zzb", ""},
},
{
Input: []string{"us-test-1a-1", "us-test-1a-2", "us-test-1a-3"},
Output: []string{"e1", "e2", "e3"},
},
{
Input: []string{"us-test-1a-1", "us-test-1b-1", "us-test-1a-2", "us-test-1b-2", "us-test-1a-3"},
Output: []string{"a-1", "b-1", "a-2", "b-2", "a-3"},
Expand Down

0 comments on commit df857cc

Please sign in to comment.