From bcf5cc7034b882520b9a6f8bdd6053966f547f14 Mon Sep 17 00:00:00 2001 From: Akshay Gupta Date: Tue, 17 Sep 2019 16:30:43 -0700 Subject: [PATCH] ignore casing for MC prefix (#536) --- pkg/azure/azure.go | 2 +- pkg/azure/azure_test.go | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/pkg/azure/azure.go b/pkg/azure/azure.go index 36a163224..5de7130ca 100644 --- a/pkg/azure/azure.go +++ b/pkg/azure/azure.go @@ -41,7 +41,7 @@ func ConvertToClusterResourceGroup(subscriptionID SubscriptionID, resourceGroup } split := strings.Split(string(resourceGroup), "_") - if len(split) != 4 || split[0] != "MC" { + if len(split) != 4 || strings.ToUpper(split[0]) != "MC" { logLine := fmt.Sprintf("infrastructure resource group name: %s is expected to be of format MC_ResourceGroup_ResourceName_Location", string(resourceGroup)) return "", errors.New(logLine) } diff --git a/pkg/azure/azure_test.go b/pkg/azure/azure_test.go index 0ae0c5b1e..12259f1e1 100644 --- a/pkg/azure/azure_test.go +++ b/pkg/azure/azure_test.go @@ -45,6 +45,10 @@ var _ = Describe("Azure", func() { subID := SubscriptionID("xxxx") resGp := ResourceGroup("MC_resgp_resName_location") Expect(ConvertToClusterResourceGroup(subID, resGp, nil)).To(Equal("/subscriptions/xxxx/resourcegroups/resgp/providers/Microsoft.ContainerService/managedClusters/resName")) + + subID = SubscriptionID("xxxx") + resGp = ResourceGroup("mc_resgp_resName_location") + Expect(ConvertToClusterResourceGroup(subID, resGp, nil)).To(Equal("/subscriptions/xxxx/resourcegroups/resgp/providers/Microsoft.ContainerService/managedClusters/resName")) }) }) })