diff --git a/cloud/deployment/deployment.go b/cloud/deployment/deployment.go index 576e9303b..d6f0a25f4 100644 --- a/cloud/deployment/deployment.go +++ b/cloud/deployment/deployment.go @@ -604,6 +604,9 @@ func ListClusterOptions(cloudProvider string, coreClient astrocore.CoreClient) ( if cloudProvider == awsCloud { provider = astrocore.GetClusterOptionsParamsProvider(astrocore.GetClusterOptionsParamsProviderAws) //nolint } + if cloudProvider == azureCloud { + provider = astrocore.GetClusterOptionsParamsProvider(astrocore.GetClusterOptionsParamsProviderAzure) //nolint + } optionsParams := &astrocore.GetClusterOptionsParams{ Provider: &provider, Type: astrocore.GetClusterOptionsParamsType(astrocore.GetClusterOptionsParamsTypeSHARED), //nolint @@ -1734,7 +1737,7 @@ func deploymentSelectionProcess(ws string, deployments []astroplatformcore.Deplo coreDeploymentType = astroplatformcore.DeploymentTypeSTANDARD dagDeploy = enable } - err = createDeployment("", ws, "", "", runtimeVersion, dagDeploy, CeleryExecutor, "gcp", "", "", "", "disable", cicdEnforcement, "", "", "", "", "", coreDeploymentType, 0, 0, platformCoreClient, coreClient, false) + err = createDeployment("", ws, "", "", runtimeVersion, dagDeploy, CeleryExecutor, "azure", "", "", "", "disable", cicdEnforcement, "", "", "", "", "", coreDeploymentType, 0, 0, platformCoreClient, coreClient, false) if err != nil { return astroplatformcore.Deployment{}, err } diff --git a/cmd/cloud/deployment.go b/cmd/cloud/deployment.go index cd3c1942e..07734d46e 100644 --- a/cmd/cloud/deployment.go +++ b/cmd/cloud/deployment.go @@ -99,7 +99,7 @@ var ( httpClient = httputil.NewHTTPClient() errFlag = errors.New("--deployment-file can not be used with other arguments") errInvalidExecutor = errors.New("not a valid executor") - errInvalidCloudProvider = errors.New("not a valid cloud provider. It can only be gcp or aws") + errInvalidCloudProvider = errors.New("not a valid cloud provider. It can only be gcp, azure or aws") ) func newDeploymentRootCmd(out io.Writer) *cobra.Command { @@ -407,7 +407,7 @@ func newDeploymentCreateCmd(out io.Writer) *cobra.Command { cmd.Flags().StringVarP(&defaultTaskPodMemory, "default-task-pod-memory", "", "", "The default task pod memory to use for the Deployment. Example value: 0.5Gi") cmd.Flags().StringVarP(&resourceQuotaCPU, "resource-quota-cpu", "", "", "The Deployment's CPU resource quota. Example value: 10") cmd.Flags().StringVarP(&resourceQuotaMemory, "resource-quota-memory", "", "", "The Deployment's memory resource quota. Example value: 20Gi") - cmd.Flags().StringVarP(&cloudProvider, "cloud-provider", "p", "gcp", "The Cloud Provider to use for the Deployment. Possible values can be gcp, aws.") + cmd.Flags().StringVarP(&cloudProvider, "cloud-provider", "p", "azure", "The Cloud Provider to use for the Deployment. Possible values can be gcp, aws, azure.") cmd.Flags().StringVarP(®ion, "region", "", "", "The Cloud Provider region to use for the Deployment.") cmd.Flags().StringVarP(&schedulerSize, "scheduler-size", "", "", "The size of scheduler for the Deployment. Possible values can be small, medium, large, extra_large") cmd.Flags().StringVarP(&highAvailability, "high-availability", "a", "disable", "Enables High Availability for the Deployment") @@ -869,7 +869,7 @@ func isValidExecutor(executor string) bool { // isValidCloudProvider returns true for valid CloudProvider values and false if not. func isValidCloudProvider(cloudProvider astrocore.SharedClusterCloudProvider) bool { - return cloudProvider == astrocore.SharedClusterCloudProviderGcp || cloudProvider == astrocore.SharedClusterCloudProviderAws + return cloudProvider == astrocore.SharedClusterCloudProviderGcp || cloudProvider == astrocore.SharedClusterCloudProviderAws || cloudProvider == astrocore.SharedClusterCloudProviderAzure } func addDeploymentUser(cmd *cobra.Command, args []string, out io.Writer) error { diff --git a/cmd/cloud/deployment_test.go b/cmd/cloud/deployment_test.go index 85809d8f2..34ffb438f 100644 --- a/cmd/cloud/deployment_test.go +++ b/cmd/cloud/deployment_test.go @@ -703,10 +703,10 @@ deployment: ctx.SetContextKey("workspace", ws) cmdArgs := []string{ "create", "--name", "test-name", "--workspace-id", ws, "--dag-deploy", "disable", - "--executor", "KubernetesExecutor", "--cloud-provider", "azure", + "--executor", "KubernetesExecutor", "--cloud-provider", "ibm", } _, err = execDeploymentCmd(cmdArgs...) - assert.ErrorContains(t, err, "azure is not a valid cloud provider. It can only be gcp") + assert.ErrorContains(t, err, "ibm is not a valid cloud provider. It can only be gcp") }) t.Run("creates a hosted dedicated deployment", func(t *testing.T) { ctx, err := context.GetCurrentContext() @@ -1445,8 +1445,12 @@ func TestIsValidCloudProvider(t *testing.T) { actual := isValidCloudProvider("aws") assert.True(t, actual) }) - t.Run("returns false if cloudProvider is not gcp", func(t *testing.T) { + t.Run("returns true if cloudProvider is azure", func(t *testing.T) { actual := isValidCloudProvider("azure") + assert.True(t, actual) + }) + t.Run("returns false if cloudProvider is not gcp,aws or azure", func(t *testing.T) { + actual := isValidCloudProvider("ibm") assert.False(t, actual) }) }