Skip to content

Commit 24be97d

Browse files
committed
ref(contrib/azure): use ARM template for Azure deployment
1 parent cf231e6 commit 24be97d

6 files changed

Lines changed: 455 additions & 384 deletions

File tree

contrib/azure/arm-template.json

Lines changed: 387 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,387 @@
1+
{
2+
"$schema": "http://schema.management.azure.com/schemas/2014-04-01-preview/deploymentTemplate.json",
3+
"contentVersion": "1.0.0.0",
4+
"parameters": {
5+
"newStorageAccountName": {
6+
"type": "string",
7+
"metadata": {
8+
"description": "Name of the of the storage account for VM OS Disk"
9+
}
10+
},
11+
"publicDomainName": {
12+
"type": "string",
13+
"metadata": {
14+
"description": "Domain name associated with the load balancer public IP"
15+
}
16+
},
17+
"dnsPrefixNameForPublicIP": {
18+
"type": "string",
19+
"metadata": {
20+
"description": "Unique DNS Name for the Public IP used to access the Virtual Machine."
21+
}
22+
},
23+
"vmSize": {
24+
"type": "string",
25+
"defaultValue": "Standard_A3",
26+
"allowedValues": [
27+
"Standard_A0",
28+
"Standard_A1",
29+
"Standard_A2",
30+
"Standard_A3",
31+
"Standard_A4",
32+
"Standard_D1",
33+
"Standard_DS1",
34+
"Standard_D2",
35+
"Standard_DS2",
36+
"Standard_D3",
37+
"Standard_DS3",
38+
"Standard_D4",
39+
"Standard_DS4",
40+
"Standard_D11",
41+
"Standard_DS11",
42+
"Standard_D12",
43+
"Standard_DS12",
44+
"Standard_D13",
45+
"Standard_DS13",
46+
"Standard_D14",
47+
"Standard_DS14"
48+
],
49+
"metadata": {
50+
"description": "Instance size for the VMs"
51+
}
52+
},
53+
"adminUserName": {
54+
"type": "string",
55+
"metadata": {
56+
"description": "Username to login to the VMs"
57+
}
58+
},
59+
"sshKeyData": {
60+
"type": "string",
61+
"metadata": {
62+
"description": "Public key for SSH authentication"
63+
}
64+
},
65+
"customData": {
66+
"type": "string",
67+
"metadata": {
68+
"description": "Base64-encoded cloud-config.yaml file to deploy and start Fleet"
69+
}
70+
},
71+
"numberOfNodes": {
72+
"type": "int",
73+
"metadata": {
74+
"description": "Number of member nodes"
75+
},
76+
"defaultValue": "3"
77+
},
78+
"dockerVolumeSize": {
79+
"type": "int",
80+
"metadata": {
81+
"description": "Size in GB of the Docker volume."
82+
},
83+
"defaultValue": "100"
84+
}
85+
},
86+
"variables": {
87+
"addressPrefix": "10.0.0.0/16",
88+
"subnet1Name": "Subnet-1",
89+
"subnet1Prefix": "10.0.0.0/24",
90+
"publicIPAddressType": "Dynamic",
91+
"storageAccountType": "Standard_LRS",
92+
"imagePublisher": "CoreOS",
93+
"imageOffer": "CoreOS",
94+
"imageSKU": "Stable",
95+
"vmNamePrefix": "deisNode",
96+
"virtualNetworkName": "deisvNet",
97+
"availabilitySetName": "deisAvailabilitySet",
98+
"loadBalancerName": "loadBalancer",
99+
"loadBalancerAPIRuleName": "loadBalancerAPIRule",
100+
"loadBalancerBuilderRuleName": "loadBalancerBuildRule",
101+
"loadBalancerPublicIPName": "loadBalancerIP",
102+
"loadBalancerIPConfigName": "loadBalancerIPConfig",
103+
"lbBackendAddressPoolName": "lbBackendAddressPool",
104+
"apiProbeName": "apiProbe",
105+
"builderProbeName": "builderProbe",
106+
"sshKeyPath": "[concat('/home/',parameters('adminUsername'),'/.ssh/authorized_keys')]",
107+
"vnetID": "[resourceId('Microsoft.Network/virtualNetworks',variables('virtualNetworkName'))]",
108+
"subnet1Ref": "[concat(variables('vnetID'),'/subnets/',variables('subnet1Name'))]",
109+
"lbID": "[resourceId('Microsoft.Network/loadBalancers',variables('loadBalancerName'))]",
110+
"lbAPIRuleID": "[concat(variables('lbID'),'/loadBalancingRules/',variables('loadBalancerAPIRuleName'))]",
111+
"lbBuilderRuleID": "[concat(variables('lbID'),'/loadBalancingRules/',variables('loadBalancerBuilderRuleName'))]",
112+
"lbIPConfig": "[concat(variables('lbID'),'/frontendIPConfigurations/',variables('loadBalancerIPConfigName'))]",
113+
"apiProbeID": "[concat(variables('lbID'),'/probes/',variables('apiProbeName'))]",
114+
"builderProbeID": "[concat(variables('lbID'),'/probes/',variables('builderProbeName'))]",
115+
"lbPoolID": "[concat(variables('lbID'),'/backendAddressPools/',variables('lbBackendAddressPoolName'))]"
116+
},
117+
"resources": [
118+
{
119+
"type": "Microsoft.Compute/availabilitySets",
120+
"name": "[variables('availabilitySetName')]",
121+
"apiVersion": "2015-05-01-preview",
122+
"location": "[resourceGroup().location]",
123+
"properties": {}
124+
},
125+
{
126+
"type": "Microsoft.Storage/storageAccounts",
127+
"name": "[parameters('newStorageAccountName')]",
128+
"location": "[resourceGroup().location]",
129+
"apiVersion": "2015-05-01-preview",
130+
"properties": {
131+
"accountType": "[variables('storageAccountType')]"
132+
}
133+
},
134+
{
135+
"apiVersion": "2015-05-01-preview",
136+
"type": "Microsoft.Network/publicIPAddresses",
137+
"name": "[variables('loadBalancerPublicIPName')]",
138+
"location": "[resourceGroup().location]",
139+
"properties": {
140+
"publicIPAllocationMethod": "Dynamic",
141+
"dnsSettings": {
142+
"domainNameLabel": "[parameters('publicDomainName')]"
143+
}
144+
}
145+
},
146+
{
147+
"apiVersion": "2015-05-01-preview",
148+
"type": "Microsoft.Network/publicIPAddresses",
149+
"name": "[concat(parameters('dnsPrefixNameForPublicIP'),copyIndex())]",
150+
"location": "[resourceGroup().location]",
151+
"tags": {
152+
"displayName": "PublicIPAddress"
153+
},
154+
"properties": {
155+
"publicIPAllocationMethod": "Dynamic",
156+
"dnsSettings": {
157+
"domainNameLabel": "[concat(parameters('dnsPrefixNameForPublicIP'),copyIndex())]"
158+
}
159+
},
160+
"copy": {
161+
"name": "publicIpCopy",
162+
"count": "[parameters('numberOfNodes')]"
163+
}
164+
},
165+
{
166+
"apiVersion": "2015-05-01-preview",
167+
"type": "Microsoft.Network/loadBalancers",
168+
"name": "[variables('loadBalancerName')]",
169+
"location": "[resourceGroup().location]",
170+
"dependsOn": [
171+
"[concat('Microsoft.Network/publicIPAddresses/', variables('loadBalancerPublicIPName'))]"
172+
],
173+
"properties": {
174+
"frontendIPConfigurations": [
175+
{
176+
"name": "[variables('loadBalancerIPConfigName')]",
177+
"properties": {
178+
"publicIPAddress": {
179+
"id": "[resourceId('Microsoft.Network/publicIPAddresses',variables('loadBalancerPublicIPName'))]"
180+
}
181+
}
182+
}
183+
],
184+
"backendAddressPools": [
185+
{
186+
"name": "[variables('lbBackendAddressPoolName')]",
187+
"properties": {
188+
"loadBalancingRules": [
189+
{
190+
"id": "[variables('lbAPIRuleID')]"
191+
},
192+
{
193+
"id": "[variables('lbBuilderRuleID')]"
194+
}
195+
]
196+
}
197+
}
198+
],
199+
"loadBalancingRules": [
200+
{
201+
"name": "[variables('loadBalancerAPIRuleName')]",
202+
"dependsOn": [
203+
"[variables('lbIPConfig')]"
204+
],
205+
"properties": {
206+
"frontendIPConfiguration": {
207+
"id": "[variables('lbIPConfig')]"
208+
},
209+
"backendAddressPool": {
210+
"id": "[variables('lbPoolID')]"
211+
},
212+
"protocol": "TCP",
213+
"frontendPort": "80",
214+
"backendPort": "80",
215+
"enableFloatingIP": false,
216+
"idleTimeoutInMinutes": "10",
217+
"probe": {
218+
"id": "[variables('apiProbeID')]"
219+
}
220+
}
221+
},
222+
{
223+
"name": "[variables('loadBalancerBuilderRuleName')]",
224+
"dependsOn": [
225+
"[variables('lbIPConfig')]"
226+
],
227+
"properties": {
228+
"frontendIPConfiguration": {
229+
"id": "[variables('lbIPConfig')]"
230+
},
231+
"backendAddressPool": {
232+
"id": "[variables('lbPoolID')]"
233+
},
234+
"protocol": "TCP",
235+
"frontendPort": "2222",
236+
"backendPort": "2222",
237+
"enableFloatingIP": false,
238+
"idleTimeoutInMinutes": "10"
239+
}
240+
}
241+
],
242+
"probes": [
243+
{
244+
"name": "[variables('apiProbeName')]",
245+
"properties": {
246+
"protocol": "HTTP",
247+
"port": "80",
248+
"intervalInSeconds": "5",
249+
"numberOfProbes": "2",
250+
"requestPath": "/health-check"
251+
}
252+
}
253+
]
254+
}
255+
},
256+
{
257+
"type": "Microsoft.Network/virtualNetworks",
258+
"name": "[variables('virtualNetworkName')]",
259+
"location": "[resourceGroup().location]",
260+
"apiVersion": "2015-05-01-preview",
261+
"properties": {
262+
"addressSpace": {
263+
"addressPrefixes": [
264+
"[variables('addressPrefix')]"
265+
]
266+
},
267+
"subnets": [
268+
{
269+
"name": "[variables('subnet1Name')]",
270+
"properties": {
271+
"addressPrefix": "[variables('subnet1Prefix')]"
272+
}
273+
}
274+
]
275+
}
276+
},
277+
{
278+
"type": "Microsoft.Network/networkInterfaces",
279+
"name": "[concat('nic', copyindex())]",
280+
"copy": {
281+
"name": "nicLoop",
282+
"count": "[parameters('numberOfNodes')]"
283+
},
284+
"location": "[resourceGroup().location]",
285+
"dependsOn": [
286+
"[concat('Microsoft.Network/publicIPAddresses/', concat(parameters('dnsPrefixNameForPublicIP'),copyIndex()))]",
287+
"[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]",
288+
"[variables('lbID')]"
289+
],
290+
"apiVersion": "2015-05-01-preview",
291+
"properties": {
292+
"ipConfigurations": [
293+
{
294+
"name": "ipconfig1",
295+
"properties": {
296+
"privateIPAllocationMethod": "Dynamic",
297+
"publicIPAddress": {
298+
"id": "[resourceId('Microsoft.Network/publicIPAddresses',concat(parameters('dnsPrefixNameForPublicIP'),copyIndex()))]"
299+
},
300+
"subnet": {
301+
"id": "[variables('subnet1Ref')]"
302+
},
303+
"loadBalancerBackendAddressPools": [
304+
{
305+
"id": "[variables('lbPoolID')]"
306+
}
307+
]
308+
}
309+
}
310+
]
311+
}
312+
},
313+
{
314+
"type": "Microsoft.Compute/virtualMachines",
315+
"name": "[concat(variables('vmNamePrefix'), copyindex())]",
316+
"copy": {
317+
"name": "virtualMachineLoop",
318+
"count": "[parameters('numberOfNodes')]"
319+
},
320+
"location": "[resourceGroup().location]",
321+
"dependsOn": [
322+
"[concat('Microsoft.Storage/storageAccounts/', parameters('newStorageAccountName'))]",
323+
"[concat('Microsoft.Network/networkInterfaces/', 'nic', copyindex())]",
324+
"[concat('Microsoft.Compute/availabilitySets/', variables('availabilitySetName'))]"
325+
],
326+
"apiVersion": "2015-05-01-preview",
327+
"properties": {
328+
"availabilitySet": {
329+
"id": "[resourceId('Microsoft.Compute/availabilitySets',variables('availabilitySetName'))]"
330+
},
331+
"hardwareProfile": {
332+
"vmSize": "[parameters('vmSize')]"
333+
},
334+
"osProfile": {
335+
"computername": "[concat(variables('vmNamePrefix'), copyindex())]",
336+
"adminUsername": "[parameters('adminUsername')]",
337+
"customData": "[parameters('customData')]",
338+
"linuxConfiguration": {
339+
"disablePasswordAuthentication": "true",
340+
"ssh": {
341+
"publicKeys": [
342+
{
343+
"path": "[variables('sshKeyPath')]",
344+
"keyData": "[parameters('sshKeyData')]"
345+
}
346+
]
347+
}
348+
}
349+
},
350+
"storageProfile": {
351+
"imageReference": {
352+
"publisher": "[variables('imagePublisher')]",
353+
"offer": "[variables('imageOffer')]",
354+
"sku": "[variables('imageSKU')]",
355+
"version": "647.2.0"
356+
},
357+
"dataDisks": [
358+
{
359+
"name": "dockerdisk",
360+
"diskSizeGB": "[parameters('dockerVolumeSize')]",
361+
"lun": 0,
362+
"vhd": {
363+
"uri": "[concat('http://',parameters('newStorageAccountName'),'.blob.core.windows.net/vhds/','datadisk', copyindex(),'.vhd')]"
364+
},
365+
"createOption": "Empty"
366+
}
367+
],
368+
"osDisk": {
369+
"name": "osdisk",
370+
"vhd": {
371+
"uri": "[concat('http://',parameters('newStorageAccountName'),'.blob.core.windows.net/vhds/','osdisk', copyindex(),'.vhd')]"
372+
},
373+
"caching": "ReadWrite",
374+
"createOption": "FromImage"
375+
}
376+
},
377+
"networkProfile": {
378+
"networkInterfaces": [
379+
{
380+
"id": "[resourceId('Microsoft.Network/networkInterfaces',concat('nic',copyindex()))]"
381+
}
382+
]
383+
}
384+
}
385+
}
386+
]
387+
}

0 commit comments

Comments
 (0)