-
Notifications
You must be signed in to change notification settings - Fork 139
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #192 from staebler/azure_other_cloud_env
support other Azure cloud environments
- Loading branch information
Showing
34 changed files
with
1,110 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package util | ||
|
||
import ( | ||
configv1 "github.com/openshift/api/config/v1" | ||
) | ||
|
||
// GetAzureCloudName gets the Azure cloud name to use given the specified infrastructure status. | ||
func GetAzureCloudName(infraStatus *configv1.InfrastructureStatus) configv1.AzureCloudEnvironment { | ||
if s := infraStatus.PlatformStatus; s != nil { | ||
if a := s.Azure; a != nil { | ||
if c := a.CloudName; c != "" { | ||
return c | ||
} | ||
} | ||
} | ||
return configv1.AzurePublicCloud | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
package util | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
|
||
configv1 "github.com/openshift/api/config/v1" | ||
) | ||
|
||
func TestGetAzureCloudName(t *testing.T) { | ||
cases := []struct { | ||
name string | ||
infraStatus *configv1.InfrastructureStatus | ||
expectedCloudName configv1.AzureCloudEnvironment | ||
}{ | ||
{ | ||
name: "no platform status", | ||
infraStatus: &configv1.InfrastructureStatus{}, | ||
expectedCloudName: configv1.AzurePublicCloud, | ||
}, | ||
{ | ||
name: "no azure", | ||
infraStatus: &configv1.InfrastructureStatus{ | ||
PlatformStatus: &configv1.PlatformStatus{}, | ||
}, | ||
expectedCloudName: configv1.AzurePublicCloud, | ||
}, | ||
{ | ||
name: "no cloud name", | ||
infraStatus: &configv1.InfrastructureStatus{ | ||
PlatformStatus: &configv1.PlatformStatus{ | ||
Azure: &configv1.AzurePlatformStatus{}, | ||
}, | ||
}, | ||
expectedCloudName: configv1.AzurePublicCloud, | ||
}, | ||
{ | ||
name: "default cloud name", | ||
infraStatus: &configv1.InfrastructureStatus{ | ||
PlatformStatus: &configv1.PlatformStatus{ | ||
Azure: &configv1.AzurePlatformStatus{ | ||
CloudName: configv1.AzurePublicCloud, | ||
}, | ||
}, | ||
}, | ||
expectedCloudName: configv1.AzurePublicCloud, | ||
}, | ||
{ | ||
name: "non-default cloud name", | ||
infraStatus: &configv1.InfrastructureStatus{ | ||
PlatformStatus: &configv1.PlatformStatus{ | ||
Azure: &configv1.AzurePlatformStatus{ | ||
CloudName: configv1.AzureUSGovernmentCloud, | ||
}, | ||
}, | ||
}, | ||
expectedCloudName: configv1.AzureUSGovernmentCloud, | ||
}, | ||
} | ||
for _, tc := range cases { | ||
t.Run(tc.name, func(t *testing.T) { | ||
actualCloudName := GetAzureCloudName(tc.infraStatus) | ||
assert.Equal(t, tc.expectedCloudName, actualCloudName) | ||
}) | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.