hako 2.12.0 → 2.15.1

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: 3778068a414fb367352ba788d4d957e863848258766bbc59efc5cf6a7b5344b5
4
- data.tar.gz: c9e21cd8877bd3445739d328551fb85b28457e19fb12ff770ac53b604ab021be
3
+ metadata.gz: 1c14a60c35c89be5465d9844da304c8dad15dce069edf54ccbba7f47376dc536
4
+ data.tar.gz: c9714116d65bc4d3746cbc968a0bd0315cd3677d3e5042e0937e4cfd29a48620
5
5
  SHA512:
6
- metadata.gz: d8d4beb5835cb3efe38fdfae553b50ebfd254fff8df7c454a8087105158dbfb5b655e83472e47c27934d365146d0b4d34fd4babefa850963f06ec6c50319ac66
7
- data.tar.gz: ab158b547e18cb9a6231ee3726d5ba99934847f53699ef57cacc4779bc3551b2b1dfe51951d986904871b35286d7cc468f2cc683b6f5d3e15d7961b867395cd8
6
+ metadata.gz: 12f663b6e4c17872e8d117f0a5fb4049b786e4af0e76ac7ff0b0d9bcb490299da15c0bc24a86a8a16a7d286585e9b428b68eba6121ed0212d353027db049cbe9
7
+ data.tar.gz: ee0bc9a4692583f332ac08060088f3e5374fd2297d6c54b9208ec529a813413ee11f3847788b32aa43f5c1d7b40814889de86b9290c4000707060ea51a68e8cb
@@ -0,0 +1,42 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ pull_request:
7
+
8
+ jobs:
9
+ rspec:
10
+ name: RSpec
11
+ runs-on: ubuntu-latest
12
+ continue-on-error: ${{ matrix.experimental }}
13
+ strategy:
14
+ fail-fast: false
15
+ matrix:
16
+ ruby:
17
+ - 2.5
18
+ - 2.6
19
+ - 2.7
20
+ - 3.0
21
+ experimental: [false]
22
+ include:
23
+ - ruby: head
24
+ experimental: true
25
+ steps:
26
+ - uses: actions/checkout@v2
27
+ - uses: ruby/setup-ruby@v1
28
+ with:
29
+ ruby-version: ${{ matrix.ruby }}
30
+ bundler-cache: true
31
+ - run: bundle exec rspec
32
+ rubocop:
33
+ name: RuboCop
34
+ runs-on: ubuntu-latest
35
+ steps:
36
+ - uses: actions/checkout@v2
37
+ - uses: ruby/setup-ruby@v1
38
+ with:
39
+ # Use the same version with .rubocop.yml
40
+ ruby-version: 2.5
41
+ bundler-cache: true
42
+ - run: bundle exec rubocop
data/.rubocop.yml CHANGED
@@ -2,14 +2,17 @@ inherit_from: .rubocop_todo.yml
2
2
 
3
3
  AllCops:
4
4
  DisplayCopNames: true
5
- TargetRubyVersion: 2.3
5
+ TargetRubyVersion: 2.5
6
+ NewCops: disable
6
7
 
7
- Layout/IndentFirstArgument:
8
+ Layout/FirstArgumentIndentation:
9
+ Enabled: false
10
+ Layout/LineLength:
8
11
  Enabled: false
9
12
 
10
13
  Naming/PredicateName:
11
14
  Enabled: false
12
- Naming/UncommunicativeMethodParamName:
15
+ Naming/MethodParameterName:
13
16
  Enabled: false
14
17
  Naming/MemoizedInstanceVariableName:
15
18
  Enabled: false
@@ -35,6 +38,8 @@ Style/RaiseArgs:
35
38
  EnforcedStyle: compact
36
39
  Style/SignalException:
37
40
  Enabled: false
41
+ Style/SoleNestedConditional:
42
+ Enabled: false
38
43
  Style/StderrPuts:
39
44
  Enabled: false
40
45
  Style/TrailingCommaInArguments:
data/.rubocop_todo.yml CHANGED
@@ -6,8 +6,6 @@ Metrics/ClassLength:
6
6
  Enabled: false
7
7
  Metrics/CyclomaticComplexity:
8
8
  Enabled: false
9
- Metrics/LineLength:
10
- Enabled: false
11
9
  Metrics/MethodLength:
12
10
  Enabled: false
13
11
  Metrics/ParameterLists:
data/CHANGELOG.md CHANGED
@@ -1,3 +1,24 @@
1
+ # 2.15.1 (2021-08-06)
2
+ ## Bug fixes
3
+ - Fix keyword arguments for Ruby 3.0
4
+
5
+ # 2.15.0 (2020-11-02)
6
+ ## New features
7
+ - Support protocol_version and matcher option of ALB target groups
8
+
9
+ # 2.14.0 (2020-05-20)
10
+ ## New features
11
+ - Support tags for task definition and propagate them to ECS tasks
12
+ - Now all created ECS services and launched ECS tasks have `propagate_tags=TASK_DEFINITION` parameter.
13
+ - Support repository_credentials
14
+
15
+ # 2.13.0 (2020-01-10)
16
+ ## New features
17
+ - Support capacity provider strategy
18
+
19
+ ## Bug fixes
20
+ - Do not try to update assign_public_ip when it is not changed
21
+
1
22
  # 2.12.0 (2019-09-09)
2
23
  ## New features
3
24
  - Support more overrides options for `hako oneshot`
@@ -6,8 +27,6 @@
6
27
  ## Bug fixes
7
28
  - Show `--health-*` options in dry-run
8
29
 
9
- ## Bug fixes
10
-
11
30
  # 2.11.1 (2019-05-17)
12
31
  ## Bug fixes
13
32
  - Fix comparison of `system_controls` parameter
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Hako
2
2
  [![Gem Version](https://badge.fury.io/rb/hako.svg)](http://badge.fury.io/rb/hako)
3
- [![Build Status](https://travis-ci.org/eagletmt/hako.svg)](https://travis-ci.org/eagletmt/hako)
3
+ ![CI](https://github.com/eagletmt/hako/workflows/CI/badge.svg)
4
4
 
5
5
  Deploy Docker container.
6
6
 
@@ -0,0 +1,60 @@
1
+ {
2
+ scheduler: {
3
+ type: 'ecs',
4
+ region: 'ap-northeast-1',
5
+ cluster: 'eagletmt',
6
+ desired_count: 2,
7
+ role: 'ecsServiceRole',
8
+ elb_v2: {
9
+ // Specify protocol_version for gRPC servers
10
+ protocol_version: 'GRPC',
11
+ // VPC id where the target group is located
12
+ vpc_id: 'vpc-WWWWWWWW',
13
+ // If you want internal ELB, then use 'scheme'. (ex. internal service that like microservice inside VPC)
14
+ scheme: 'internal',
15
+ // Health check path of the target group
16
+ health_check_path: '/AWS.ELB/healthcheck',
17
+ listeners: [
18
+ {
19
+ port: 50051,
20
+ protocol: 'HTTPS',
21
+ certificate_arn: 'arn:aws:acm:ap-northeast-1:012345678901:certificate/01234567-89ab-cdef-0123-456789abcdef',
22
+ },
23
+ ],
24
+ subnets: ['subnet-XXXXXXXX', 'subnet-YYYYYYYY'],
25
+ security_groups: ['sg-ZZZZZZZZ'],
26
+ load_balancer_attributes: {
27
+ 'access_logs.s3.enabled': 'true',
28
+ 'access_logs.s3.bucket': 'hako-access-logs',
29
+ 'access_logs.s3.prefix': 'hako-hello-grpc',
30
+ },
31
+ target_group_attributes: {
32
+ // http://docs.aws.amazon.com/en_us/elasticloadbalancing/latest/application/load-balancer-target-groups.html#target-group-attributes
33
+ 'deregistration_delay.timeout_seconds': '20',
34
+ },
35
+ // Route ELB traffic to app container directly
36
+ container_name: 'app',
37
+ container: 50051,
38
+ },
39
+ },
40
+ app: {
41
+ image: 'awesome-grpc-server',
42
+ memory: 128,
43
+ cpu: 256,
44
+ env: {
45
+ PORT: '50051',
46
+ },
47
+ secrets: [{
48
+ name: 'MESSAGE',
49
+ value_from: 'arn:aws:ssm:ap-northeast-1:012345678901:parameter/hako/hello-grpc/secret-message',
50
+ }],
51
+ port_mappings: [
52
+ {
53
+ container_port: 50051,
54
+ host_port: 0,
55
+ protocol: 'tcp',
56
+ },
57
+ ],
58
+ },
59
+ scripts: [],
60
+ }
data/hako.gemspec CHANGED
@@ -19,16 +19,16 @@ Gem::Specification.new do |spec|
19
19
  spec.bindir = 'exe'
20
20
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
21
21
  spec.require_paths = ['lib']
22
- spec.required_ruby_version = '>= 2.3.0'
22
+ spec.required_ruby_version = '>= 2.5.0'
23
23
 
24
24
  spec.add_dependency 'aws-sdk-applicationautoscaling'
25
25
  spec.add_dependency 'aws-sdk-autoscaling'
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
- spec.add_dependency 'aws-sdk-elasticloadbalancingv2'
31
+ spec.add_dependency 'aws-sdk-elasticloadbalancingv2', '>= 1.54.0'
32
32
  spec.add_dependency 'aws-sdk-s3'
33
33
  spec.add_dependency 'aws-sdk-servicediscovery'
34
34
  spec.add_dependency 'aws-sdk-sns'
@@ -36,7 +36,6 @@ Gem::Specification.new do |spec|
36
36
  spec.add_dependency 'jsonnet'
37
37
 
38
38
  spec.add_development_dependency 'bundler'
39
- spec.add_development_dependency 'coveralls'
40
39
  spec.add_development_dependency 'rake'
41
40
  spec.add_development_dependency 'rspec'
42
41
  spec.add_development_dependency 'rubocop', '>= 0.53.0'
data/lib/hako/cli.rb CHANGED
@@ -73,7 +73,7 @@ module Hako
73
73
  else
74
74
  {}
75
75
  end
76
- Commander.new(Application.new(@definition_path, options)).deploy(force: @force, tag: @tag, dry_run: @dry_run, timeout: @timeout)
76
+ Commander.new(Application.new(@definition_path, **options)).deploy(force: @force, tag: @tag, dry_run: @dry_run, timeout: @timeout)
77
77
  end
78
78
 
79
79
  DEFAULT_TIMEOUT = 1200 # 20 minutes
@@ -121,7 +121,7 @@ module Hako
121
121
  else
122
122
  {}
123
123
  end
124
- Commander.new(Application.new(@definition_path, options)).rollback(dry_run: @dry_run)
124
+ Commander.new(Application.new(@definition_path, **options)).rollback(dry_run: @dry_run)
125
125
  end
126
126
 
127
127
  def parse!(argv)
@@ -164,7 +164,7 @@ module Hako
164
164
  else
165
165
  {}
166
166
  end
167
- Commander.new(Application.new(@definition_path, options)).oneshot(@argv, tag: @tag, containers: @containers, env: @env, dry_run: @dry_run, no_wait: @no_wait, overrides: @overrides)
167
+ Commander.new(Application.new(@definition_path, **options)).oneshot(@argv, tag: @tag, containers: @containers, env: @env, dry_run: @dry_run, no_wait: @no_wait, overrides: @overrides)
168
168
  end
169
169
 
170
170
  def parse!(argv)
@@ -18,7 +18,7 @@ module Hako
18
18
  # @param [String, nil] tag
19
19
  # @param [Boolean] dry_run
20
20
  # @return [nil]
21
- def deploy(force: false, tag:, dry_run: false, timeout:)
21
+ def deploy(tag:, timeout:, force: false, dry_run: false)
22
22
  containers = load_containers(tag, dry_run: dry_run)
23
23
  scripts = @app.definition.fetch('scripts', []).map { |config| load_script(config, dry_run: dry_run) }
24
24
  volumes = @app.definition.fetch('volumes', {})
@@ -126,7 +126,7 @@ module Hako
126
126
  # @param [Boolean] dry_run
127
127
  # @param [Integer] timeout
128
128
  # @return [Scheduler]
129
- def load_scheduler(scheduler_definition, scripts, volumes: {}, force: false, dry_run:, timeout: nil)
129
+ def load_scheduler(scheduler_definition, scripts, dry_run:, volumes: {}, force: false, timeout: nil)
130
130
  Loader.new(Hako::Schedulers, 'hako/schedulers').load(scheduler_definition.fetch('type')).new(@app.id, scheduler_definition, volumes: volumes, scripts: scripts, force: force, dry_run: dry_run, timeout: timeout)
131
131
  end
132
132
 
@@ -213,6 +213,15 @@ module Hako
213
213
  end
214
214
  end
215
215
 
216
+ # @return [Hash, nil]
217
+ def repository_credentials
218
+ if @definition.key?('repository_credentials')
219
+ {
220
+ credentials_parameter: @definition['repository_credentials'].fetch('credentials_parameter'),
221
+ }
222
+ end
223
+ end
224
+
216
225
  private
217
226
 
218
227
  PROVIDERS_KEY = '$providers'
@@ -7,7 +7,7 @@ module Hako
7
7
  class File < EnvProvider
8
8
  # @param [Pathname] root_path
9
9
  # @param [Hash<String, Object>] options
10
- def initialize(root_path, options)
10
+ def initialize(root_path, options) # rubocop:disable Lint/MissingSuper
11
11
  unless options['path']
12
12
  validation_error!('path must be set')
13
13
  end
@@ -8,7 +8,7 @@ module Hako
8
8
  class Yaml < EnvProvider
9
9
  # @param [Pathname] root_path
10
10
  # @param [Hash<String, Object>] options
11
- def initialize(root_path, options)
11
+ def initialize(root_path, options) # rubocop:disable Lint/MissingSuper
12
12
  unless options['path']
13
13
  validation_error!('path must be set')
14
14
  end
@@ -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')
@@ -91,6 +100,7 @@ module Hako
91
100
  if options['service_discovery']
92
101
  @service_discovery = EcsServiceDiscovery.new(options.fetch('service_discovery'), @region, dry_run: @dry_run)
93
102
  end
103
+ @tags = options.fetch('tags', {}).map { |k, v| { key: k, value: v.to_s } }
94
104
 
95
105
  @started_at = nil
96
106
  @container_instance_arn = nil
@@ -455,8 +465,9 @@ module Hako
455
465
 
456
466
  # @param [Array<Hash>] desired_definitions
457
467
  # @param [Aws::ECS::Types::TaskDefinition] actual_definition
458
- # @return [Array<Boolean]
459
- def task_definition_changed?(desired_definitions, actual_definition)
468
+ # @param [Array<Aws::ECS::Types::Tag>] actual_tags
469
+ # @return [Array<Boolean>]
470
+ def task_definition_changed?(desired_definitions, actual_definition, actual_tags)
460
471
  if @force
461
472
  return true
462
473
  end
@@ -505,6 +516,12 @@ module Hako
505
516
  return true
506
517
  end
507
518
 
519
+ actual_tags_set = Set.new(actual_tags.map { |t| { key: t.key, value: t.value } })
520
+ tags_set = Set.new(@tags)
521
+ if actual_tags_set != tags_set
522
+ return true
523
+ end
524
+
508
525
  false
509
526
  end
510
527
 
@@ -526,7 +543,10 @@ module Hako
526
543
  # @return [Array<Boolean, Aws::ECS::Types::TaskDefinition>]
527
544
  def register_task_definition(definitions)
528
545
  current_task_definition = describe_task_definition(@app_id)
529
- if task_definition_changed?(definitions, current_task_definition)
546
+ if current_task_definition
547
+ current_tags = ecs_client.list_tags_for_resource(resource_arn: current_task_definition.task_definition_arn).tags
548
+ end
549
+ if task_definition_changed?(definitions, current_task_definition, current_tags)
530
550
  new_task_definition = ecs_client.register_task_definition(
531
551
  family: @app_id,
532
552
  task_role_arn: @task_role_arn,
@@ -537,6 +557,7 @@ module Hako
537
557
  requires_compatibilities: @requires_compatibilities,
538
558
  cpu: @cpu,
539
559
  memory: @memory,
560
+ tags: @tags.empty? ? nil : @tags,
540
561
  ).task_definition
541
562
  [true, new_task_definition]
542
563
  else
@@ -556,34 +577,36 @@ module Hako
556
577
  # @return [Array<Boolean, Aws::ECS::Types::TaskDefinition]
557
578
  def register_task_definition_for_oneshot(definitions)
558
579
  10.times do |i|
559
- begin
560
- family = "#{@app_id}-oneshot"
561
- current_task_definition = describe_task_definition(family)
562
- if task_definition_changed?(definitions, current_task_definition)
563
- new_task_definition = ecs_client.register_task_definition(
564
- family: family,
565
- task_role_arn: @task_role_arn,
566
- execution_role_arn: @execution_role_arn,
567
- network_mode: @network_mode,
568
- container_definitions: definitions,
569
- volumes: volumes_definition,
570
- requires_compatibilities: @requires_compatibilities,
571
- cpu: @cpu,
572
- memory: @memory,
573
- ).task_definition
574
- return [true, new_task_definition]
575
- else
576
- return [false, current_task_definition]
577
- end
578
- rescue Aws::ECS::Errors::ClientException => e
579
- if e.message.include?('Too many concurrent attempts to create a new revision of the specified family')
580
- Hako.logger.error(e.message)
581
- interval = 2**i + rand(0.0..10.0)
582
- Hako.logger.error("Retrying register_task_definition_for_oneshot after #{interval} seconds")
583
- sleep(interval)
584
- else
585
- raise e
586
- end
580
+ family = "#{@app_id}-oneshot"
581
+ current_task_definition = describe_task_definition(family)
582
+ if current_task_definition
583
+ current_tags = ecs_client.list_tags_for_resource(resource_arn: current_task_definition.task_definition_arn).tags
584
+ end
585
+ if task_definition_changed?(definitions, current_task_definition, current_tags)
586
+ new_task_definition = ecs_client.register_task_definition(
587
+ family: family,
588
+ task_role_arn: @task_role_arn,
589
+ execution_role_arn: @execution_role_arn,
590
+ network_mode: @network_mode,
591
+ container_definitions: definitions,
592
+ volumes: volumes_definition,
593
+ requires_compatibilities: @requires_compatibilities,
594
+ cpu: @cpu,
595
+ memory: @memory,
596
+ tags: @tags.empty? ? nil : @tags,
597
+ ).task_definition
598
+ return [true, new_task_definition]
599
+ else
600
+ return [false, current_task_definition]
601
+ end
602
+ rescue Aws::ECS::Errors::ClientException => e
603
+ if e.message.include?('Too many concurrent attempts to create a new revision of the specified family')
604
+ Hako.logger.error(e.message)
605
+ interval = 2**i + rand(0.0..10.0)
606
+ Hako.logger.error("Retrying register_task_definition_for_oneshot after #{interval} seconds")
607
+ sleep(interval)
608
+ else
609
+ raise e
587
610
  end
588
611
  end
589
612
  raise Error.new('Unable to register task definition for oneshot due to too many client errors')
@@ -653,6 +676,7 @@ module Hako
653
676
  readonly_root_filesystem: container.readonly_root_filesystem,
654
677
  docker_security_options: container.docker_security_options,
655
678
  system_controls: container.system_controls,
679
+ repository_credentials: container.repository_credentials,
656
680
  }
657
681
  end
658
682
 
@@ -670,8 +694,10 @@ module Hako
670
694
  placement_constraints: @placement_constraints,
671
695
  started_by: 'hako oneshot',
672
696
  launch_type: @launch_type,
697
+ capacity_provider_strategy: @capacity_provider_strategy,
673
698
  platform_version: @platform_version,
674
699
  network_configuration: @network_configuration,
700
+ propagate_tags: 'TASK_DEFINITION',
675
701
  )
676
702
  result.failures.each do |failure|
677
703
  Hako.logger.error("#{failure.arn} #{failure.reason}")
@@ -864,6 +890,7 @@ module Hako
864
890
  desired_count: @desired_count,
865
891
  task_definition: task_definition_arn,
866
892
  deployment_configuration: @deployment_configuration,
893
+ capacity_provider_strategy: @capacity_provider_strategy,
867
894
  platform_version: @platform_version,
868
895
  network_configuration: @network_configuration,
869
896
  health_check_grace_period_seconds: @health_check_grace_period_seconds,
@@ -872,6 +899,20 @@ module Hako
872
899
  # Keep current desired_count if autoscaling is enabled
873
900
  params[:desired_count] = current_service.desired_count
874
901
  end
902
+ # Copy the current capacity provider strategy in order to avoid a
903
+ # perpetual diff when the service is created with no strategy to use the
904
+ # cluster's default capacity provider strategy, which results in the
905
+ # strategy being set to the default strategy at that moment.
906
+ # It is not allowed to update the service to use the cluster's default
907
+ # capacity provider strategy when it is using a non-default capacity
908
+ # provider strategy.
909
+ params[:capacity_provider_strategy] ||= current_service.capacity_provider_strategy&.map(&:to_h)
910
+ if different_capacity_provider_strategy?(params[:capacity_provider_strategy], current_service.capacity_provider_strategy)
911
+ # Switching from launch type to capacity provider strategy or making
912
+ # a change to a capacity provider strategy requires to force a new
913
+ # deployment.
914
+ params[:force_new_deployment] = true
915
+ end
875
916
  warn_placement_policy_change(current_service)
876
917
  warn_service_registries_change(current_service)
877
918
  if service_changed?(current_service, params)
@@ -895,9 +936,11 @@ module Hako
895
936
  placement_strategy: @placement_strategy,
896
937
  scheduling_strategy: @scheduling_strategy,
897
938
  launch_type: @launch_type,
939
+ capacity_provider_strategy: @capacity_provider_strategy,
898
940
  platform_version: @platform_version,
899
941
  network_configuration: @network_configuration,
900
942
  health_check_grace_period_seconds: @health_check_grace_period_seconds,
943
+ propagate_tags: 'TASK_DEFINITION',
901
944
  }
902
945
  if @scheduling_strategy != 'DAEMON'
903
946
  params[:desired_count] = 0
@@ -1348,6 +1391,15 @@ module Hako
1348
1391
  nil
1349
1392
  end
1350
1393
 
1394
+ # @param [Hash, nil] expected_strategy
1395
+ # @param [Aws::ECS::Types::CapacityProviderStrategyItem, nil] actual_strategy
1396
+ # @return [Boolean]
1397
+ def different_capacity_provider_strategy?(expected_strategy, actual_strategy)
1398
+ expected = (expected_strategy || []).map { |s| [s[:capacity_provider], s[:weight] || 0, s[:base] || 0] }.sort
1399
+ actual = (actual_strategy || []).map { |s| [s.capacity_provider, s.weight, s.base] }.sort
1400
+ expected != actual
1401
+ end
1402
+
1351
1403
  # @param [Aws::ECS::Types::Service] service
1352
1404
  # @return [nil]
1353
1405
  def warn_placement_policy_change(service)
@@ -162,9 +162,7 @@ module Hako
162
162
  end
163
163
 
164
164
  class Policy
165
- attr_reader :policy_type
166
- attr_reader :alarms, :cooldown, :adjustment_type, :scaling_adjustment, :metric_interval_lower_bound, :metric_interval_upper_bound, :metric_aggregation_type
167
- attr_reader :target_value, :predefined_metric_type, :scale_out_cooldown, :scale_in_cooldown, :disable_scale_in
165
+ attr_reader :policy_type, :alarms, :cooldown, :adjustment_type, :scaling_adjustment, :metric_interval_lower_bound, :metric_interval_upper_bound, :metric_aggregation_type, :target_value, :predefined_metric_type, :scale_out_cooldown, :scale_in_cooldown, :disable_scale_in
168
166
 
169
167
  # @param [Hash] options
170
168
  def initialize(options)
@@ -46,6 +46,7 @@ module Hako
46
46
  struct.member(:readonly_root_filesystem, Schema::Nullable.new(Schema::Boolean.new))
47
47
  struct.member(:docker_security_options, Schema::Nullable.new(Schema::UnorderedArray.new(Schema::String.new)))
48
48
  struct.member(:system_controls, Schema::Nullable.new(system_controls_schema))
49
+ struct.member(:repository_credentials, Schema::Nullable.new(repository_credentials_schema))
49
50
  end
50
51
  end
51
52
 
@@ -182,6 +183,12 @@ module Hako
182
183
  struct.member(:value, Schema::String.new)
183
184
  end
184
185
  end
186
+
187
+ def repository_credentials_schema
188
+ Schema::Structure.new.tap do |struct|
189
+ struct.member(:credentials_parameter, Schema::String.new)
190
+ end
191
+ end
185
192
  end
186
193
  end
187
194
  end
@@ -89,13 +89,22 @@ module Hako
89
89
  target_type: @elb_v2_config.fetch('target_type', nil),
90
90
  ).target_groups[0]
91
91
  else
92
+ matcher =
93
+ if @elb_v2_config.key?('matcher')
94
+ {
95
+ http_code: @elb_v2_config.fetch('matcher')['http_code'],
96
+ grpc_code: @elb_v2_config.fetch('matcher')['grpc_code'],
97
+ }
98
+ end
92
99
  elb_client.create_target_group(
93
100
  name: target_group_name,
94
101
  port: 80,
95
102
  protocol: 'HTTP',
103
+ protocol_version: @elb_v2_config.fetch('protocol_version', 'HTTP1'),
96
104
  vpc_id: @elb_v2_config.fetch('vpc_id'),
97
105
  health_check_path: @elb_v2_config.fetch('health_check_path', nil),
98
106
  target_type: @elb_v2_config.fetch('target_type', nil),
107
+ matcher: matcher,
99
108
  ).target_groups[0]
100
109
  end
101
110
 
@@ -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
 
@@ -10,7 +10,7 @@ module Hako
10
10
  class NginxFront < Script
11
11
  S3Config = Struct.new(:region, :bucket, :prefix) do
12
12
  # @param [Hash] options
13
- def initialize(options)
13
+ def initialize(options) # rubocop:disable Lint/MissingSuper
14
14
  self.region = options.fetch('region')
15
15
  self.bucket = options.fetch('bucket')
16
16
  self.prefix = options.fetch('prefix', nil)
data/lib/hako/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Hako
4
- VERSION = '2.12.0'
4
+ VERSION = '2.15.1'
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.15.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kohei Suzuki
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-09-09 00:00:00.000000000 Z
11
+ date: 2021-08-06 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
@@ -114,14 +114,14 @@ dependencies:
114
114
  requirements:
115
115
  - - ">="
116
116
  - !ruby/object:Gem::Version
117
- version: '0'
117
+ version: 1.54.0
118
118
  type: :runtime
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
122
  - - ">="
123
123
  - !ruby/object:Gem::Version
124
- version: '0'
124
+ version: 1.54.0
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: aws-sdk-s3
127
127
  requirement: !ruby/object:Gem::Requirement
@@ -206,20 +206,6 @@ dependencies:
206
206
  - - ">="
207
207
  - !ruby/object:Gem::Version
208
208
  version: '0'
209
- - !ruby/object:Gem::Dependency
210
- name: coveralls
211
- requirement: !ruby/object:Gem::Requirement
212
- requirements:
213
- - - ">="
214
- - !ruby/object:Gem::Version
215
- version: '0'
216
- type: :development
217
- prerelease: false
218
- version_requirements: !ruby/object:Gem::Requirement
219
- requirements:
220
- - - ">="
221
- - !ruby/object:Gem::Version
222
- version: '0'
223
209
  - !ruby/object:Gem::Dependency
224
210
  name: rake
225
211
  requirement: !ruby/object:Gem::Requirement
@@ -298,11 +284,11 @@ executables:
298
284
  extensions: []
299
285
  extra_rdoc_files: []
300
286
  files:
287
+ - ".github/workflows/ci.yml"
301
288
  - ".gitignore"
302
289
  - ".rspec"
303
290
  - ".rubocop.yml"
304
291
  - ".rubocop_todo.yml"
305
- - ".travis.yml"
306
292
  - ".yardopts"
307
293
  - CHANGELOG.md
308
294
  - Gemfile
@@ -321,6 +307,7 @@ files:
321
307
  - examples/hello-cap-add-app.jsonnet
322
308
  - examples/hello-fargate-batch.jsonnet
323
309
  - examples/hello-fargate.jsonnet
310
+ - examples/hello-grpc.jsonnet
324
311
  - examples/hello-internal-nlb.jsonnet
325
312
  - examples/hello-lb-v2.jsonnet
326
313
  - examples/hello-lb.jsonnet
@@ -382,7 +369,7 @@ homepage: https://github.com/eagletmt/hako
382
369
  licenses:
383
370
  - MIT
384
371
  metadata: {}
385
- post_install_message:
372
+ post_install_message:
386
373
  rdoc_options: []
387
374
  require_paths:
388
375
  - lib
@@ -390,15 +377,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
390
377
  requirements:
391
378
  - - ">="
392
379
  - !ruby/object:Gem::Version
393
- version: 2.3.0
380
+ version: 2.5.0
394
381
  required_rubygems_version: !ruby/object:Gem::Requirement
395
382
  requirements:
396
383
  - - ">="
397
384
  - !ruby/object:Gem::Version
398
385
  version: '0'
399
386
  requirements: []
400
- rubygems_version: 3.0.3
401
- signing_key:
387
+ rubygems_version: 3.2.21
388
+ signing_key:
402
389
  specification_version: 4
403
390
  summary: Deploy Docker container
404
391
  test_files: []
data/.travis.yml DELETED
@@ -1,14 +0,0 @@
1
- language: ruby
2
- sudo: false
3
- rvm:
4
- - 2.3.8
5
- - 2.4.6
6
- - 2.5.5
7
- - 2.6.3
8
- - ruby-head
9
- before_install:
10
- - gem update --system # https://github.com/rubygems/rubygems/pull/1819
11
- - gem install bundler
12
- matrix:
13
- allow_failures:
14
- - rvm: ruby-head