From 8713dc0a0b40eb00228c229879183544e87be906 Mon Sep 17 00:00:00 2001 From: Peter Amstutz Date: Wed, 22 Jul 2020 14:58:59 -0400 Subject: [PATCH] 16623: Add NetworkResourceGroup option for Azure refs #16623 Arvados-DCO-1.1-Signed-off-by: Peter Amstutz --- lib/cloud/azure/azure.go | 8 +++++++- lib/config/config.default.yml | 18 +++++++++++++++++- lib/config/generated_config.go | 18 +++++++++++++++++- 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/lib/cloud/azure/azure.go b/lib/cloud/azure/azure.go index 752de152da..6de367aa25 100644 --- a/lib/cloud/azure/azure.go +++ b/lib/cloud/azure/azure.go @@ -43,6 +43,7 @@ type azureInstanceSetConfig struct { ResourceGroup string Location string Network string + NetworkResourceGroup string Subnet string StorageAccount string BlobContainer string @@ -356,6 +357,11 @@ func (az *azureInstanceSet) Create( } tags["created-at"] = to.StringPtr(time.Now().Format(time.RFC3339Nano)) + networkResourceGroup := az.azconfig.NetworkResourceGroup + if networkResourceGroup == "" { + networkResourceGroup = az.azconfig.ResourceGroup + } + nicParameters := network.Interface{ Location: &az.azconfig.Location, Tags: tags, @@ -368,7 +374,7 @@ func (az *azureInstanceSet) Create( ID: to.StringPtr(fmt.Sprintf("/subscriptions/%s/resourceGroups/%s/providers"+ "/Microsoft.Network/virtualnetworks/%s/subnets/%s", az.azconfig.SubscriptionID, - az.azconfig.ResourceGroup, + networkResourceGroup, az.azconfig.Network, az.azconfig.Subnet)), }, diff --git a/lib/config/config.default.yml b/lib/config/config.default.yml index 907acdc878..96291a2d4b 100644 --- a/lib/config/config.default.yml +++ b/lib/config/config.default.yml @@ -1008,13 +1008,29 @@ Clusters: # (azure) Instance configuration. CloudEnvironment: AzurePublicCloud - ResourceGroup: "" Location: centralus + + # (azure) The resource group where the VM and virtual NIC will be + # created. + ResourceGroup: "" + + # (azure) The resource group of the Network to use for the virtual + # NIC (if different from ResourceGroup) + NetworkResourceGroup: "" Network: "" Subnet: "" + + # (azure) Where to store the VM VHD blobs StorageAccount: "" BlobContainer: "" + + # (azure) How long to wait before deleting VHD and NIC + # objects that are no longer being used. DeleteDanglingResourcesAfter: 20s + + # Account (that already exists in the VM image) that will be + # set up with an ssh authorized key to allow the compute + # dispatcher to connect. AdminUsername: arvados InstanceTypes: diff --git a/lib/config/generated_config.go b/lib/config/generated_config.go index 96da19dfcd..2790477e4a 100644 --- a/lib/config/generated_config.go +++ b/lib/config/generated_config.go @@ -1014,13 +1014,29 @@ Clusters: # (azure) Instance configuration. CloudEnvironment: AzurePublicCloud - ResourceGroup: "" Location: centralus + + # (azure) The resource group where the VM and virtual NIC will be + # created. + ResourceGroup: "" + + # (azure) The resource group of the Network to use for the virtual + # NIC (if different from ResourceGroup) + NetworkResourceGroup: "" Network: "" Subnet: "" + + # (azure) Where to store the VM VHD blobs StorageAccount: "" BlobContainer: "" + + # (azure) How long to wait before deleting VHD and NIC + # objects that are no longer being used. DeleteDanglingResourcesAfter: 20s + + # Account (that already exists in the VM image) that will be + # set up with an ssh authorized key to allow the compute + # dispatcher to connect. AdminUsername: arvados InstanceTypes: -- 2.39.5