@@ -31,12 +31,12 @@ var (
3131)
3232
3333var (
34- validAzureCloudNames = map [configv1.AzureCloudEnvironment ]bool {
35- configv1 .AzurePublicCloud : true ,
36- configv1 .AzureUSGovernmentCloud : true ,
37- configv1 .AzureChinaCloud : true ,
38- configv1 .AzureGermanCloud : true ,
39- configv1 .AzureStackCloud : true ,
34+ validAzureCloudNames = map [configv1.AzureCloudEnvironment ]struct {} {
35+ configv1 .AzurePublicCloud : struct {}{} ,
36+ configv1 .AzureUSGovernmentCloud : struct {}{} ,
37+ configv1 .AzureChinaCloud : struct {}{} ,
38+ configv1 .AzureGermanCloud : struct {}{} ,
39+ configv1 .AzureStackCloud : struct {}{} ,
4040 }
4141
4242 validAzureCloudNameValues = func () []string {
@@ -111,6 +111,9 @@ func NewProviderAssets(config config.OperatorConfig) (common.CloudProviderAssets
111111 return assets , nil
112112}
113113
114+ // IsAzure ensures that the underlying platform is Azure. It will fail if the
115+ // CloudName is AzureStack as we handle it separately with it's own
116+ // CloudConfigTransformer.
114117func IsAzure (infra * configv1.Infrastructure ) bool {
115118 if infra .Status .PlatformStatus != nil {
116119 if infra .Status .PlatformStatus .Type == configv1 .AzurePlatformType &&
@@ -144,7 +147,7 @@ func CloudConfigTransformer(source string, infra *configv1.Infrastructure, netwo
144147 cloud := configv1 .AzurePublicCloud
145148 if azurePlatform := infra .Status .PlatformStatus .Azure ; azurePlatform != nil {
146149 if c := azurePlatform .CloudName ; c != "" {
147- if ! validAzureCloudNames [c ] {
150+ if _ , ok := validAzureCloudNames [c ]; ! ok {
148151 return "" , field .NotSupported (field .NewPath ("status" , "platformStatus" , "azure" , "cloudName" ), c , validAzureCloudNameValues )
149152 }
150153 cloud = c
@@ -159,12 +162,8 @@ func CloudConfigTransformer(source string, infra *configv1.Infrastructure, netwo
159162 cloud.conf conflicts with infrastructure object` )
160163 }
161164 }
162-
163165 cfg .Cloud = string (cloud )
164166
165- // TODO: Remove when you work this out (before merging)
166- // Why is cfg.Cloud not typed: type AzureCloudEnvironment string
167-
168167 // If the virtual machine type is not set we need to make sure it uses the
169168 // "standard" instance type. See OCPBUGS-25483 and OCPBUGS-20213 for more
170169 // information
0 commit comments