Skip to content

Support FireLens configuration #93

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions lib/hako/container.rb
Original file line number Diff line number Diff line change
@@ -222,6 +222,17 @@ def repository_credentials
end
end

# @return [Hash, nil]
def firelens_configuration
if @definition.key?('firelens_configuration')
conf = @definition['firelens_configuration']
{
type: conf.fetch('type'),
options: conf.fetch('options', nil),
}
end
end

private

PROVIDERS_KEY = '$providers'
10 changes: 9 additions & 1 deletion lib/hako/schedulers/ecs.rb
Original file line number Diff line number Diff line change
@@ -674,6 +674,13 @@ def describe_task_definition(family)
# @return [Hash]
def create_definition(name, container)
environment = container.env.map { |k, v| { name: k, value: v } }
user = container.user
# Set user to '0' for a FireLens container if not specified, otherwise
# there will be a perpetual diff between an actual task definition and a
# desired one because AWS sets user to '0' on a FireLens container. If a
# user other than root is specified on a FireLens container,
# registration of a task definition fails.
user ||= '0' if container.firelens_configuration
{
name: name,
image: container.image_tag,
@@ -693,7 +700,7 @@ def create_definition(name, container)
linux_parameters: container.linux_parameters,
depends_on: container.depends_on,
volumes_from: container.volumes_from,
user: container.user,
user: user,
log_configuration: container.log_configuration,
health_check: container.health_check,
ulimits: container.ulimits,
@@ -702,6 +709,7 @@ def create_definition(name, container)
docker_security_options: container.docker_security_options,
system_controls: container.system_controls,
repository_credentials: container.repository_credentials,
firelens_configuration: container.firelens_configuration,
}
end

8 changes: 8 additions & 0 deletions lib/hako/schedulers/ecs_definition_comparator.rb
Original file line number Diff line number Diff line change
@@ -47,6 +47,7 @@ def definition_schema
struct.member(:docker_security_options, Schema::Nullable.new(Schema::UnorderedArray.new(Schema::String.new)))
struct.member(:system_controls, Schema::Nullable.new(system_controls_schema))
struct.member(:repository_credentials, Schema::Nullable.new(repository_credentials_schema))
struct.member(:firelens_configuration, Schema::Nullable.new(firelens_configuration_schema))
end
end

@@ -189,6 +190,13 @@ def repository_credentials_schema
struct.member(:credentials_parameter, Schema::String.new)
end
end

def firelens_configuration_schema
Schema::Structure.new.tap do |struct|
struct.member(:type, Schema::String.new)
struct.member(:options, Schema::Nullable.new(Schema::Table.new(Schema::String.new, Schema::String.new)))
end
end
end
end
end
1 change: 1 addition & 0 deletions spec/hako/schedulers/ecs_spec.rb
Original file line number Diff line number Diff line change
@@ -91,6 +91,7 @@
docker_security_options: nil,
system_controls: nil,
repository_credentials: nil,
firelens_configuration: nil,
}],
volumes: [],
requires_compatibilities: nil,