From 023b92a18841edaf2e700182fc3f0a3fa89b15e0 Mon Sep 17 00:00:00 2001 From: Blair L Murri Date: Mon, 30 Sep 2024 11:31:03 -0700 Subject: [PATCH 1/2] Enable specifying AksClusterName for new deployments --- src/deploy-cromwell-on-azure/Configuration.cs | 1 + src/deploy-cromwell-on-azure/Deployer.cs | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/deploy-cromwell-on-azure/Configuration.cs b/src/deploy-cromwell-on-azure/Configuration.cs index c4d9c3f9..dc450de3 100644 --- a/src/deploy-cromwell-on-azure/Configuration.cs +++ b/src/deploy-cromwell-on-azure/Configuration.cs @@ -97,6 +97,7 @@ public abstract class UserAccessibleConfiguration public string DeploymentEnvironment { get; set; } public string PrivateTestUbuntuImage { get; set; } = "mcr.microsoft.com/mirror/docker/library/ubuntu:22.04"; public string PrivatePSQLUbuntuImage { get; set; } = "mcr.microsoft.com/mirror/docker/library/ubuntu:24.04"; // mcr's docker mirror does not host "latest" + public bool? CreateMissing { get; set; } = false; public static Configuration BuildConfiguration(string[] args) { diff --git a/src/deploy-cromwell-on-azure/Deployer.cs b/src/deploy-cromwell-on-azure/Deployer.cs index 48d81f26..a13f3250 100644 --- a/src/deploy-cromwell-on-azure/Deployer.cs +++ b/src/deploy-cromwell-on-azure/Deployer.cs @@ -821,7 +821,7 @@ private async Task ValidateAndGetExistin } return (await GetExistingAKSClusterAsync(configuration.AksClusterName)) - ?? throw new ValidationException($"If AKS cluster name is provided, the cluster must already exist in region {configuration.RegionName}, and be accessible to the current user.", displayExample: false); + ?? (configuration.CreateMissing.GetValueOrDefault() ? null : throw new ValidationException($"If AKS cluster name is provided, the cluster must already exist in region {configuration.RegionName}, and be accessible to the current user. Set {nameof(configuration.CreateMissing)} to true to create cluster with provided name.", displayExample: false)); } private async Task GetExistingPostgresqlService(string serverName) @@ -2236,8 +2236,12 @@ void ValidateHelmInstall(string helmPath, string featureName) ThrowIfNotProvidedForUpdate(configuration.ResourceGroupName, nameof(configuration.ResourceGroupName)); - ThrowIfProvidedForInstall(configuration.AksClusterName, nameof(configuration.AksClusterName)); + if (!configuration.CreateMissing.GetValueOrDefault()) + { + ThrowIfProvidedForInstall(configuration.AksClusterName, nameof(configuration.AksClusterName)); + } + ThrowIfProvidedForUpdate(configuration.CreateMissing, nameof(configuration.CreateMissing)); ThrowIfProvidedForUpdate(configuration.BatchPrefix, nameof(configuration.BatchPrefix)); ThrowIfProvidedForUpdate(configuration.RegionName, nameof(configuration.RegionName)); ThrowIfProvidedForUpdate(configuration.BatchAccountName, nameof(configuration.BatchAccountName)); From ed2fec1659626e70beb78c2e727a74d870d9c560 Mon Sep 17 00:00:00 2001 From: Blair L Murri Date: Mon, 30 Sep 2024 13:04:55 -0700 Subject: [PATCH 2/2] address copy-paste misshap --- src/deploy-cromwell-on-azure/Configuration.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/deploy-cromwell-on-azure/Configuration.cs b/src/deploy-cromwell-on-azure/Configuration.cs index dc450de3..87b01d6a 100644 --- a/src/deploy-cromwell-on-azure/Configuration.cs +++ b/src/deploy-cromwell-on-azure/Configuration.cs @@ -97,7 +97,7 @@ public abstract class UserAccessibleConfiguration public string DeploymentEnvironment { get; set; } public string PrivateTestUbuntuImage { get; set; } = "mcr.microsoft.com/mirror/docker/library/ubuntu:22.04"; public string PrivatePSQLUbuntuImage { get; set; } = "mcr.microsoft.com/mirror/docker/library/ubuntu:24.04"; // mcr's docker mirror does not host "latest" - public bool? CreateMissing { get; set; } = false; + public bool? CreateMissing { get; set; } = null; public static Configuration BuildConfiguration(string[] args) {