aboutsummaryrefslogtreecommitdiffstats
path: root/deployment/Azure_ARM_Template/arm_cluster_deploy_beijing.json
blob: 79dda59e8604f539b14cf19a44354d2d8b49974f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
{
  "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
  "contentVersion": "1.0.0.0",
  "parameters": {
    "centosOSVersion": {
      "type": "string",
      "defaultValue": "16.04.0-LTS",
      "allowedValues": [
        "12.04.5-LTS","14.04.5-LTS","15.10","16.04.0-LTS"
      ],
      "metadata": {
        "description": "The OS"
      }
    },
    "numberOfVms": {
      "type": "int",
      "defaultValue": 5,
      "minValue": 1,
      "maxValue": 15,
      "metadata": {
        "description": "Number of VMs to provision"
      }
    },
    "privateIPAddress": {
      "type": "string",
	  "defaultValue": "10.0.0.2",
      "metadata": {
        "description": "Static Private IP will be assigned to the machine"
      }
    },
    "masterScriptName": {
      "type": "string",
      "metadata": {
        "description": "entrypoint script name for k8s master"
      }
    },
    "nodeScriptName": {
      "type": "string",
      "metadata": {
        "description": "entrypoint script name for k8s node"
      }
    },
    "vmSize": {
      "type": "string",
      "defaultValue": "Standard_D14_v2",
      "allowedValues": [
        "Standard_E8_v3",
        "Standard_E2_v3",
        "Standard_D1",
	    "Standard_D16s_v3",
        "Standard_D4_v2",
        "Standard_D32s_v3",
        "Standard_E16_v3",
        "Standard_D14_v2",
        "Standard_D13_v2",
        "Standard_E64_v3"
      ],
      "metadata": {
        "description": "VM size"
      }
    },
    "dnslabel": {
      "type": "string",
      "metadata": {
        "description": "Unique DNS label to assign DNS name"
      }
    }

  },
  "variables": {
    "dnsLabelPrefix": "[concat('dns-',uniquestring(resourceGroup().id))]",
    "customData": [ "userdata.txt" ], 
    "vmName": "[concat('k8s-host-', substring(uniquestring(resourceGroup().id),0,4))]",
    "adminUsername": "[concat('ubuntu')]",
    "adminPassword": "Qwertyuiop@@1",
    "sshKeyData": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQD5zrmH1dHgXbNwP2qbNVySScnFVcEP25HBd2VJu2PiJLDhwgHj44Lj9ZvLyRFCetqd8CAKnLV5qy37rwaCtlH/t8Qb36cUGPhegxpF2++uTY0b6K7Zb6hEMBNw3J1z+GU7OoVwZJhsNAw4t8/7WWmJA4Owo99TJkEKvhCYjBCLoC5sIvG/lJsaFIG8A5MjnBlwgSZ3FsUU+aY1KYZUztodkyv7laDMOinwSvJggKrCugsqZdVo5bhmcSFbqrZa/a/wgqeok+79W0/DLh5Tlf7By46ASDKGnFlwDshPu++I3KMU3eRz0rJLOKeIUCz7k80X0WJ6BrSS7l+IrpDXV1M5 ubuntu@aria",
    "storageAccountName": "[concat('salinuxvm', substring(uniquestring(resourceGroup().id),0,4))]",
    "imagePublisher": "Canonical",
    "imageOffer": "UbuntuServer",
    "nicName": "[concat('VMNic-',variables('vmName'))]",
    "dnsPrefix": "[concat(variables('dnsLabelPrefix'),'-',substring(uniquestring(resourceGroup().id),0,4))]",
    "addressPrefix": "10.0.0.0/16",
    "subnetName": "Subnet",
    "subnetPrefix": "10.0.0.0/24",
    "storageAccountType": "Standard_LRS",
    "publicIPAddressType": "Dynamic",
	  "publicIPAddressName": "nicLoop100",
    "virtualNetworkName": "[concat('VNET-',variables('vmName'))]",
    "subnetRef": "[resourceId('Microsoft.Network/virtualNetworks/subnets/', variables('virtualNetworkName'), variables('subnetName'))]",
    "networkSecurityGroupName": "[concat(variables('vmName'), '_obrien_local_nsg')]",
    "sshKeyPathRoot": "[concat('/root/','/.ssh/authorized_keys')]",
    "sshKeyPath": "[concat('/home/',variables('adminUsername'),'/.ssh/authorized_keys')]",
    "availabilitySetName": "[concat('availabilitySet-',substring(uniquestring(resourceGroup().id),0,4))]"
  },
  "resources": [
    {
      "type": "Microsoft.Compute/availabilitySets",
      "name": "[variables('availabilitySetName')]",
      "apiVersion": "2016-04-30-preview",
      "location": "[resourceGroup().location]",
      "properties": {
        "managed": true,
        "platformFaultDomainCount": 3,
        "platformUpdateDomainCount": 3
      }
    },
    {
      "type": "Microsoft.Storage/storageAccounts",
      "name": "[variables('storageAccountName')]",
      "apiVersion": "2017-06-01",
      "location": "[resourceGroup().location]",
      "sku": {
        "name": "[variables('storageAccountType')]"
      },
      "kind": "Storage",
      "properties": {}
    },
    {
      "apiVersion": "2017-03-01",
      "type": "Microsoft.Network/networkSecurityGroups",
      "name": "[variables('networkSecurityGroupName')]",
      "location": "[resourceGroup().location]",
      "tags": {
        "displayName": "NSG"
      },
      "properties": {
        "securityRules": [
         {
            "name": "SSHAllowAny",
            "properties": {
              "description": "SSHAllowAny",
              "protocol": "TCP",
              "sourcePortRange": "*",
              "destinationPortRange": "22",
              "sourceAddressPrefix": "*",
              "destinationAddressPrefix": "*",
              "access": "Allow",
              "priority": 100,
              "direction": "Inbound"
            }
          },
          {
            "name": "DockerAllowAny",
            "properties": {
              "description": "DockerAllowAny",
              "protocol": "TCP",
              "sourcePortRange": "*",
              "destinationPortRange": "2376",
              "sourceAddressPrefix": "*",
              "destinationAddressPrefix": "*",
              "access": "Allow",
              "priority": 110,
              "direction": "Inbound"
            }
          },
          {
            "name": "port500-UdpAllowAny",
            "properties": {
              "description": "port500-udpAllowAny",
              "protocol": "UDP",
              "sourcePortRange": "*",
              "destinationPortRange": "500",
              "sourceAddressPrefix": "*",
              "destinationAddressPrefix": "*",
              "access": "Allow",
              "priority": 120,
              "direction": "Inbound"
            }
          },
          {
            "name": "port4500-UdpAllowAny",
            "properties": {
              "description": "port4500-udpAllowAny",
              "protocol": "UDP",
              "sourcePortRange": "*",
              "destinationPortRange": "4500",
              "sourceAddressPrefix": "*",
              "destinationAddressPrefix": "*",
              "access": "Allow",
              "priority": 130,
              "direction": "Inbound"
            }
          },

          {
            "name": "port_10249-10255_172",
            "properties": {
              "description": "port_10249-10255_172",
              "protocol": "*",
              "sourcePortRange": "*",
              "destinationPortRange": "10249-10255",
              "sourceAddressPrefix": "*",
              "destinationAddressPrefix": "*",
              "access": "Allow",
              "priority": 140,
              "direction": "Inbound"
            }
          },
          {
            "name": "in-rule",
            "properties": {
              "description": "All in",
              "protocol": "Tcp",
              "sourcePortRange": "*",
              "destinationPortRange": "*",
              "sourceAddressPrefix": "Internet",
              "destinationAddressPrefix": "*",
              "access": "Allow",
              "priority": 170,
              "direction": "Inbound"
            }
          },
          {
            "name": "block-8080",
            "properties": {
              "description": "block-8080",
              "protocol": "Tcp",
              "sourcePortRange": "8080",
              "destinationPortRange": "*",
              "sourceAddressPrefix": "Internet",
              "destinationAddressPrefix": "*",
              "access": "Deny",
              "priority": 104,
              "direction": "Outbound"
            }
          },
          {
            "name": "out-rule",
            "properties": {
              "description": "All out",
              "protocol": "Tcp",
              "sourcePortRange": "*",
              "destinationPortRange": "*",
              "sourceAddressPrefix": "Internet",
              "destinationAddressPrefix": "*",
              "access": "Allow",
              "priority": 110,
              "direction": "Outbound"
            }
          }
        ]
      }
    },
    {
      "apiVersion": "2017-04-01",
      "type": "Microsoft.Network/virtualNetworks",
      "name": "[variables('virtualNetworkName')]",
      "location": "[resourceGroup().location]",
      "dependson": [
        "[concat('Microsoft.Network/networkSecurityGroups/', variables('networkSecurityGroupName'))]"
      ],
      "properties": {
        "addressSpace": {
          "addressPrefixes": [
            "[variables('addressPrefix')]"
          ]
        },
        "subnets": [
          {
            "name": "[variables('subnetName')]",
            "properties": {
              "addressPrefix": "[variables('subnetPrefix')]",
              "networkSecurityGroup": {
                "id": "[resourceId('Microsoft.Network/networkSecurityGroups', variables('networkSecurityGroupName'))]"
              }
            }
          }
        ]
      }
    },
    {
      "apiVersion": "2017-08-01",
      "type": "Microsoft.Network/networkInterfaces",
      "name": "[concat(variables('nicName'), copyindex())]",
      "location": "[resourceGroup().location]",
      "copy": {
        "name": "nicLoop",
        "count": "[parameters('numberOfVms')]"
      },
      "dependsOn": [
        "[resourceId('Microsoft.Network/publicIPAddresses/', concat('nicLoop',copyIndex(100)))]",
        "[resourceId('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]"
      ],
      "properties": {
        "ipConfigurations": [
          {
            "name": "ipconfig1",
            "properties": {
              "privateIPAllocationMethod": "Static",
              "privateIPAddress": "[concat(parameters('privateIPAddress'),copyindex())]",
              "publicIPAddress": {
                "id": "[resourceId('Microsoft.Network/publicIPAddresses', concat('nicLoop',copyIndex(100)))]"
              },
              "subnet": {
                "id": "[variables('subnetRef')]"
              }
            }
          }
        ]
      }
    },
    {
      "apiVersion": "2017-04-01",
      "type": "Microsoft.Network/publicIPAddresses",
      "name": "[concat('nicLoop',copyIndex(100))]",
      "location": "[resourceGroup().location]",
      "copy": {
        "name": "nicLoop",
        "count": "[parameters('numberOfVms')]" 
      },
      "properties": {
        "publicIPAllocationMethod": "Dynamic",
        "dnsSettings": {
          "domainNameLabel": "[concat(variables('vmName'),parameters('dnslabel'), copyIndex(1000))]"
        }
      }
    },
    {
      "apiVersion": "2017-03-30",
      "type": "Microsoft.Compute/virtualMachines",
      "name": "[concat(variables('vmName'), copyindex())]",
      "copy": {
        "name": "virtualMachineLoop",
        "count": "[parameters('numberOfVms')]"
      },
      "location": "[resourceGroup().location]",
      "dependsOn": [
        "nicLoop",
        "[concat('Microsoft.Compute/availabilitySets/',variables('availabilitySetName'))]"
      ],
      "properties": {
        "hardwareProfile": {
          "vmSize": "[parameters('vmSize')]"
        },
        "availabilitySet": {
          "id": "[resourceId('Microsoft.Compute/availabilitySets',variables('availabilitySetName'))]"
        },
        "osProfile": {
          "computerName": "[concat(variables('vmName'), copyindex())]",
          "adminUsername": "[variables('adminUsername')]",
          "adminPassword": "[variables('adminPassword')]",
          "linuxConfiguration": {
            "disablePasswordAuthentication": false,
            "ssh": {
              "publicKeys": [
                {
                  "path": "[variables('sshKeyPath')]",
                  "keyData": "[variables('sshKeyData')]"
                }
              ]
            }
          }
        },
        "storageProfile": {
          "imageReference": {
            "publisher": "[variables('imagePublisher')]",
            "offer": "[variables('imageOffer')]",
            "sku": "[parameters('centosOSVersion')]",
            "version": "latest"
          },
          "osDisk": {
            "diskSizeGB": 127,
            "createOption": "FromImage"
          }
        },
        "networkProfile": {
          "networkInterfaces": [
            {
              "id": "[resourceId('Microsoft.Network/networkInterfaces',concat(variables('nicName'),copyindex()))]"
            }
          ]
        },
        "diagnosticsProfile": {
          "bootDiagnostics": {
            "enabled": true,
            "storageUri": "[concat(reference(concat('Microsoft.Storage/storageAccounts/', variables('storageAccountName')), '2016-01-01').primaryEndpoints.blob)]"
          }
        }
      }
    },
	{
    "apiVersion": "2015-06-15",
    "type": "Microsoft.Compute/virtualMachines/extensions",
    "name": "[concat(variables('vmName'), '0','/onap')]",
    "location": "[resourceGroup().location]",
    "dependsOn": ["virtualMachineLoop"],
    "properties": {
        "publisher": "Microsoft.Azure.Extensions",
        "type": "CustomScript",
        "typeHandlerVersion": "2.0",
        "autoUpgradeMinorVersion": true,
        "settings": {
            "fileUris": [ "https://gerrit.onap.org/r/gitweb?p=integration.git;a=blob_plain;f=Azure_ARM_Template/scripts/azure-rancher-server.sh;hb=refs/heads/master" ],
            "commandToExecute": "[concat('./' , parameters('masterScriptName'),' ',reference(variables('publicIPAddressName')).dnsSettings.fqdn,' ',parameters('privateIPAddress'),' ',parameters('numberOfVms'))]"
           }
        }
     },
	{
    "apiVersion": "2015-06-15",
    "type": "Microsoft.Compute/virtualMachines/extensions",
    "name": "[concat(variables('vmName'), copyindex(1),'/onap')]",
	"copy": {
        "name": "virtualMachineExtnLoop",
        "count": "[sub(parameters('numberOfVms'),1)]" 
      },
    "location": "[resourceGroup().location]",
    "dependsOn": [
      "virtualMachineLoop"
    ],
    "properties": {
        "publisher": "Microsoft.Azure.Extensions",
        "type": "CustomScript",
        "typeHandlerVersion": "2.0",
        "autoUpgradeMinorVersion": true,
        "settings": {
            "fileUris": [ "https://gerrit.onap.org/r/gitweb?p=integration.git;a=blob_plain;f=Azure_ARM_Template/scripts/azure-k8s-node.sh;hb=refs/heads/master" ],
            "commandToExecute": "[concat('./' , parameters('nodeScriptName'),' ',concat(parameters('privateIPAddress'),'0'))]"
           }
        }
     }
  ]
}