From c73ba453899eadbea0af75793f8d7850ba6ae52b Mon Sep 17 00:00:00 2001 From: Ciprian Hacman Date: Thu, 3 Dec 2020 19:57:31 +0200 Subject: [PATCH 1/2] Prefix etcd cluster names with letters --- upup/pkg/fi/cloudup/new_cluster.go | 7 +++++++ upup/pkg/fi/cloudup/new_cluster_test.go | 4 ++++ 2 files changed, 11 insertions(+) diff --git a/upup/pkg/fi/cloudup/new_cluster.go b/upup/pkg/fi/cloudup/new_cluster.go index 95cef134a2..3d89f328dd 100644 --- a/upup/pkg/fi/cloudup/new_cluster.go +++ b/upup/pkg/fi/cloudup/new_cluster.go @@ -692,6 +692,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 } diff --git a/upup/pkg/fi/cloudup/new_cluster_test.go b/upup/pkg/fi/cloudup/new_cluster_test.go index 093459c281..a0ccea67e3 100644 --- a/upup/pkg/fi/cloudup/new_cluster_test.go +++ b/upup/pkg/fi/cloudup/new_cluster_test.go @@ -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"}, From 82eee758e0a6240b2d7f14533f6569c96ac32a16 Mon Sep 17 00:00:00 2001 From: Ciprian Hacman Date: Sat, 5 Dec 2020 05:16:55 +0200 Subject: [PATCH 2/2] Update expected outputs of integration tests --- .../ha_shared_zone/expected-v1alpha2.yaml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/integration/create_cluster/ha_shared_zone/expected-v1alpha2.yaml b/tests/integration/create_cluster/ha_shared_zone/expected-v1alpha2.yaml index a3031c4084..bdf033c57a 100644 --- a/tests/integration/create_cluster/ha_shared_zone/expected-v1alpha2.yaml +++ b/tests/integration/create_cluster/ha_shared_zone/expected-v1alpha2.yaml @@ -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: