hako 0.24.0 → 0.25.0

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
  SHA1:
3
- metadata.gz: ef29ede6ffaf4f044b5b8af2d45e0d737faacd9b
4
- data.tar.gz: ac44a0612a7188db235ea9dffd9c8e54f93616f2
3
+ metadata.gz: 0a353a740fe7ea58839d67b5f2489883756b8120
4
+ data.tar.gz: 1b0784408a192b881706fb297cc61235a9012e00
5
5
  SHA512:
6
- metadata.gz: e4ddcc37c95d87a0620240b00ebb90822c1f2115233aaf24b3afc929fb07f0e3e9868b64f8e5f241e44ba888ef6954e52fef20ba0f15ce4daa18ee47f1b28234
7
- data.tar.gz: 5f11ebc2a746ea818cdb5fb8899ecd53ffaef6913b8acf3e95e2b215b96e841425a66fc7638ac8e3651b1f149000dd6540bf5f28e168c590ac5322df9c47939d
6
+ metadata.gz: 2eb101b2de3a386269b23363542241fc7a675848147c2c2e121e49cd4b04b9e91c72a0838273237e44fb0aa7ec8d8da7faf55b9ec5104cbb902547cbad4f3791
7
+ data.tar.gz: 13e7e80290763e4a2a2f3855816f26716061c39e19ec5e93fe5816eca90748a6ff9efeab8fbbac96108ed9983389f1b7db8c656dca94da14f64a509304116f95
@@ -19,7 +19,7 @@ Gem::Specification.new do |spec|
19
19
  spec.require_paths = ['lib']
20
20
  spec.required_ruby_version = '>= 2.3.0'
21
21
 
22
- spec.add_dependency 'aws-sdk', '>= 2.3.22'
22
+ spec.add_dependency 'aws-sdk', '>= 2.6.43'
23
23
 
24
24
  spec.add_development_dependency 'bundler'
25
25
  spec.add_development_dependency 'rake'
@@ -41,6 +41,8 @@ module Hako
41
41
  %i[maximum_percent minimum_healthy_percent].each do |key|
42
42
  @deployment_configuration[key] = options.dig('deployment_configuration', key.to_s)
43
43
  end
44
+ @placement_constraints = options.fetch('placement_constraints', [])
45
+ @placement_strategy = options.fetch('placement_strategy', [])
44
46
 
45
47
  @started_at = nil
46
48
  @container_instance_arn = nil
@@ -597,6 +599,7 @@ module Hako
597
599
  # Keep current desired_count if autoscaling is enabled
598
600
  params[:desired_count] = current_service.desired_count
599
601
  end
602
+ warn_placement_policy_change(current_service)
600
603
  if service_changed?(current_service, params)
601
604
  ecs_client.update_service(params).service
602
605
  else
@@ -615,6 +618,8 @@ module Hako
615
618
  desired_count: 0,
616
619
  role: @role,
617
620
  deployment_configuration: @deployment_configuration,
621
+ placement_constraints: @placement_constraints,
622
+ placement_strategy: @placement_strategy,
618
623
  }
619
624
  if ecs_elb_client.find_or_create_load_balancer(front_port)
620
625
  ecs_elb_client.modify_attributes
@@ -815,6 +820,32 @@ module Hako
815
820
  puts cmd.join(' ')
816
821
  nil
817
822
  end
823
+
824
+ # @param [Aws::ECS::Types::Service] service
825
+ # @return [nil]
826
+ def warn_placement_policy_change(service)
827
+ placement_constraints = service.placement_constraints.map do |c|
828
+ h = { 'type' => c.type }
829
+ unless c.expression.nil?
830
+ h['expression'] = c.expression
831
+ end
832
+ h
833
+ end
834
+ if @placement_constraints != placement_constraints
835
+ Hako.logger.warn "Ignoring updated placement_constraints in the configuration, because AWS doesn't allow updating them for now."
836
+ end
837
+
838
+ placement_strategy = service.placement_strategy.map do |s|
839
+ h = { 'type' => s.type }
840
+ unless s.field.nil?
841
+ h['field'] = s.field.downcase
842
+ end
843
+ h
844
+ end
845
+ if @placement_strategy != placement_strategy
846
+ Hako.logger.warn "Ignoring updated placement_strategy in the configuration, because AWS doesn't allow updating them for now."
847
+ end
848
+ end
818
849
  end
819
850
  end
820
851
  end
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module Hako
3
- VERSION = '0.24.0'
3
+ VERSION = '0.25.0'
4
4
  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: 0.24.0
4
+ version: 0.25.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: 2017-02-16 00:00:00.000000000 Z
11
+ date: 2017-02-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 2.3.22
19
+ version: 2.6.43
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: 2.3.22
26
+ version: 2.6.43
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement