hako 2.13.0 → 2.14.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/lib/hako/container.rb +9 -0
- data/lib/hako/schedulers/ecs.rb +22 -4
- data/lib/hako/schedulers/ecs_definition_comparator.rb +7 -0
- data/lib/hako/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7ef02b44439fedefe65ec80e5af6d296bc735817dc271b9129b96abb8448ee6e
|
4
|
+
data.tar.gz: 382a1d4dc73953bd345a66e8c79ce1733fb1c7a926d9306feda1673bd1cd933d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a253c0e8147b6c00372ee07376397a29b2f8df83abeaafed018a352a99261ac3f161cee579225e314d3a01dd6582216ba31c5b5f773fb5485ab112a5420d78fb
|
7
|
+
data.tar.gz: 17cc31d59e1e53819eb1c47f8c78159d7a86c5bef6fc7e970a9d133fc4852afa02094c3ea4607dea8bd29b347691ab19ec45ff4cd26a1ba06cc33e69df934034
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
# 2.14.0 (2020-05-20)
|
2
|
+
## New features
|
3
|
+
- Support tags for task definition and propagate them to ECS tasks
|
4
|
+
- Now all created ECS services and launched ECS tasks have `propagate_tags=TASK_DEFINITION` parameter.
|
5
|
+
- Support repository_credentials
|
6
|
+
|
1
7
|
# 2.13.0 (2020-01-10)
|
2
8
|
## New features
|
3
9
|
- Support capacity provider strategy
|
data/lib/hako/container.rb
CHANGED
@@ -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'
|
data/lib/hako/schedulers/ecs.rb
CHANGED
@@ -100,6 +100,7 @@ module Hako
|
|
100
100
|
if options['service_discovery']
|
101
101
|
@service_discovery = EcsServiceDiscovery.new(options.fetch('service_discovery'), @region, dry_run: @dry_run)
|
102
102
|
end
|
103
|
+
@tags = options.fetch('tags', {}).map { |k, v| { key: k, value: v.to_s } }
|
103
104
|
|
104
105
|
@started_at = nil
|
105
106
|
@container_instance_arn = nil
|
@@ -464,8 +465,9 @@ module Hako
|
|
464
465
|
|
465
466
|
# @param [Array<Hash>] desired_definitions
|
466
467
|
# @param [Aws::ECS::Types::TaskDefinition] actual_definition
|
467
|
-
# @
|
468
|
-
|
468
|
+
# @param [Array<Aws::ECS::Types::Tag>] actual_tags
|
469
|
+
# @return [Array<Boolean>]
|
470
|
+
def task_definition_changed?(desired_definitions, actual_definition, actual_tags)
|
469
471
|
if @force
|
470
472
|
return true
|
471
473
|
end
|
@@ -513,6 +515,11 @@ module Hako
|
|
513
515
|
if actual_definition.requires_compatibilities != @requires_compatibilities
|
514
516
|
return true
|
515
517
|
end
|
518
|
+
actual_tags_set = Set.new(actual_tags.map { |t| {key: t.key, value: t.value } })
|
519
|
+
tags_set = Set.new(@tags)
|
520
|
+
if actual_tags_set != tags_set
|
521
|
+
return true
|
522
|
+
end
|
516
523
|
|
517
524
|
false
|
518
525
|
end
|
@@ -535,7 +542,10 @@ module Hako
|
|
535
542
|
# @return [Array<Boolean, Aws::ECS::Types::TaskDefinition>]
|
536
543
|
def register_task_definition(definitions)
|
537
544
|
current_task_definition = describe_task_definition(@app_id)
|
538
|
-
if
|
545
|
+
if current_task_definition
|
546
|
+
current_tags = ecs_client.list_tags_for_resource(resource_arn: current_task_definition.task_definition_arn).tags
|
547
|
+
end
|
548
|
+
if task_definition_changed?(definitions, current_task_definition, current_tags)
|
539
549
|
new_task_definition = ecs_client.register_task_definition(
|
540
550
|
family: @app_id,
|
541
551
|
task_role_arn: @task_role_arn,
|
@@ -546,6 +556,7 @@ module Hako
|
|
546
556
|
requires_compatibilities: @requires_compatibilities,
|
547
557
|
cpu: @cpu,
|
548
558
|
memory: @memory,
|
559
|
+
tags: @tags.empty? ? nil : @tags,
|
549
560
|
).task_definition
|
550
561
|
[true, new_task_definition]
|
551
562
|
else
|
@@ -568,7 +579,10 @@ module Hako
|
|
568
579
|
begin
|
569
580
|
family = "#{@app_id}-oneshot"
|
570
581
|
current_task_definition = describe_task_definition(family)
|
571
|
-
if
|
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)
|
572
586
|
new_task_definition = ecs_client.register_task_definition(
|
573
587
|
family: family,
|
574
588
|
task_role_arn: @task_role_arn,
|
@@ -579,6 +593,7 @@ module Hako
|
|
579
593
|
requires_compatibilities: @requires_compatibilities,
|
580
594
|
cpu: @cpu,
|
581
595
|
memory: @memory,
|
596
|
+
tags: @tags.empty? ? nil : @tags,
|
582
597
|
).task_definition
|
583
598
|
return [true, new_task_definition]
|
584
599
|
else
|
@@ -662,6 +677,7 @@ module Hako
|
|
662
677
|
readonly_root_filesystem: container.readonly_root_filesystem,
|
663
678
|
docker_security_options: container.docker_security_options,
|
664
679
|
system_controls: container.system_controls,
|
680
|
+
repository_credentials: container.repository_credentials,
|
665
681
|
}
|
666
682
|
end
|
667
683
|
|
@@ -682,6 +698,7 @@ module Hako
|
|
682
698
|
capacity_provider_strategy: @capacity_provider_strategy,
|
683
699
|
platform_version: @platform_version,
|
684
700
|
network_configuration: @network_configuration,
|
701
|
+
propagate_tags: 'TASK_DEFINITION',
|
685
702
|
)
|
686
703
|
result.failures.each do |failure|
|
687
704
|
Hako.logger.error("#{failure.arn} #{failure.reason}")
|
@@ -924,6 +941,7 @@ module Hako
|
|
924
941
|
platform_version: @platform_version,
|
925
942
|
network_configuration: @network_configuration,
|
926
943
|
health_check_grace_period_seconds: @health_check_grace_period_seconds,
|
944
|
+
propagate_tags: 'TASK_DEFINITION',
|
927
945
|
}
|
928
946
|
if @scheduling_strategy != 'DAEMON'
|
929
947
|
params[:desired_count] = 0
|
@@ -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
|
data/lib/hako/version.rb
CHANGED
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.
|
4
|
+
version: 2.14.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: 2020-
|
11
|
+
date: 2020-05-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk-applicationautoscaling
|