Skip to content

Commit

Permalink
feat(provider/azure): Enable data disk for server group (#3788)
Browse files Browse the repository at this point in the history
* feat(provider/azure): Enable data disk for server group

* feat(provider/azure): Enable data disk for server group
  • Loading branch information
Neil Ye authored and maggieneterval committed Jun 14, 2019
1 parent 6b67f22 commit b9b3dd0
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
package com.netflix.spinnaker.clouddriver.azure.resources.servergroup.model

import com.google.common.collect.Sets
import com.microsoft.azure.management.compute.VirtualMachineScaleSet
import com.microsoft.azure.management.compute.VirtualMachineScaleSetDataDisk
import com.microsoft.azure.management.compute.implementation.VirtualMachineScaleSetInner
import com.netflix.frigga.Names
import com.netflix.spinnaker.clouddriver.azure.AzureCloudProvider
Expand Down Expand Up @@ -70,6 +70,7 @@ class AzureServerGroupDescription extends AzureResourceOpsDescription implements
Boolean createNewSubnet = false
AzureExtensionCustomScriptSettings customScriptsSettings
Boolean enableInboundNAT = false
List<VirtualMachineScaleSetDataDisk> dataDisks

static class AzureScaleSetSku {
String name
Expand Down Expand Up @@ -193,14 +194,17 @@ class AzureServerGroupDescription extends AzureResourceOpsDescription implements
azureSG.upgradePolicy = getPolicyFromMode(scaleSet.upgradePolicy().mode().name())

// Get the image reference data
def imgRef = scaleSet.virtualMachineProfile()?.storageProfile()?.imageReference()
def storageProfile = scaleSet.virtualMachineProfile()?.storageProfile()
def imgRef = storageProfile?.imageReference()
if (imgRef) {
azureSG.image.offer = imgRef.offer()
azureSG.image.publisher = imgRef.publisher()
azureSG.image.sku = imgRef.sku()
azureSG.image.version = imgRef.version()
}

azureSG.dataDisks = storageProfile?.dataDisks()

// get the OS configuration data
def osConfig = new AzureOperatingSystemConfig()
def osProfile = scaleSet?.virtualMachineProfile()?.osProfile()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ package com.netflix.spinnaker.clouddriver.azure.templates
import com.fasterxml.jackson.annotation.JsonInclude
import com.fasterxml.jackson.databind.ObjectMapper
import com.fasterxml.jackson.databind.SerializationFeature
import com.microsoft.azure.management.compute.VirtualMachineScaleSetDataDisk
import com.netflix.spinnaker.clouddriver.azure.common.AzureUtilities
import com.netflix.spinnaker.clouddriver.azure.resources.loadbalancer.model.AzureLoadBalancer
import com.netflix.spinnaker.clouddriver.azure.resources.servergroup.model.AzureServerGroupDescription
Expand Down Expand Up @@ -681,13 +682,16 @@ class AzureServerGroupResourceTemplate {

OSDisk osDisk
String imageReference
List<VirtualMachineScaleSetDataDisk> dataDisks

/**
*
* @param serverGroupDescription
*/
ScaleSetStorageProfile(AzureServerGroupDescription description) {
osDisk = new VirtualMachineOSDisk(description)
imageReference = "[variables('imageReference')]"
dataDisks = description.dataDisks
}
}

Expand All @@ -705,12 +709,14 @@ class AzureServerGroupResourceTemplate {
*/
static class ScaleSetCustomManagedImageStorageProfile implements StorageProfile {
ImageReference imageReference
List<VirtualMachineScaleSetDataDisk> dataDisks
/**
*
* @param serverGroupDescription
*/
ScaleSetCustomManagedImageStorageProfile(AzureServerGroupDescription description) {
imageReference = new ImageReference(description)
dataDisks = description.dataDisks
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,8 @@ class AzureServerGroupResourceTemplateSpec extends Specification {
"createOption" : "FromImage",
"vhdContainers" : [ "[concat('https://', variables('uniqueStorageNameArray')[0], '.blob.core.windows.net/', variables('vhdContainerName'))]" ]
},
"imageReference" : "[variables('imageReference')]"
"imageReference" : "[variables('imageReference')]",
"dataDisks" : null
},
"osProfile" : {
"computerNamePrefix" : "azureMASM-",
Expand Down Expand Up @@ -430,7 +431,8 @@ class AzureServerGroupResourceTemplateSpec extends Specification {
"storageProfile" : {
"imageReference" : {
"id" : "/subscriptions/faab228d-df7a-4086-991e-e81c4659d41a/resourceGroups/zhqqi-sntest/providers/Microsoft.Compute/images/hello-karyon-rxnetty-all-20190125054410-ubuntu-1604"
}
},
"dataDisks" : null
},
"osProfile" : {
"computerNamePrefix" : "azureMASM-",
Expand Down Expand Up @@ -598,7 +600,8 @@ class AzureServerGroupResourceTemplateSpec extends Specification {
"createOption" : "FromImage",
"vhdContainers" : [ "[concat('https://', variables('uniqueStorageNameArray')[0], '.blob.core.windows.net/', variables('vhdContainerName'))]" ]
},
"imageReference" : "[variables('imageReference')]"
"imageReference" : "[variables('imageReference')]",
"dataDisks" : null
},
"osProfile" : {
"computerNamePrefix" : "azureMASM-",
Expand Down Expand Up @@ -781,7 +784,8 @@ class AzureServerGroupResourceTemplateSpec extends Specification {
"createOption" : "FromImage",
"vhdContainers" : [ "[concat('https://', variables('uniqueStorageNameArray')[0], '.blob.core.windows.net/', variables('vhdContainerName'))]" ]
},
"imageReference" : "[variables('imageReference')]"
"imageReference" : "[variables('imageReference')]",
"dataDisks" : null
},
"osProfile" : {
"computerNamePrefix" : "azureMASM-",
Expand Down Expand Up @@ -964,7 +968,8 @@ class AzureServerGroupResourceTemplateSpec extends Specification {
"createOption" : "FromImage",
"vhdContainers" : [ "[concat('https://', variables('uniqueStorageNameArray')[0], '.blob.core.windows.net/', variables('vhdContainerName'))]" ]
},
"imageReference" : "[variables('imageReference')]"
"imageReference" : "[variables('imageReference')]",
"dataDisks" : null
},
"osProfile" : {
"computerNamePrefix" : "azureMASM-",
Expand Down Expand Up @@ -1148,7 +1153,8 @@ class AzureServerGroupResourceTemplateSpec extends Specification {
"createOption" : "FromImage",
"vhdContainers" : [ "[concat('https://', variables('uniqueStorageNameArray')[0], '.blob.core.windows.net/', variables('vhdContainerName'))]" ]
},
"imageReference" : "[variables('imageReference')]"
"imageReference" : "[variables('imageReference')]",
"dataDisks" : null
},
"osProfile" : {
"computerNamePrefix" : "azureMASM-",
Expand Down Expand Up @@ -1334,7 +1340,8 @@ class AzureServerGroupResourceTemplateSpec extends Specification {
"createOption" : "FromImage",
"vhdContainers" : [ "[concat('https://', variables('uniqueStorageNameArray')[0], '.blob.core.windows.net/', variables('vhdContainerName'))]" ]
},
"imageReference" : "[variables('imageReference')]"
"imageReference" : "[variables('imageReference')]",
"dataDisks" : null
},
"osProfile" : {
"computerNamePrefix" : "azureMASM-",
Expand Down

0 comments on commit b9b3dd0

Please sign in to comment.