hako 2.12.0 → 2.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3778068a414fb367352ba788d4d957e863848258766bbc59efc5cf6a7b5344b5
4
- data.tar.gz: c9e21cd8877bd3445739d328551fb85b28457e19fb12ff770ac53b604ab021be
3
+ metadata.gz: 8a30d74550945e62c5f12018b854c043b2e5c2221b64ab3f8f01060e696c0b65
4
+ data.tar.gz: 8fb3a566c799e12a0650afed8ea9015eae8d6999abdb8bc5383c1099a25b98e3
5
5
  SHA512:
6
- metadata.gz: d8d4beb5835cb3efe38fdfae553b50ebfd254fff8df7c454a8087105158dbfb5b655e83472e47c27934d365146d0b4d34fd4babefa850963f06ec6c50319ac66
7
- data.tar.gz: ab158b547e18cb9a6231ee3726d5ba99934847f53699ef57cacc4779bc3551b2b1dfe51951d986904871b35286d7cc468f2cc683b6f5d3e15d7961b867395cd8
6
+ metadata.gz: b9d56daa1b534da5e3d21192161d208a7aa3cefd432bb58a11bc26cf744233f669d2915450a8319464da3b88973c7a96e697fa0c1b303f6bd6b8020c0318ed06
7
+ data.tar.gz: f918907a6a4e5d1f0df0e9e00bd392e83c809c7a94be3040261bfa6826282a0f5cfe841765cc9adc933afc71ce1b00c7646065f66f69f7a80e8fc016dc72069b
@@ -4,12 +4,12 @@ AllCops:
4
4
  DisplayCopNames: true
5
5
  TargetRubyVersion: 2.3
6
6
 
7
- Layout/IndentFirstArgument:
7
+ Layout/FirstArgumentIndentation:
8
8
  Enabled: false
9
9
 
10
10
  Naming/PredicateName:
11
11
  Enabled: false
12
- Naming/UncommunicativeMethodParamName:
12
+ Naming/MethodParameterName:
13
13
  Enabled: false
14
14
  Naming/MemoizedInstanceVariableName:
15
15
  Enabled: false
@@ -1,3 +1,10 @@
1
+ # 2.13.0 (2020-01-10)
2
+ ## New features
3
+ - Support capacity provider strategy
4
+
5
+ ## Bug fixes
6
+ - Do not try to update assign_public_ip when it is not changed
7
+
1
8
  # 2.12.0 (2019-09-09)
2
9
  ## New features
3
10
  - Support more overrides options for `hako oneshot`
@@ -6,8 +13,6 @@
6
13
  ## Bug fixes
7
14
  - Show `--health-*` options in dry-run
8
15
 
9
- ## Bug fixes
10
-
11
16
  # 2.11.1 (2019-05-17)
12
17
  ## Bug fixes
13
18
  - Fix comparison of `system_controls` parameter
@@ -26,7 +26,7 @@ Gem::Specification.new do |spec|
26
26
  spec.add_dependency 'aws-sdk-cloudwatch'
27
27
  spec.add_dependency 'aws-sdk-cloudwatchlogs'
28
28
  spec.add_dependency 'aws-sdk-ec2'
29
- spec.add_dependency 'aws-sdk-ecs', '>= 1.31.0'
29
+ spec.add_dependency 'aws-sdk-ecs', '>= 1.54.0'
30
30
  spec.add_dependency 'aws-sdk-elasticloadbalancing'
31
31
  spec.add_dependency 'aws-sdk-elasticloadbalancingv2'
32
32
  spec.add_dependency 'aws-sdk-s3'
@@ -74,6 +74,15 @@ module Hako
74
74
  @memory = options.fetch('memory', nil)
75
75
  @requires_compatibilities = options.fetch('requires_compatibilities', nil)
76
76
  @launch_type = options.fetch('launch_type', nil)
77
+ if options.key?('capacity_provider_strategy')
78
+ @capacity_provider_strategy = options.fetch('capacity_provider_strategy').map do |strategy|
79
+ {
80
+ capacity_provider: strategy.fetch('capacity_provider'),
81
+ weight: strategy.fetch('weight', nil),
82
+ base: strategy.fetch('base', nil),
83
+ }
84
+ end
85
+ end
77
86
  @platform_version = options.fetch('platform_version', nil)
78
87
  if options.key?('network_configuration')
79
88
  network_configuration = options.fetch('network_configuration')
@@ -670,6 +679,7 @@ module Hako
670
679
  placement_constraints: @placement_constraints,
671
680
  started_by: 'hako oneshot',
672
681
  launch_type: @launch_type,
682
+ capacity_provider_strategy: @capacity_provider_strategy,
673
683
  platform_version: @platform_version,
674
684
  network_configuration: @network_configuration,
675
685
  )
@@ -864,6 +874,7 @@ module Hako
864
874
  desired_count: @desired_count,
865
875
  task_definition: task_definition_arn,
866
876
  deployment_configuration: @deployment_configuration,
877
+ capacity_provider_strategy: @capacity_provider_strategy,
867
878
  platform_version: @platform_version,
868
879
  network_configuration: @network_configuration,
869
880
  health_check_grace_period_seconds: @health_check_grace_period_seconds,
@@ -872,6 +883,20 @@ module Hako
872
883
  # Keep current desired_count if autoscaling is enabled
873
884
  params[:desired_count] = current_service.desired_count
874
885
  end
886
+ # Copy the current capacity provider strategy in order to avoid a
887
+ # perpetual diff when the service is created with no strategy to use the
888
+ # cluster's default capacity provider strategy, which results in the
889
+ # strategy being set to the default strategy at that moment.
890
+ # It is not allowed to update the service to use the cluster's default
891
+ # capacity provider strategy when it is using a non-default capacity
892
+ # provider strategy.
893
+ params[:capacity_provider_strategy] ||= current_service.capacity_provider_strategy&.map(&:to_h)
894
+ if different_capacity_provider_strategy?(params[:capacity_provider_strategy], current_service.capacity_provider_strategy)
895
+ # Switching from launch type to capacity provider strategy or making
896
+ # a change to a capacity provider strategy requires to force a new
897
+ # deployment.
898
+ params[:force_new_deployment] = true
899
+ end
875
900
  warn_placement_policy_change(current_service)
876
901
  warn_service_registries_change(current_service)
877
902
  if service_changed?(current_service, params)
@@ -895,6 +920,7 @@ module Hako
895
920
  placement_strategy: @placement_strategy,
896
921
  scheduling_strategy: @scheduling_strategy,
897
922
  launch_type: @launch_type,
923
+ capacity_provider_strategy: @capacity_provider_strategy,
898
924
  platform_version: @platform_version,
899
925
  network_configuration: @network_configuration,
900
926
  health_check_grace_period_seconds: @health_check_grace_period_seconds,
@@ -1348,6 +1374,15 @@ module Hako
1348
1374
  nil
1349
1375
  end
1350
1376
 
1377
+ # @param [Hash, nil] expected_strategy
1378
+ # @param [Aws::ECS::Types::CapacityProviderStrategyItem, nil] actual_strategy
1379
+ # @return [Boolean]
1380
+ def different_capacity_provider_strategy?(expected_strategy, actual_strategy)
1381
+ expected = (expected_strategy || []).map { |s| [s[:capacity_provider], s[:weight] || 0, s[:base] || 0] }.sort
1382
+ actual = (actual_strategy || []).map { |s| [s.capacity_provider, s.weight, s.base] }.sort
1383
+ expected != actual
1384
+ end
1385
+
1351
1386
  # @param [Aws::ECS::Types::Service] service
1352
1387
  # @return [nil]
1353
1388
  def warn_placement_policy_change(service)
@@ -23,6 +23,7 @@ module Hako
23
23
  struct.member(:desired_count, Schema::Integer.new)
24
24
  struct.member(:task_definition, Schema::String.new)
25
25
  struct.member(:deployment_configuration, Schema::WithDefault.new(deployment_configuration_schema, default_configuration))
26
+ struct.member(:capacity_provider_strategy, Schema::Nullable.new(Schema::UnorderedArray.new(capacity_provider_strategy_schema)))
26
27
  struct.member(:platform_version, Schema::WithDefault.new(Schema::String.new, 'LATEST'))
27
28
  struct.member(:network_configuration, Schema::Nullable.new(network_configuration_schema))
28
29
  struct.member(:health_check_grace_period_seconds, Schema::Nullable.new(Schema::Integer.new))
@@ -36,6 +37,14 @@ module Hako
36
37
  end
37
38
  end
38
39
 
40
+ def capacity_provider_strategy_schema
41
+ Schema::Structure.new.tap do |struct|
42
+ struct.member(:capacity_provider, Schema::String.new)
43
+ struct.member(:weight, Schema::WithDefault.new(Schema::Integer.new, 0))
44
+ struct.member(:base, Schema::WithDefault.new(Schema::Integer.new, 0))
45
+ end
46
+ end
47
+
39
48
  def network_configuration_schema
40
49
  Schema::Structure.new.tap do |struct|
41
50
  struct.member(:awsvpc_configuration, awsvpc_configuration_schema)
@@ -46,7 +55,7 @@ module Hako
46
55
  Schema::Structure.new.tap do |struct|
47
56
  struct.member(:subnets, Schema::UnorderedArray.new(Schema::String.new))
48
57
  struct.member(:security_groups, Schema::UnorderedArray.new(Schema::String.new))
49
- struct.member(:assign_public_ip, Schema::String.new)
58
+ struct.member(:assign_public_ip, Schema::WithDefault.new(Schema::String.new, 'DISABLED'))
50
59
  end
51
60
  end
52
61
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Hako
4
- VERSION = '2.12.0'
4
+ VERSION = '2.13.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hako
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.12.0
4
+ version: 2.13.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kohei Suzuki
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-09-09 00:00:00.000000000 Z
11
+ date: 2020-01-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk-applicationautoscaling
@@ -86,14 +86,14 @@ dependencies:
86
86
  requirements:
87
87
  - - ">="
88
88
  - !ruby/object:Gem::Version
89
- version: 1.31.0
89
+ version: 1.54.0
90
90
  type: :runtime
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - ">="
95
95
  - !ruby/object:Gem::Version
96
- version: 1.31.0
96
+ version: 1.54.0
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: aws-sdk-elasticloadbalancing
99
99
  requirement: !ruby/object:Gem::Requirement
@@ -397,7 +397,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
397
397
  - !ruby/object:Gem::Version
398
398
  version: '0'
399
399
  requirements: []
400
- rubygems_version: 3.0.3
400
+ rubygems_version: 3.1.2
401
401
  signing_key:
402
402
  specification_version: 4
403
403
  summary: Deploy Docker container