Skip to content
This repository has been archived by the owner on Jan 11, 2023. It is now read-only.

Remove storageAccounts from K8s VMSS #2830

Merged
merged 3 commits into from
May 1, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion examples/kubernetes-vmss/kubernetes.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
"name": "agentpool1",
"count": 3,
"vmSize": "Standard_D2_v2",
"availabilityProfile": "VirtualMachineScaleSets"
"availabilityProfile": "VirtualMachineScaleSets",
"storageProfile": "ManagedDisks"
}
],
"linuxProfile": {
Expand Down
56 changes: 0 additions & 56 deletions parts/k8s/kubernetesagentresourcesvmss.t
Original file line number Diff line number Diff line change
@@ -1,47 +1,3 @@
{{if .IsStorageAccount}}
{
"apiVersion": "[variables('apiVersionStorage')]",
"copy": {
"count": "[variables('{{.Name}}StorageAccountsCount')]",
"name": "loop"
},
{{if not IsHostedMaster}}
{{if not IsPrivateCluster}}
"dependsOn": [
"[concat('Microsoft.Network/publicIPAddresses/', variables('masterPublicIPAddressName'))]"
],
{{end}}
{{end}}
"location": "[variables('location')]",
"name": "[concat(variables('storageAccountPrefixes')[mod(add(copyIndex(),variables('{{.Name}}StorageAccountOffset')),variables('storageAccountPrefixesCount'))],variables('storageAccountPrefixes')[div(add(copyIndex(),variables('{{.Name}}StorageAccountOffset')),variables('storageAccountPrefixesCount'))],variables('{{.Name}}AccountName'))]",
"properties": {
"accountType": "[variables('vmSizesMap')[variables('{{.Name}}VMSize')].storageAccountType]"
},
"type": "Microsoft.Storage/storageAccounts"
},
{{if .HasDisks}}
{
"apiVersion": "[variables('apiVersionStorage')]",
"copy": {
"count": "[variables('{{.Name}}StorageAccountsCount')]",
"name": "datadiskLoop"
},
{{if not IsHostedMaster}}
{{if not IsPrivateCluster}}
"dependsOn": [
"[concat('Microsoft.Network/publicIPAddresses/', variables('masterPublicIPAddressName'))]"
],
{{end}}
{{end}}
"location": "[variables('location')]",
"name": "[concat(variables('storageAccountPrefixes')[mod(add(copyIndex(variables('dataStorageAccountPrefixSeed')),variables('{{.Name}}StorageAccountOffset')),variables('storageAccountPrefixesCount'))],variables('storageAccountPrefixes')[div(add(copyIndex(variables('dataStorageAccountPrefixSeed')),variables('{{.Name}}StorageAccountOffset')),variables('storageAccountPrefixesCount'))],variables('{{.Name}}DataAccountName'))]",
"properties": {
"accountType": "[variables('vmSizesMap')[variables('{{.Name}}VMSize')].storageAccountType]"
},
"type": "Microsoft.Storage/storageAccounts"
},
{{end}}
{{end}}
{{if UseManagedIdentity}}
{
"apiVersion": "2014-10-01-preview",
Expand All @@ -61,12 +17,6 @@
{{else}}
"[variables('vnetID')]"
{{end}}
{{if .IsStorageAccount}}
,"[concat('Microsoft.Storage/storageAccounts/',variables('storageAccountPrefixes')[mod(add(div(0,variables('maxVMsPerStorageAccount')),variables('{{.Name}}StorageAccountOffset')),variables('storageAccountPrefixesCount'))],variables('storageAccountPrefixes')[div(add(div(0,variables('maxVMsPerStorageAccount')),variables('{{.Name}}StorageAccountOffset')),variables('storageAccountPrefixesCount'))],variables('{{.Name}}AccountName'))]"
{{if .HasDisks}}
,"[concat('Microsoft.Storage/storageAccounts/',variables('storageAccountPrefixes')[mod(add(add(div(0,variables('maxVMsPerStorageAccount')),variables('{{.Name}}StorageAccountOffset')),variables('dataStorageAccountPrefixSeed')),variables('storageAccountPrefixesCount'))],variables('storageAccountPrefixes')[div(add(add(div(0,variables('maxVMsPerStorageAccount')),variables('{{.Name}}StorageAccountOffset')),variables('dataStorageAccountPrefixSeed')),variables('storageAccountPrefixesCount'))],variables('{{.Name}}DataAccountName'))]"
{{end}}
{{end}}
],
"tags":
{
Expand Down Expand Up @@ -164,12 +114,6 @@
"osDisk": {
"createOption": "FromImage",
"caching": "ReadWrite"
{{if .IsStorageAccount}}
,"name": "[concat(variables('{{.Name}}VMNamePrefix'),'-osdisk')]"
,"vhdContainers": [
"[concat(reference(concat('Microsoft.Storage/storageAccounts/',variables('storageAccountPrefixes')[mod(add(0,variables('{{.Name}}StorageAccountOffset')),variables('storageAccountPrefixesCount'))],variables('storageAccountPrefixes')[div(add(0,variables('{{.Name}}StorageAccountOffset')),variables('storageAccountPrefixesCount'))],variables('{{.Name}}AccountName')),variables('apiVersionStorage')).primaryEndpoints.blob,'osdisk')]"
]
{{end}}
{{if ne .OSDiskSizeGB 0}}
,"diskSizeGB": {{.OSDiskSizeGB}}
{{end}}
Expand Down
56 changes: 0 additions & 56 deletions parts/k8s/kuberneteswinagentresourcesvmss.t
Original file line number Diff line number Diff line change
@@ -1,47 +1,3 @@
{{if .IsStorageAccount}}
{
"apiVersion": "[variables('apiVersionStorage')]",
"copy": {
"count": "[variables('{{.Name}}StorageAccountsCount')]",
"name": "loop"
},
{{if not IsHostedMaster}}
{{if not IsPrivateCluster}}
"dependsOn": [
"[concat('Microsoft.Network/publicIPAddresses/', variables('masterPublicIPAddressName'))]"
],
{{end}}
{{end}}
"location": "[variables('location')]",
"name": "[concat(variables('storageAccountPrefixes')[mod(add(copyIndex(),variables('{{.Name}}StorageAccountOffset')),variables('storageAccountPrefixesCount'))],variables('storageAccountPrefixes')[div(add(copyIndex(),variables('{{.Name}}StorageAccountOffset')),variables('storageAccountPrefixesCount'))],variables('{{.Name}}AccountName'))]",
"properties": {
"accountType": "[variables('vmSizesMap')[variables('{{.Name}}VMSize')].storageAccountType]"
},
"type": "Microsoft.Storage/storageAccounts"
},
{{if .HasDisks}}
{
"apiVersion": "[variables('apiVersionStorage')]",
"copy": {
"count": "[variables('{{.Name}}StorageAccountsCount')]",
"name": "datadiskLoop"
},
{{if not IsHostedMaster}}
{{if not IsPrivateCluster}}
"dependsOn": [
"[concat('Microsoft.Network/publicIPAddresses/', variables('masterPublicIPAddressName'))]"
],
{{end}}
{{end}}
"location": "[variables('location')]",
"name": "[concat(variables('storageAccountPrefixes')[mod(add(copyIndex(variables('dataStorageAccountPrefixSeed')),variables('{{.Name}}StorageAccountOffset')),variables('storageAccountPrefixesCount'))],variables('storageAccountPrefixes')[div(add(copyIndex(variables('dataStorageAccountPrefixSeed')),variables('{{.Name}}StorageAccountOffset')),variables('storageAccountPrefixesCount'))],variables('{{.Name}}DataAccountName'))]",
"properties": {
"accountType": "[variables('vmSizesMap')[variables('{{.Name}}VMSize')].storageAccountType]"
},
"type": "Microsoft.Storage/storageAccounts"
},
{{end}}
{{end}}
{{if UseManagedIdentity}}
{
"apiVersion": "2014-10-01-preview",
Expand All @@ -61,12 +17,6 @@
{{else}}
"[variables('vnetID')]"
{{end}}
{{if .IsStorageAccount}}
,"[concat('Microsoft.Storage/storageAccounts/',variables('storageAccountPrefixes')[mod(add(div(0,variables('maxVMsPerStorageAccount')),variables('{{.Name}}StorageAccountOffset')),variables('storageAccountPrefixesCount'))],variables('storageAccountPrefixes')[div(add(div(0,variables('maxVMsPerStorageAccount')),variables('{{.Name}}StorageAccountOffset')),variables('storageAccountPrefixesCount'))],variables('{{.Name}}AccountName'))]"
{{if .HasDisks}}
,"[concat('Microsoft.Storage/storageAccounts/',variables('storageAccountPrefixes')[mod(add(add(div(0,variables('maxVMsPerStorageAccount')),variables('{{.Name}}StorageAccountOffset')),variables('dataStorageAccountPrefixSeed')),variables('storageAccountPrefixesCount'))],variables('storageAccountPrefixes')[div(add(add(div(0,variables('maxVMsPerStorageAccount')),variables('{{.Name}}StorageAccountOffset')),variables('dataStorageAccountPrefixSeed')),variables('storageAccountPrefixesCount'))],variables('{{.Name}}DataAccountName'))]"
{{end}}
{{end}}
],
"tags":
{
Expand Down Expand Up @@ -144,12 +94,6 @@
"osDisk": {
"createOption": "FromImage",
"caching": "ReadWrite"
{{if .IsStorageAccount}}
,"name": "[concat(variables('{{.Name}}VMNamePrefix'),'-osdisk')]"
,"vhdContainers": [
"[concat(reference(concat('Microsoft.Storage/storageAccounts/',variables('storageAccountPrefixes')[mod(add(0,variables('{{.Name}}StorageAccountOffset')),variables('storageAccountPrefixesCount'))],variables('storageAccountPrefixes')[div(add(0,variables('{{.Name}}StorageAccountOffset')),variables('storageAccountPrefixesCount'))],variables('{{.Name}}AccountName')),variables('apiVersionStorage')).primaryEndpoints.blob,'osdisk')]"
]
{{end}}
{{if ne .OSDiskSizeGB 0}}
,"diskSizeGB": {{.OSDiskSizeGB}}
{{end}}
Expand Down
5 changes: 1 addition & 4 deletions pkg/acsengine/testdata/disks-managed/kubernetes-vmss.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@
"provisioningState": "",
"orchestratorProfile": {
"orchestratorType": "Kubernetes",
"orchestratorRelease": "1.10",
"kubernetesConfig": {
"useInstanceMetadata": false
}
"orchestratorRelease": "1.10"
},
"masterProfile": {
"count": 1,
Expand Down
41 changes: 25 additions & 16 deletions pkg/acsengine/testdata/largeclusters/kubernetes-vmss.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@
"properties": {
"orchestratorProfile": {
"orchestratorType": "Kubernetes",
"orchestratorRelease": "1.10",
"kubernetesConfig": {
"useInstanceMetadata": false
}
"orchestratorRelease": "1.10"
},
"masterProfile": {
"count": 1,
Expand All @@ -18,73 +15,85 @@
"name": "agentpool1",
"count": 3,
"vmSize": "Standard_D2_v2",
"availabilityProfile": "VirtualMachineScaleSets"
"availabilityProfile": "VirtualMachineScaleSets",
"storageProfile": "ManagedDisks"
},
{
"name": "agentpool2",
"count": 3,
"vmSize": "Standard_D2_v2",
"availabilityProfile": "VirtualMachineScaleSets"
"availabilityProfile": "VirtualMachineScaleSets",
"storageProfile": "ManagedDisks"
},
{
"name": "agentpool3",
"count": 100,
"vmSize": "Standard_D2_v2",
"availabilityProfile": "VirtualMachineScaleSets"
"availabilityProfile": "VirtualMachineScaleSets",
"storageProfile": "ManagedDisks"
},
{
"name": "agentpool4",
"count": 100,
"vmSize": "Standard_D2_v2",
"availabilityProfile": "VirtualMachineScaleSets"
"availabilityProfile": "VirtualMachineScaleSets",
"storageProfile": "ManagedDisks"
},
{
"name": "agentpool5",
"count": 100,
"vmSize": "Standard_D2_v2",
"availabilityProfile": "VirtualMachineScaleSets"
"availabilityProfile": "VirtualMachineScaleSets",
"storageProfile": "ManagedDisks"
},
{
"name": "agentpool6",
"count": 100,
"vmSize": "Standard_D2_v2",
"availabilityProfile": "VirtualMachineScaleSets"
"availabilityProfile": "VirtualMachineScaleSets",
"storageProfile": "ManagedDisks"
},
{
"name": "agentpool7",
"count": 100,
"vmSize": "Standard_D2_v2",
"availabilityProfile": "VirtualMachineScaleSets"
"availabilityProfile": "VirtualMachineScaleSets",
"storageProfile": "ManagedDisks"
},
{
"name": "agentpool8",
"count": 100,
"vmSize": "Standard_D2_v2",
"availabilityProfile": "VirtualMachineScaleSets"
"availabilityProfile": "VirtualMachineScaleSets",
"storageProfile": "ManagedDisks"
},
{
"name": "agentpool9",
"count": 100,
"vmSize": "Standard_D2_v2",
"availabilityProfile": "VirtualMachineScaleSets"
"availabilityProfile": "VirtualMachineScaleSets",
"storageProfile": "ManagedDisks"
},
{
"name": "agentpool10",
"count": 100,
"vmSize": "Standard_D2_v2",
"availabilityProfile": "VirtualMachineScaleSets"
"availabilityProfile": "VirtualMachineScaleSets",
"storageProfile": "ManagedDisks"
},
{
"name": "agentpool11",
"count": 100,
"vmSize": "Standard_D2_v2",
"availabilityProfile": "VirtualMachineScaleSets"
"availabilityProfile": "VirtualMachineScaleSets",
"storageProfile": "ManagedDisks"
},
{
"name": "agentpool12",
"count": 100,
"vmSize": "Standard_D2_v2",
"availabilityProfile": "VirtualMachineScaleSets"
"availabilityProfile": "VirtualMachineScaleSets",
"storageProfile": "ManagedDisks"
}
],
"linuxProfile": {
Expand Down
3 changes: 2 additions & 1 deletion pkg/acsengine/testdata/windows/kubernetes-vmss.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
"count": 3,
"vmSize": "Standard_D2_v2",
"availabilityProfile": "VirtualMachineScaleSets",
"osType": "Windows"
"osType": "Windows",
"storageProfile": "ManagedDisks"
}
],
"windowsProfile": {
Expand Down
4 changes: 4 additions & 0 deletions pkg/api/vlabs/validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -558,6 +558,10 @@ func (a *Properties) Validate(isUpdate bool) error {
}
}

if a.OrchestratorProfile.OrchestratorType == Kubernetes && (agentPoolProfile.AvailabilityProfile == VirtualMachineScaleSets || len(agentPoolProfile.AvailabilityProfile) == 0) && agentPoolProfile.StorageProfile == StorageAccount {
return fmt.Errorf("VirtualMachineScaleSets does not support %s disks. Please specify \"storageProfile\": \"%s\" (recommended) or \"availabilityProfile\": \"%s\"", StorageAccount, ManagedDisks, AvailabilitySet)
}

if a.OrchestratorProfile.OrchestratorType == Kubernetes {
if i == 0 {
continue
Expand Down