Skip to content

Commit

Permalink
Merge pull request #10361 from hakman/single-az-multi-master
Browse files Browse the repository at this point in the history
Prefix etcd cluster names with letters
  • Loading branch information
k8s-ci-robot authored Jan 5, 2021
2 parents 551a805 + 82eee75 commit 2e202ba
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,21 @@ spec:
- cpuRequest: 200m
etcdMembers:
- instanceGroup: master-us-test-1a-1
name: "1"
name: etcd-1
- instanceGroup: master-us-test-1a-2
name: "2"
name: etcd-2
- instanceGroup: master-us-test-1a-3
name: "3"
name: etcd-3
memoryRequest: 100Mi
name: main
- cpuRequest: 100m
etcdMembers:
- instanceGroup: master-us-test-1a-1
name: "1"
name: etcd-1
- instanceGroup: master-us-test-1a-2
name: "2"
name: etcd-2
- instanceGroup: master-us-test-1a-3
name: "3"
name: etcd-3
memoryRequest: 100Mi
name: events
iam:
Expand Down
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 @@ -736,6 +736,13 @@ func trimCommonPrefix(names []string) []string {
}
}

for i := range names {
_, err := strconv.Atoi(names[i])
if err == nil {
names[i] = "etcd-" + 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{"etcd-1", "etcd-2", "etcd-3"},
},
{
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 2e202ba

Please sign in to comment.