New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
support for other Azure cloud environments #3634
support for other Azure cloud environments #3634
Conversation
/hold This is currently vendoring an openshift/api fork until openshift/api#650 merges. |
f5e3051
to
790b4cb
Compare
/test e2e-azure |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had a chance to read through this and it looks really good. Left a few suggestions in case they are helpful.
@@ -105,8 +108,8 @@ func getRegions() (map[string]string, error) { | |||
return allLocations, nil | |||
} | |||
|
|||
func getResourceCapableRegions() ([]string, error) { | |||
client, err := NewClient(context.TODO()) | |||
func getResourceCapableRegions(cloudName azure.CloudEnvironment) ([]string, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might make more sense for these (getRegions
and getResourceCapableRegions
) to live in the azure client API. In general I think anything that uses a client should follow this pattern, but I'm not very familiar with the Azure code.
Moving it to the API interface would allow mocking and testing these functions. You didn't create these functions so just a suggestion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not agree that the functions make more sense as part of the client API. The functions rely on making calls to the client API and formatting the results in ways specific to what is needed by the Azure Platform. I do, however, take your point that it would be good to be able to mock and test the functions. So, in that vein, I will change the functions to take a client as a parameter rather than creating a client inside the function.
@@ -23,7 +26,7 @@ func (params CloudProviderConfig) JSON() (string, error) { | |||
resourceGroupName := params.ResourcePrefix + "-rg" | |||
config := config{ | |||
authConfig: authConfig{ | |||
Cloud: "AzurePublicCloud", | |||
Cloud: string(params.CloudName), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm I dislike casting or type conversion in general but I don't think there's anyway around this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I could add a function like the following.
// Environment returns name that Azure uses for the cloud environment.
// See https://github.com/Azure/go-autorest/blob/ec5f4903f77ed9927ac95b19ab8e44ada64c1356/autorest/azure/environments.go#L13
func (e CloudEnvironment) Name() string {
return string(e)
}
That would push the casting to a location closer to where the enum is defined. I don't know of any precedence for this approach, though.
Cloud: string(params.CloudName), | |
Cloud: params.CloudName.Name(), |
790b4cb
to
8b10d04
Compare
/hold cancel The PR has been updated to vendor the latest from openshift/api. The initial code review feedback has been addressed. /cc @jhixson74 |
/approve |
/test e2e-azure |
/test e2e-azure |
Add the `azure.cloudName` field to the installconfig. This field directs which Azure cloud environment is used for the cluster. The `status.platformStatus.azure.cloudName` field is set in the infrastructure.config.openshift.io resource to match the cloud name configured in the installconfig. The `cloud` field is set in the cloud-provider-config ConfigMap to match the cloud name configured in the installconfig. See openshift/enhancements#321 https://issues.redhat.com/browse/CORS-1442
020e32c
to
0af108c
Compare
|
Use the cloud name specified in the installconfig to have the installer, destroyer, and terraform connect to the correct Azure cloud environment. https://issues.redhat.com/browse/CORS-1442
Bump to the latest github.com/openshift/api version in order to pick up changes to the infrastructure.config.openshift.io type for supporting other Azure cloud environments. Changes from openshift/api#650. https://issues.redhat.com/browse/CORS-1442
0af108c
to
833be8c
Compare
/test e2e-azure |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: abhinavdahiya, jhixson74 The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/lgtm |
/retest Please review the full test history for this PR and help us cut down flakes. |
When support for other Azure cloud environments was added [1], there were some necessary changes that were omitted. * Azure clients that are created need to use the base URI appropriate for the cloud environment. * Azure authorizers need to use the ActiveDirectory endpoint appropriate for the cloud environment. * The environment needs to be specified for the terraform azureprivatedns provider. [1] openshift#3634
When support for other Azure cloud environments was added [1], there were some necessary changes that were omitted. * Azure clients that are created need to use the base URI appropriate for the cloud environment. * Azure authorizers need to use the ActiveDirectory endpoint appropriate for the cloud environment. * The environment needs to be specified for the terraform azureprivatedns provider. [1] openshift#3634
Add the
azure.cloudName
field to the installconfig. This field directs which Azure cloud environment is used for the cluster.The
status.platformStatus.azure.cloudName
field is set in the infrastructure.config.openshift.io resource to match the cloud name configured in the installconfig.The
cloud
field is set in the cloud-provider-config ConfigMap to match the cloud name configured in the installconfig.Use the cloud name specified in the installconfig to have the installer, destroyer, and terraform connect to the correct Azure cloud environment.
See openshift/enhancements#321
https://issues.redhat.com/browse/CORS-1442