cloudstrap-azure 0.5.3.pre → 0.5.6.pre

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 98c11afea63167e509778a33b0a963454ec98a062e8e51cad9dd1f660d2a8d68
4
- data.tar.gz: cfd04beb182c5d09060cd4c404554a6da152d92518ebb6d17d65aaff5ebba532
3
+ metadata.gz: 31f17b4b9f9f34e69fa72904329bfad979fdce50117b43270d0f8801918e9a26
4
+ data.tar.gz: dff144bd4fd98a6bbdb4c6a3a6c53c848e1861118a208a2b26dcf3cd36d52833
5
5
  SHA512:
6
- metadata.gz: 9248adfdbbc7945e784e2241c0eb12a59bb4537322d2f083f87ffd2c3e26de1c52c9490c8d68bca3a953b95102ab778ea4d5b10b24c9498db72acfa2fd9ff98a
7
- data.tar.gz: 5786f3ac02e8eafbc46d1d7ddee4ce7a5607fed5240e00bd7155e7840778b850fa6c704bf817dc523a18f631711b380769564f0d46b208f03fa7f7fad37b6ae2
6
+ metadata.gz: a759e06aea172d7900626ca5150a5c832ca7d2331b1b7629c36509e5d653595167d4bd4b00b1d09bba2122da91fd8afbbdc6847d63e7720f9a631524e6c40d54
7
+ data.tar.gz: ae908e27d2d712e90ca0401cc3934dfa87daf2057666782fc9acdd273ed44aab50aefa99970910f400c2fa5491ecca2ecf33519a734df849c334259ce372f4b9
checksums.yaml.gz.sig CHANGED
Binary file
@@ -35,6 +35,7 @@ TENANT_ID = Chamber.env.tenant_id
35
35
  LOCATION = Chamber.env.location
36
36
 
37
37
  SPINNER_FORMAT = (Chamber.env[:spinner] || :arrow_pulse).to_sym
38
+ ARBITRARY_DELAY = (Chamber.env[:arbitrary_delay] || 10).to_i
38
39
 
39
40
  ENABLE_SWAP_ACCOUNTING = %q{sudo sed -i 's/GRUB_CMDLINE_LINUX_DEFAULT=\"console=tty1 console=ttyS0 earlyprintk=ttyS0 rootdelay=300\"/GRUB_CMDLINE_LINUX_DEFAULT=\"console=tty1 console=ttyS0 earlyprintk=ttyS0 rootdelay=300 swapaccount=1\"/g' /etc/default/grub.d/50-cloudimg-settings.cfg}
40
41
  UPDATE_GRUB = %q{sudo update-grub}
@@ -61,12 +62,16 @@ If = ->(predicate, consequent, alternative = Nothing) {
61
62
  predicate.(*arguments) ? consequent.(*arguments) : alternative.(*arguments) } }
62
63
  ApplyIf = ->(predicate, consequent) { If.(predicate, consequent, Itself) }
63
64
 
64
- WhileSpinning = lambda do |message, &block|
65
+ LONGEST_MESSAGE = 30
66
+
67
+ WhileSpinning = lambda do |message, report: nil, &block|
65
68
  Concurrent::IVar.new.tap do |ivar|
66
69
  TTY::Spinner.new("[:spinner] #{message}", format: SPINNER_FORMAT).tap do |spinner|
67
70
  spinner.auto_spin
68
71
  ivar.set block.call
69
- end.success
72
+ padding = (' ' * [(LONGEST_MESSAGE - message.length), 0].max)
73
+ ivar.value ? (report ? spinner.success(padding + ivar.value.public_send(report).to_s) : spinner.success) : spinner.error
74
+ end
70
75
  end.value
71
76
  end
72
77
 
@@ -218,112 +223,125 @@ BindTenantID = Bind.(:tenant_id, TENANT_ID)
218
223
  ########################
219
224
 
220
225
  FindResourceGroup = ->(name) {
221
- AzureAPI::Resources::ResourceGroups
222
- .list
223
- .find { |resource_group| resource_group.id == "/subscriptions/#{SUBSCRIPTION_ID}/resourceGroups/#{name}" }}
226
+ WhileSpinning.("Resource Group Exists", report: :name) {
227
+ AzureAPI::Resources::ResourceGroups
228
+ .list
229
+ .find { |resource_group| resource_group.id == "/subscriptions/#{SUBSCRIPTION_ID}/resourceGroups/#{name}" }}}
224
230
 
225
231
  CreateResourceGroup = ->(name) {
226
- AzureAPI::Resources::ResourceGroups.create_or_update(
227
- name,
228
- AzureAPI::Resources::Models::ResourceGroup.new.tap do |resource_group|
229
- resource_group.location = LOCATION
230
- end)}
232
+ WhileSpinning.("Create Resource Group", report: :name) {
233
+ AzureAPI::Resources::ResourceGroups.create_or_update(
234
+ name,
235
+ AzureAPI::Resources::Models::ResourceGroup.new.tap do |resource_group|
236
+ resource_group.location = LOCATION
237
+ end)}}
231
238
 
232
239
  FindApplication = ->(display_name) {
233
- AzureAPI::GraphRbac::Applications
234
- .list
235
- .find { |application| application.display_name == display_name }}
240
+ WhileSpinning.("Application Exists", report: :app_id) {
241
+ AzureAPI::GraphRbac::Applications
242
+ .list
243
+ .find { |application| application.display_name == display_name }}}
236
244
 
237
245
  CreateApplication = ->(display_name) {
238
- AzureAPI::GraphRbac::Applications.create(
239
- AzureAPI::GraphRbac::Models::ApplicationCreateParameters.new.tap do |application|
240
- application.available_to_other_tenants = false
241
- application.display_name = display_name
242
- application.identifier_uris = ["http://#{display_name}"]
243
- end)}
246
+ WhileSpinning.("Create Application", report: :app_id) {
247
+ AzureAPI::GraphRbac::Applications.create(
248
+ AzureAPI::GraphRbac::Models::ApplicationCreateParameters.new.tap do |application|
249
+ application.available_to_other_tenants = false
250
+ application.display_name = display_name
251
+ application.identifier_uris = ["http://#{display_name}"]
252
+ end)}}
244
253
 
245
254
  FindServicePrincipal = ->(application) {
246
- AzureAPI::GraphRbac::ServicePrincipals
247
- .list
248
- .find { |service_principal| service_principal.app_id == application.app_id }}
255
+ WhileSpinning.("Service Principal Exists", report: :object_id) {
256
+ AzureAPI::GraphRbac::ServicePrincipals
257
+ .list
258
+ .find { |service_principal| service_principal.app_id == application.app_id }}}
249
259
 
250
260
  CreateServicePrincipal = ->(application) {
251
- AzureAPI::GraphRbac::ServicePrincipals.create(
252
- AzureAPI::GraphRbac::Models::ServicePrincipalCreateParameters.new.tap do |service_principal|
253
- service_principal.account_enabled = true
254
- service_principal.app_id = application.app_id
255
- end)}
261
+ WhileSpinning.("Create Service Principal", report: :object_id) {
262
+ AzureAPI::GraphRbac::ServicePrincipals.create(
263
+ AzureAPI::GraphRbac::Models::ServicePrincipalCreateParameters.new.tap do |service_principal|
264
+ service_principal.account_enabled = true
265
+ service_principal.app_id = application.app_id
266
+ end)}}
256
267
 
257
268
  FindRoleDefinition = ->(role_name) {
258
- AzureAPI::Authorization::RoleDefinitions
259
- .list("/subscriptions/#{SUBSCRIPTION_ID}")
260
- .find { |role_definition| role_definition.role_name == role_name }}
269
+ WhileSpinning.("Role Definition Exists", report: :role_name) {
270
+ AzureAPI::Authorization::RoleDefinitions
271
+ .list("/subscriptions/#{SUBSCRIPTION_ID}")
272
+ .find { |role_definition| role_definition.role_name == role_name }}}
261
273
 
262
274
  FindRoleAssignment = ->(name) {
263
- AzureAPI::Authorization::RoleAssignments
264
- .list
265
- .find { |role_assignment| role_assignment.name == name }}
275
+ WhileSpinning.("Role Assignment Exists", report: :name) {
276
+ AzureAPI::Authorization::RoleAssignments
277
+ .list
278
+ .find { |role_assignment| role_assignment.name == name }}}
266
279
 
267
280
  CreateRoleAssignment = ->(role_definition, service_principal, resource_group) {
268
- AzureAPI::Authorization::RoleAssignments.create(
269
- resource_group.id,
270
- Chamber.env.uuid,
271
- AzureAPI::Authorization::Models::RoleAssignmentCreateParameters.new.tap do |role_assignment|
272
- role_assignment.role_definition_id = role_definition.id
273
- role_assignment.principal_id = service_principal.object_id
274
- end)}
281
+ WhileSpinning.("Create Role Assignment", report: :name) {
282
+ AzureAPI::Authorization::RoleAssignments.create(
283
+ resource_group.id,
284
+ Chamber.env.uuid,
285
+ AzureAPI::Authorization::Models::RoleAssignmentCreateParameters.new.tap do |role_assignment|
286
+ role_assignment.role_definition_id = role_definition.id
287
+ role_assignment.principal_id = service_principal.object_id
288
+ end)}}
275
289
 
276
290
  UpdatePassword = ->(service_principal, password) {
277
- AzureAPI::GraphRbac::ServicePrincipals.update_password_credentials(
278
- service_principal.object_id,
279
- AzureAPI::GraphRbac::Models::PasswordCredentialsUpdateParameters.new.tap { |update|
280
- update.value = [AzureAPI::GraphRbac::Models::PasswordCredential.new.tap { |credential|
281
- credential.value = password
282
- credential.end_date = Time.parse(
283
- Chamber.env.credential_end_date).to_datetime}]})}
291
+ WhileSpinning.("Update Password") {
292
+ AzureAPI::GraphRbac::ServicePrincipals.update_password_credentials(
293
+ service_principal.object_id,
294
+ AzureAPI::GraphRbac::Models::PasswordCredentialsUpdateParameters.new.tap { |update|
295
+ update.value = [AzureAPI::GraphRbac::Models::PasswordCredential.new.tap { |credential|
296
+ credential.value = password
297
+ credential.end_date = Time.parse(
298
+ Chamber.env.credential_end_date).to_datetime}]})
299
+ true}}
284
300
 
285
301
  FindContainerService = ->(resource_group) {
286
- AzureAPI::ContainerService::ContainerServices
287
- .list_by_resource_group(resource_group.name)
288
- .find { |container_service| container_service.name == Chamber.env.identifier }}
302
+ WhileSpinning.("Container Service Exists", report: :name) {
303
+ AzureAPI::ContainerService::ContainerServices
304
+ .list_by_resource_group(resource_group.name)
305
+ .find { |container_service| container_service.name == Chamber.env.identifier }}}
289
306
 
290
307
  CreateContainerService = ->(service_principal, resource_group) {
291
- AzureAPI::ContainerService::ContainerServices.create_or_update(
292
- resource_group.name,
293
- Chamber.env.identifier,
294
- AzureAPI::ContainerService::Models::ContainerService.new.tap { |container_service|
295
- container_service.agent_pool_profiles = [
296
- AzureAPI::ContainerService::Models::ContainerServiceAgentPoolProfile.new.tap { |agent_pool_profile|
297
- agent_pool_profile.count = (
298
- Chamber.env.agent_count)
299
- agent_pool_profile.dns_prefix = (
300
- [Chamber.env.dns_prefix, Chamber.env.agent_dns_suffix]
301
- .join('-'))
302
- agent_pool_profile.name = (
303
- Chamber.env.identifier)
304
- agent_pool_profile.vm_size = (
305
- Chamber.env.vm_size)}]
306
- container_service.linux_profile = (
307
- AzureAPI::ContainerService::Models::ContainerServiceLinuxProfile.new.tap { |linux_profile|
308
- linux_profile.admin_username = (
309
- Chamber.env.admin_username)
310
- linux_profile.ssh = (
311
- AzureAPI::ContainerService::Models::ContainerServiceSshConfiguration.new.tap { |ssh|
312
- ssh.public_keys = [
313
- AzureAPI::ContainerService::Models::ContainerServiceSshPublicKey.new.tap { |public_key|
314
- public_key.key_data = (
315
- SSHKey.new(Chamber.env.ssh_private_key).ssh_public_key)}]})})
316
- container_service.location = Chamber.env.location
317
- container_service.master_profile = (
318
- AzureAPI::ContainerService::Models::ContainerServiceMasterProfile.new.tap { |master_profile|
319
- master_profile.dns_prefix = [Chamber.env.dns_prefix, Chamber.env.master_dns_suffix].join('-')})
320
- container_service.orchestrator_profile = (
321
- AzureAPI::ContainerService::Models::ContainerServiceOrchestratorProfile.new.tap { |orchestrator_profile|
322
- orchestrator_profile.orchestrator_type = Chamber.env.orchestrator_type})
323
- container_service.service_principal_profile = (
324
- AzureAPI::ContainerService::Models::ContainerServiceServicePrincipalProfile.new.tap { |service_principal_profile|
325
- service_principal_profile.client_id = service_principal.app_id
326
- service_principal_profile.secret = Chamber.env.password})})}
308
+ WhileSpinning.("Create Container Service", report: :name) {
309
+ AzureAPI::ContainerService::ContainerServices.create_or_update(
310
+ resource_group.name,
311
+ Chamber.env.identifier,
312
+ AzureAPI::ContainerService::Models::ContainerService.new.tap { |container_service|
313
+ container_service.agent_pool_profiles = [
314
+ AzureAPI::ContainerService::Models::ContainerServiceAgentPoolProfile.new.tap { |agent_pool_profile|
315
+ agent_pool_profile.count = (
316
+ Chamber.env.agent_count)
317
+ agent_pool_profile.dns_prefix = (
318
+ [Chamber.env.dns_prefix, Chamber.env.agent_dns_suffix]
319
+ .join('-'))
320
+ agent_pool_profile.name = (
321
+ Chamber.env.identifier)
322
+ agent_pool_profile.vm_size = (
323
+ Chamber.env.vm_size)}]
324
+ container_service.linux_profile = (
325
+ AzureAPI::ContainerService::Models::ContainerServiceLinuxProfile.new.tap { |linux_profile|
326
+ linux_profile.admin_username = (
327
+ Chamber.env.admin_username)
328
+ linux_profile.ssh = (
329
+ AzureAPI::ContainerService::Models::ContainerServiceSshConfiguration.new.tap { |ssh|
330
+ ssh.public_keys = [
331
+ AzureAPI::ContainerService::Models::ContainerServiceSshPublicKey.new.tap { |public_key|
332
+ public_key.key_data = (
333
+ SSHKey.new(Chamber.env.ssh_private_key).ssh_public_key)}]})})
334
+ container_service.location = Chamber.env.location
335
+ container_service.master_profile = (
336
+ AzureAPI::ContainerService::Models::ContainerServiceMasterProfile.new.tap { |master_profile|
337
+ master_profile.dns_prefix = [Chamber.env.dns_prefix, Chamber.env.master_dns_suffix].join('-')})
338
+ container_service.orchestrator_profile = (
339
+ AzureAPI::ContainerService::Models::ContainerServiceOrchestratorProfile.new.tap { |orchestrator_profile|
340
+ orchestrator_profile.orchestrator_type = Chamber.env.orchestrator_type})
341
+ container_service.service_principal_profile = (
342
+ AzureAPI::ContainerService::Models::ContainerServiceServicePrincipalProfile.new.tap { |service_principal_profile|
343
+ service_principal_profile.client_id = service_principal.app_id
344
+ service_principal_profile.secret = Chamber.env.password})})}}
327
345
 
328
346
  FindVirtualMachines = ->(resource_group) {
329
347
  AzureAPI::Compute::VirtualMachines
@@ -360,46 +378,50 @@ RunShellScript = ->(script, *rest) { RunShellScripts.([script], *rest) }
360
378
  RestartVirtualMachine = ->(resource_group, virtual_machine) { AzureAPI::Compute::VirtualMachines.restart(resource_group.name, virtual_machine.name) }.curry
361
379
 
362
380
  FindPublicIPv4 = ->(resource_group) {
363
- AzureAPI::Network::PublicIpaddresses
364
- .list(resource_group.name)
365
- .find { |public_ip_address| public_ip_address.name == Chamber.env.identifier }}
381
+ WhileSpinning.("Public IPv4 Exists", report: :ip_address) {
382
+ AzureAPI::Network::PublicIpaddresses
383
+ .list(resource_group.name)
384
+ .find { |public_ip_address| public_ip_address.name == Chamber.env.identifier }}}
366
385
 
367
386
  CreatePublicIPv4 = ->(resource_group) {
368
- AzureAPI::Network::PublicIpaddresses.create_or_update(
369
- resource_group.name,
370
- Chamber.env.identifier,
371
- AzureAPI::Network::Models::PublicIPAddress.new.tap { |public_ip_address|
372
- public_ip_address.location = Chamber.env.location
373
- public_ip_address.public_ipaddress_version = 'IPv4'
374
- public_ip_address.public_ipallocation_method = 'Static'
375
- })}
387
+ WhileSpinning.("Create Public IPv4", report: :ip_address) {
388
+ AzureAPI::Network::PublicIpaddresses.create_or_update(
389
+ resource_group.name,
390
+ Chamber.env.identifier,
391
+ AzureAPI::Network::Models::PublicIPAddress.new.tap { |public_ip_address|
392
+ public_ip_address.location = Chamber.env.location
393
+ public_ip_address.public_ipaddress_version = 'IPv4'
394
+ public_ip_address.public_ipallocation_method = 'Static'
395
+ })}}
376
396
 
377
397
  KubernetesMasterSecurityGroup = ->(resource_group) {
378
398
  name = [*KubernetesMaster.(resource_group).name.split('-').first(3), 'nsg'].join('-')
379
- AzureAPI::Network::NetworkSecurityGroups
380
- .list(resource_group.name)
381
- .find { |network_security_group| network_security_group.name == name }}
399
+ WhileSpinning.("Network Security Group Exists", report: :name) {
400
+ AzureAPI::Network::NetworkSecurityGroups
401
+ .list(resource_group.name)
402
+ .find { |network_security_group| network_security_group.name == name }}}
382
403
 
383
404
  FindSecurityRule = ->(network_security_group) {
384
- network_security_group
385
- .security_rules
386
- .find { |security_rule| security_rule.name == Chamber.env.identifier }
387
- }
405
+ WhileSpinning.("Security Rule Exists", report: :name) {
406
+ network_security_group
407
+ .security_rules
408
+ .find { |security_rule| security_rule.name == Chamber.env.identifier }}}
388
409
 
389
410
  CreateSecurityRule = ->(network_security_group, resource_group) {
390
- AzureAPI::Network::SecurityRules.create_or_update(
391
- resource_group.name,
392
- network_security_group.name,
393
- Chamber.env.identifier,
394
- AzureAPI::Network::Models::SecurityRule.new.tap { |security_rule|
395
- security_rule.access = 'Allow'
396
- security_rule.destination_address_prefix = '*'
397
- security_rule.destination_port_ranges = [80,443,4443,2222,2793]
398
- security_rule.direction = AzureAPI::Network::Models::SecurityRuleDirection::Inbound
399
- security_rule.priority = network_security_group.security_rules.map(&:priority).max.next
400
- security_rule.protocol = 'Tcp'
401
- security_rule.source_address_prefix = '*'
402
- security_rule.source_port_range = '*'})}
411
+ WhileSpinning.("Create Security Rule", report: :name) {
412
+ AzureAPI::Network::SecurityRules.create_or_update(
413
+ resource_group.name,
414
+ network_security_group.name,
415
+ Chamber.env.identifier,
416
+ AzureAPI::Network::Models::SecurityRule.new.tap { |security_rule|
417
+ security_rule.access = 'Allow'
418
+ security_rule.destination_address_prefix = '*'
419
+ security_rule.destination_port_ranges = [80,443,4443,2222,2793]
420
+ security_rule.direction = AzureAPI::Network::Models::SecurityRuleDirection::Inbound
421
+ security_rule.priority = network_security_group.security_rules.map(&:priority).max.next
422
+ security_rule.protocol = 'Tcp'
423
+ security_rule.source_address_prefix = '*'
424
+ security_rule.source_port_range = '*'})}}
403
425
 
404
426
  UpdateVirtualMachine = ->(virtual_machine, resource_group) {
405
427
  AzureAPI::Compute::VirtualMachines.create_or_update(
@@ -408,31 +430,36 @@ UpdateVirtualMachine = ->(virtual_machine, resource_group) {
408
430
  virtual_machine)}
409
431
 
410
432
  ApplyTag = ->(key, value, resource_group, virtual_machine) {
411
- UpdateVirtualMachine.(virtual_machine.tap { virtual_machine.tags[key] = value }, resource_group)}
433
+ WhileSpinning.("Apply Tag #{key}=#{value} to #{virtual_machine.name}") {
434
+ UpdateVirtualMachine.(virtual_machine.tap { virtual_machine.tags[key] = value }, resource_group)}}
412
435
 
413
436
  EnableSwapAccounting = ->(resource_group, virtual_machine) {
414
437
  return if virtual_machine.tags['cloudstrap.swap_accounting'] == 'enabled'
415
- RunShellScripts.([ENABLE_SWAP_ACCOUNTING, UPDATE_GRUB], resource_group, virtual_machine)
438
+ WhileSpinning.("Enable Swap Accounting on #{virtual_machine.name}") {
439
+ RunShellScripts.([ENABLE_SWAP_ACCOUNTING, UPDATE_GRUB], resource_group, virtual_machine)}
416
440
  ApplyTag.('cloudstrap.swap_accounting', 'enabled', resource_group, virtual_machine)}.curry
417
441
 
418
442
  RebootOnce = ->(resource_group, virtual_machine) {
419
443
  return if virtual_machine.tags['cloudstrap.reboot'] == 'finished'
420
444
  ApplyTag.('cloudstrap.reboot', 'started', resource_group, virtual_machine)
421
- RestartVirtualMachine.(resource_group, virtual_machine)
445
+ WhileSpinning.("Reboot Virtual Machine #{virtual_machine.name}") {
446
+ RestartVirtualMachine.(resource_group, virtual_machine)}
422
447
  ApplyTag.('cloudstrap.reboot', 'finished', resource_group, virtual_machine)}.curry
423
448
 
424
449
  FindNetworkInterface = ->(resource_group) {
425
- virtual_machine = KubernetesAgents.(resource_group).sort_by(&:name).first
426
- AzureAPI::Network::NetworkInterfaces
427
- .list(resource_group.name)
428
- .find { |network_interface| network_interface.virtual_machine.id.end_with?(virtual_machine.name)}}
450
+ WhileSpinning.("Network Interface Exists", report: :name) {
451
+ virtual_machine = KubernetesAgents.(resource_group).sort_by(&:name).first
452
+ AzureAPI::Network::NetworkInterfaces
453
+ .list(resource_group.name)
454
+ .find { |network_interface| network_interface.virtual_machine.id.end_with?(virtual_machine.name)}}}
429
455
 
430
456
  AssociatePublicIP = ->(resource_group, network_interface, public_ip_address) {
431
- AzureAPI::Network::NetworkInterfaces.create_or_update(
432
- resource_group.name,
433
- network_interface.name,
434
- network_interface.tap {
435
- network_interface.ip_configurations[0].public_ipaddress = public_ip_address})}
457
+ WhileSpinning.("Associate Public IPv4") {
458
+ AzureAPI::Network::NetworkInterfaces.create_or_update(
459
+ resource_group.name,
460
+ network_interface.name,
461
+ network_interface.tap {
462
+ network_interface.ip_configurations[0].public_ipaddress = public_ip_address})}}
436
463
 
437
464
  ################
438
465
  # Main Program #
@@ -455,29 +482,30 @@ WhileSpinning.('Constructing Library') do
455
482
  AddInteractiveCalls.(AzureAPI)
456
483
  end
457
484
 
458
- role_definition = WhileSpinning.('Find Role Definition') { FindRoleDefinition.(Chamber.env.role_definition) }
459
- resource_group = WhileSpinning.('Find/Create Resource Group') { FindResourceGroup.(Chamber.env.identifier) || CreateResourceGroup.(Chamber.env.identifier) }
460
- application = WhileSpinning.('Find/Create Application') { FindApplication.(Chamber.env.identifier) || CreateApplication.(Chamber.env.identifier) }
461
- service_principal = WhileSpinning.('Find/Create Service Principal') { FindServicePrincipal.(application) || CreateServicePrincipal.(application) }
462
485
 
463
- WhileSpinning.('Update Password for Service Principal') { UpdatePassword.(service_principal, Chamber.env.password) }
486
+ application = FindApplication.(Chamber.env.identifier) || CreateApplication.(Chamber.env.identifier)
487
+ service_principal = FindServicePrincipal.(application) || CreateServicePrincipal.(application)
488
+ role_definition = FindRoleDefinition.(Chamber.env.role_definition)
489
+ resource_group = FindResourceGroup.(Chamber.env.identifier) || CreateResourceGroup.(Chamber.env.identifier)
464
490
 
465
- role_assignment = WhileSpinning.('Find/Create Role Assignment') { FindRoleAssignment.(Chamber.env.uuid) || CreateRoleAssignment.(role_definition, service_principal, resource_group) }
466
- public_ip_address = WhileSpinning.('Find/Create Public IP Address') { FindPublicIPv4.(resource_group) || CreatePublicIPv4.(resource_group) }
467
- container_service = WhileSpinning.('Find/Create Container Service') { FindContainerService.(resource_group) || CreateContainerService.(service_principal, resource_group) }
491
+ UpdatePassword.(service_principal, Chamber.env.password)
468
492
 
469
- network_security_group = WhileSpinning.('Find Network Security Group') { KubernetesMasterSecurityGroup.(resource_group) }
470
- security_rule = WhileSpinning.('Find/Create Security Rule') { FindSecurityRule.(network_security_group) || CreateSecurityRule.(network_security_group, resource_group) }
493
+ role_assignment = FindRoleAssignment.(Chamber.env.uuid) || (
494
+ WhileSpinning.("Arbitrary Delay of #{ARBITRARY_DELAY} Seconds") { sleep ARBITRARY_DELAY }
495
+ CreateRoleAssignment.(role_definition, service_principal, resource_group))
471
496
 
472
- network_interface = WhileSpinning.('Find Network Interface') { FindNetworkInterface.(resource_group) }
473
- WhileSpinning.('Associate Public IP') { AssociatePublicIP.(resource_group, network_interface, public_ip_address) }
497
+ public_ip_address = FindPublicIPv4.(resource_group) || CreatePublicIPv4.(resource_group)
498
+ container_service = FindContainerService.(resource_group) || CreateContainerService.(service_principal, resource_group)
474
499
 
475
- WhileSpinning.('Configuring Swap Accounting') do
476
- KubernetesAgents
477
- .(resource_group)
478
- .each(&EnableSwapAccounting.(resource_group))
479
- .each(&RebootOnce.(resource_group))
480
- end
500
+ network_security_group = KubernetesMasterSecurityGroup.(resource_group)
501
+ security_rule = FindSecurityRule.(network_security_group) || CreateSecurityRule.(network_security_group, resource_group)
502
+ network_interface = FindNetworkInterface.(resource_group)
503
+ association = AssociatePublicIP.(resource_group, network_interface, public_ip_address)
504
+
505
+ KubernetesAgents
506
+ .(resource_group)
507
+ .each(&EnableSwapAccounting.(resource_group))
508
+ .each(&RebootOnce.(resource_group))
481
509
 
482
510
  def api(*args)
483
511
  AzureAPI.call(*args)
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cloudstrap-azure
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.3.pre
4
+ version: 0.5.6.pre
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Olstrom
@@ -34,7 +34,7 @@ cert_chain:
34
34
  EIKh6yDoB+oCRuiTV0uw/lKE2PtbONhJb7uN1qhZqla/iBpmUjiEu8+skI+ygv9n
35
35
  7Krw8FJrV3+VRCiZTPKHeshAfL9yeIZh
36
36
  -----END CERTIFICATE-----
37
- date: 2018-04-23 00:00:00.000000000 Z
37
+ date: 2018-04-24 00:00:00.000000000 Z
38
38
  dependencies:
39
39
  - !ruby/object:Gem::Dependency
40
40
  name: azure_graph_rbac
metadata.gz.sig CHANGED
Binary file