Skip to content

Commit bfb8226

Browse files
committed
added internal and external lb
1 parent 3091f8d commit bfb8226

File tree

3 files changed

+231
-0
lines changed

3 files changed

+231
-0
lines changed

nestedtemplates/external-lb.json

Lines changed: 204 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,204 @@
1+
{
2+
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
3+
"contentVersion": "1.0.0.0",
4+
"parameters": {
5+
"clusterName": {
6+
"type": "String",
7+
"defaultValue": ""
8+
},
9+
"lbName": {
10+
"type": "String",
11+
"defaultValue": ""
12+
},
13+
"lbId": {
14+
"type": "String",
15+
"defaultValue": ""
16+
}
17+
},
18+
"variables": {},
19+
"resources": [
20+
{
21+
"type": "Microsoft.Network/publicIPAddresses",
22+
"name": "[concat(parameters('clusterName'), '-ip')]",
23+
"apiVersion": "2016-03-30",
24+
"location": "[resourceGroup().location]",
25+
"properties": {
26+
"publicIPAllocationMethod": "Dynamic",
27+
"dnsSettings": {
28+
"domainNameLabel": "[parameters('clusterName')]"
29+
}
30+
}
31+
},
32+
{
33+
"type": "Microsoft.Network/loadBalancers",
34+
"name": "[parameters('lbName')]",
35+
"apiVersion": "2015-06-15",
36+
"location": "[resourceGroup().location]",
37+
"properties": {
38+
"availabilitySet": {
39+
"id": "[resourceId('Microsoft.Compute/availabilitySets', 'postgresHaAvailabilitySet')]"
40+
},
41+
"frontendIPConfigurations": [
42+
{
43+
"name": "loadBalancerFrontEnd",
44+
"properties": {
45+
"publicIPAddress": {
46+
"id": "[parameters('ipId')]"
47+
}
48+
}
49+
}
50+
],
51+
"backendAddressPools": [
52+
{
53+
"name": "loadBalancerBackEnd"
54+
}
55+
],
56+
"loadBalancingRules": [
57+
{
58+
"name": "postgresLbRule",
59+
"properties": {
60+
"frontendIPConfiguration": {
61+
"id": "[concat(parameters('lbId'), '/frontendIPConfigurations/loadBalancerFrontEnd')]"
62+
},
63+
"backendAddressPool": {
64+
"id": "[concat(parameters('lbId'), '/backendAddressPools/loadBalancerBackEnd')]"
65+
},
66+
"protocol": "Tcp",
67+
"frontendPort": 5432,
68+
"backendPort": 5000,
69+
"probe": {
70+
"id": "[concat(parameters('lbId'), '/probes/postgresProbe')]"
71+
}
72+
}
73+
}
74+
],
75+
"probes": [
76+
{
77+
"name": "postgresProbe",
78+
"properties": {
79+
"protocol": "Tcp",
80+
"port": 5000,
81+
"intervalInSeconds": 5,
82+
"numberOfProbes": 2
83+
}
84+
}
85+
],
86+
"inboundNatRules": [
87+
{
88+
"name": "postgresSsh0",
89+
"properties": {
90+
"frontendIPConfiguration": {
91+
"id": "[concat(parameters('lbId'), '/frontendIPConfigurations/loadBalancerFrontEnd')]"
92+
},
93+
"protocol": "Tcp",
94+
"frontendPort": 10110,
95+
"backendPort": 22
96+
}
97+
},
98+
{
99+
"name": "postgresSsh1",
100+
"properties": {
101+
"frontendIPConfiguration": {
102+
"id": "[concat(parameters('lbId'), '/frontendIPConfigurations/loadBalancerFrontEnd')]"
103+
},
104+
"protocol": "Tcp",
105+
"frontendPort": 10111,
106+
"backendPort": 22
107+
}
108+
},
109+
{
110+
"name": "postgresSsh2",
111+
"properties": {
112+
"frontendIPConfiguration": {
113+
"id": "[concat(parameters('lbId'), '/frontendIPConfigurations/loadBalancerFrontEnd')]"
114+
},
115+
"protocol": "Tcp",
116+
"frontendPort": 10112,
117+
"backendPort": 22
118+
}
119+
},
120+
{
121+
"name": "postgresSsh3",
122+
"properties": {
123+
"frontendIPConfiguration": {
124+
"id": "[concat(parameters('lbId'), '/frontendIPConfigurations/loadBalancerFrontEnd')]"
125+
},
126+
"protocol": "Tcp",
127+
"frontendPort": 10113,
128+
"backendPort": 22
129+
}
130+
},
131+
{
132+
"name": "postgresSsh4",
133+
"properties": {
134+
"frontendIPConfiguration": {
135+
"id": "[concat(parameters('lbId'), '/frontendIPConfigurations/loadBalancerFrontEnd')]"
136+
},
137+
"protocol": "Tcp",
138+
"frontendPort": 10114,
139+
"backendPort": 22
140+
}
141+
},
142+
{
143+
"name": "postgresSsh5",
144+
"properties": {
145+
"frontendIPConfiguration": {
146+
"id": "[concat(parameters('lbId'), '/frontendIPConfigurations/loadBalancerFrontEnd')]"
147+
},
148+
"protocol": "Tcp",
149+
"frontendPort": 10115,
150+
"backendPort": 22
151+
}
152+
},
153+
{
154+
"name": "postgresSsh6",
155+
"properties": {
156+
"frontendIPConfiguration": {
157+
"id": "[concat(parameters('lbId'), '/frontendIPConfigurations/loadBalancerFrontEnd')]"
158+
},
159+
"protocol": "Tcp",
160+
"frontendPort": 10116,
161+
"backendPort": 22
162+
}
163+
},
164+
{
165+
"name": "postgresSsh7",
166+
"properties": {
167+
"frontendIPConfiguration": {
168+
"id": "[concat(parameters('lbId'), '/frontendIPConfigurations/loadBalancerFrontEnd')]"
169+
},
170+
"protocol": "Tcp",
171+
"frontendPort": 10117,
172+
"backendPort": 22
173+
}
174+
},
175+
{
176+
"name": "postgresSsh8",
177+
"properties": {
178+
"frontendIPConfiguration": {
179+
"id": "[concat(parameters('lbId'), '/frontendIPConfigurations/loadBalancerFrontEnd')]"
180+
},
181+
"protocol": "Tcp",
182+
"frontendPort": 10118,
183+
"backendPort": 22
184+
}
185+
},
186+
{
187+
"name": "postgresSsh9",
188+
"properties": {
189+
"frontendIPConfiguration": {
190+
"id": "[concat(parameters('lbId'), '/frontendIPConfigurations/loadBalancerFrontEnd')]"
191+
},
192+
"protocol": "Tcp",
193+
"frontendPort": 10119,
194+
"backendPort": 22
195+
}
196+
}
197+
]
198+
},
199+
"dependsOn": [
200+
"[variables('ipId')]"
201+
]
202+
}
203+
]
204+
}

nestedtemplates/internal-lb.json

Whitespace-only changes.

template.json

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,10 @@
9494
"yes": "network-resources.json",
9595
"no": "empty-resources.json"
9696
},
97+
"lbFile": {
98+
"yes": "external-lb.json",
99+
"no": "internal-lb.json"
100+
},
97101
"lbId": "[resourceId('Microsoft.Network/loadBalancers/', variables('lbName'))]",
98102
"vnetName": "dcos-vnet-F0547AD4",
99103
"vnetGroup": "testht",
@@ -405,6 +409,29 @@
405409
"[concat('Microsoft.Compute/virtualMachines/', 'postgres', copyIndex())]"
406410
]
407411
},
412+
{
413+
"type": "Microsoft.Network/loadBalancers",
414+
"name": "[variables('lbName')]",
415+
"apiVersion": "2015-06-15",
416+
"properties": {
417+
"mode": "Incremental",
418+
"templateLink": {
419+
"uri": "[concat(variables('sharedTemplateFileName'), variables('lbFile')[parameters('lbType')])]",
420+
"contentVersion": "1.0.0.0"
421+
},
422+
"parameters": {
423+
"clusterName": {
424+
"value": "[parameters('clusterName')]"
425+
},
426+
"lbName": {
427+
"value": "[variables('lbName')]"
428+
},
429+
"lbId": {
430+
"value": "[variables('lbId')]"
431+
}
432+
}
433+
}
434+
},
408435
{
409436
"type": "Microsoft.Network/loadBalancers",
410437
"name": "[variables('lbName')]",

0 commit comments

Comments
 (0)