@@ -73,7 +73,7 @@ def upload_rg_template(release_channel, cloudformation_template_name, tempfile,
73
73
74
74
return s3_full_url
75
75
76
- def create_rg_template (vhd_sku , vhd_version , release_channel , docker_version ,
76
+ def create_rg_template (vhd_sku , vhd_version , offer_id , release_channel , docker_version ,
77
77
docker_for_azure_version , edition_version , cfn_template , cloudformation_template_name ):
78
78
# check if file exists before opening.
79
79
flat_edition_version = edition_version .replace (" " , "" ).replace ("_" , "" ).replace ("-" , "" )
@@ -85,6 +85,7 @@ def create_rg_template(vhd_sku, vhd_version, release_channel, docker_version,
85
85
data ['variables' ]['Description' ] = u"Docker for Azure {0} ({1})" .format (docker_version , edition_version )
86
86
data ['variables' ]['imageSku' ] = vhd_sku
87
87
data ['variables' ]['imageVersion' ] = vhd_version
88
+ data ['variables' ]['imageOffer' ] = offer_id
88
89
data ['variables' ]['dockerForIAASVersion' ] = docker_for_azure_version
89
90
90
91
# Updated Manager custom data
@@ -185,7 +186,7 @@ def create_rg_cloud_template(release_channel, docker_version,
185
186
186
187
return outfile
187
188
188
- def create_rg_ddc_template (vhd_sku , vhd_version , release_channel , docker_version ,
189
+ def create_rg_ddc_template (vhd_sku , vhd_version , offer_id , release_channel , docker_version ,
189
190
docker_for_azure_version , edition_version , cfn_template , cloudformation_template_name ):
190
191
with open (cfn_template ) as data_file :
191
192
data = json .load (data_file )
@@ -199,9 +200,21 @@ def create_rg_ddc_template(vhd_sku, vhd_version, release_channel, docker_version
199
200
200
201
data ['variables' ]['imageSku' ] = vhd_sku
201
202
data ['variables' ]['imageVersion' ] = vhd_version
203
+ data ['variables' ]['imageOffer' ] = offer_id
202
204
205
+ # Use multiple steps to keep order
203
206
parameters = data .get ('parameters' )
204
207
if parameters :
208
+ new_parameters = {
209
+ "DDCUsername" : {
210
+ "defaultValue" : "admin" ,
211
+ "type" : "String" ,
212
+ "metadata" : {
213
+ "description" : "Please enter the username you want to use for Docker Datacenter."
214
+ }
215
+ }
216
+ }
217
+ parameters .update (new_parameters )
205
218
new_parameters = {
206
219
"DDCPassword" : {
207
220
"minLength" : 8 ,
@@ -210,13 +223,6 @@ def create_rg_ddc_template(vhd_sku, vhd_version, release_channel, docker_version
210
223
"metadata" : {
211
224
"description" : "Please enter the password you want to use for Docker Datacenter."
212
225
}
213
- },
214
- "DDCUsername" : {
215
- "defaultValue" : "admin" ,
216
- "type" : "String" ,
217
- "metadata" : {
218
- "description" : "Please enter the username you want to use for Docker Datacenter."
219
- }
220
226
}
221
227
}
222
228
parameters .update (new_parameters )
@@ -232,22 +238,105 @@ def create_rg_ddc_template(vhd_sku, vhd_version, release_channel, docker_version
232
238
for key , val in enumerate (data .get ('resources' )):
233
239
if val ['name' ] == "[variables('managerNSGName')]" :
234
240
security_rules = val ['properties' ]['securityRules' ]
235
- new_security_rule = {
236
- "name" : "ddc" ,
237
- "properties" : {
238
- "description" : "Allow UCP" ,
239
- "protocol" : "Tcp" ,
240
- "sourcePortRange" : "*" ,
241
- "destinationPortRange" : "443" ,
242
- "sourceAddressPrefix" : "*" ,
243
- "destinationAddressPrefix" : "*" ,
244
- "access" : "Allow" ,
245
- "priority" : 206 ,
246
- "direction" : "Inbound"
241
+ new_security_rule = [
242
+ {
243
+ "name" : "ucp" ,
244
+ "properties" : {
245
+ "description" : "Allow UCP" ,
246
+ "protocol" : "Tcp" ,
247
+ "sourcePortRange" : "*" ,
248
+ "destinationPortRange" : "443" ,
249
+ "sourceAddressPrefix" : "*" ,
250
+ "destinationAddressPrefix" : "*" ,
251
+ "access" : "Allow" ,
252
+ "priority" : 206 ,
253
+ "direction" : "Inbound"
254
+ }
255
+ },
256
+ {
257
+ "name" : "dtr" ,
258
+ "properties" : {
259
+ "description" : "Allow DTR" ,
260
+ "protocol" : "Tcp" ,
261
+ "sourcePortRange" : "*" ,
262
+ "destinationPortRange" : "8443" ,
263
+ "sourceAddressPrefix" : "*" ,
264
+ "destinationAddressPrefix" : "*" ,
265
+ "access" : "Allow" ,
266
+ "priority" : 207 ,
267
+ "direction" : "Inbound"
268
+ }
247
269
}
270
+ ]
271
+ security_rules .extend (new_security_rule )
272
+ if val ['name' ] == "[variables('lbSSHName')]" :
273
+ properties = val ['properties' ]
274
+
275
+ loadbalancing_rules = {
276
+ "loadBalancingRules" : [
277
+ {
278
+ "name" : "ucpLbRule" ,
279
+ "properties" : {
280
+ "frontendIPConfiguration" : {
281
+ "id" : "[variables('lbSSHFrontEndIPConfigID')]"
282
+ },
283
+ "backendAddressPool" : {
284
+ "id" : "[concat(variables('lbSSHID'), '/backendAddressPools/default')]"
285
+ },
286
+ "protocol" : "tcp" ,
287
+ "frontendPort" : 443 ,
288
+ "backendPort" : 443 ,
289
+ "enableFloatingIP" : False ,
290
+ "idleTimeoutInMinutes" : 5 ,
291
+ "probe" : {
292
+ "id" : "[concat(variables('lbSSHID'),'/probes/ucp')]"
293
+ }
294
+ }
295
+ },
296
+ {
297
+ "name" : "dtrLbRule" ,
298
+ "properties" : {
299
+ "frontendIPConfiguration" : {
300
+ "id" : "[variables('lbSSHFrontEndIPConfigID')]"
301
+ },
302
+ "backendAddressPool" : {
303
+ "id" : "[concat(variables('lbSSHID'), '/backendAddressPools/default')]"
304
+ },
305
+ "protocol" : "tcp" ,
306
+ "frontendPort" : 8443 ,
307
+ "backendPort" : 8443 ,
308
+ "enableFloatingIP" : False ,
309
+ "idleTimeoutInMinutes" : 5 ,
310
+ "probe" : {
311
+ "id" : "[concat(variables('lbSSHID'),'/probes/dtr')]"
312
+ }
313
+ }
314
+ },
315
+ ]
248
316
}
249
- security_rules .append (new_security_rule )
250
- break
317
+ properties .update (loadbalancing_rules )
318
+ probes = val ['properties' ]['probes' ]
319
+ new_probe = [
320
+ {
321
+ "name" : "ucp" ,
322
+ "properties" : {
323
+ "intervalInSeconds" : 10 ,
324
+ "numberOfProbes" : 2 ,
325
+ "port" : 443 ,
326
+ "protocol" : "Tcp"
327
+ }
328
+ },
329
+ {
330
+ "name" : "dtr" ,
331
+ "properties" : {
332
+ "intervalInSeconds" : 10 ,
333
+ "numberOfProbes" : 2 ,
334
+ "port" : 8443 ,
335
+ "protocol" : "Tcp"
336
+ }
337
+ }
338
+ ]
339
+ probes .extend (new_probe )
251
340
outputs = data .get ('outputs' )
252
341
if outputs :
253
342
new_outputs = {
0 commit comments