From 0635fe59fbcda8b1081374f67009d6ed6335a8d7 Mon Sep 17 00:00:00 2001 From: Gerardo Saca Date: Fri, 2 Mar 2018 16:17:15 -0500 Subject: [PATCH] Reuse GetCloudTargetEnv in FormatAzureProdFQDN (#2376) * reuse GetCloudTargetEnv in FormatAzureProdFQDN * Fix FQDNFormat lint error --- pkg/acsengine/engine.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/pkg/acsengine/engine.go b/pkg/acsengine/engine.go index c1cde07d8d..8f45681122 100644 --- a/pkg/acsengine/engine.go +++ b/pkg/acsengine/engine.go @@ -368,13 +368,16 @@ func FormatAzureProdFQDNs(fqdnPrefix string) []string { // FormatAzureProdFQDN constructs an Azure prod fqdn func FormatAzureProdFQDN(fqdnPrefix string, location string) string { - FQDNFormat := AzureCloudSpec.EndpointConfig.ResourceManagerVMDNSSuffix - if location == "chinaeast" || location == "chinanorth" { + var FQDNFormat string + switch GetCloudTargetEnv(location) { + case azureChinaCloud: FQDNFormat = AzureChinaCloudSpec.EndpointConfig.ResourceManagerVMDNSSuffix - } else if location == "germanynortheast" || location == "germanycentral" { + case azureGermanCloud: FQDNFormat = AzureGermanCloudSpec.EndpointConfig.ResourceManagerVMDNSSuffix - } else if location == "usgovvirginia" || location == "usgoviowa" || location == "usgovarizona" || location == "usgovtexas" { + case azureUSGovernmentCloud: FQDNFormat = AzureUSGovernmentCloud.EndpointConfig.ResourceManagerVMDNSSuffix + default: + FQDNFormat = AzureCloudSpec.EndpointConfig.ResourceManagerVMDNSSuffix } return fmt.Sprintf("%s.%s."+FQDNFormat, fqdnPrefix, location) }