Skip to content
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

Add ecs-agent container healthcheck localhost ip override env var #2834

Merged
merged 1 commit into from
Mar 19, 2021

Conversation

fierlion
Copy link
Member

@fierlion fierlion commented Mar 18, 2021

Summary

This change allows IP configuration for the ecs-agent container's docker healthcheck localhost IP to address a specific case where the customer has overridden the localhost ip explicitly.

Implementation details

Currently, as the agent container is launched in host network mode, when the localhost inside the scratch-based agent container does not resolve to that the same IP, the agent container healthcheck will always return 'unhealthy'.
This change allows the localhost IP to be explicitly set to either the host localhost ip (usually 127.0.0.1) or otherwise based on DNS resolution requirements.

Testing

I built the agent and tested the following manually:
start agent the environment variable unset -- agent container became healthy
set ECS_AGENT_HEALTHCHECK_HOST=localhost -- agent container became healthy
set ECS_AGENT_HEALTHCHECK_HOST=127.0.0.1 -- agent container became healthy
set ECS_AGENT_HEALTHCHECK_HOST=80.80.80.80 -- agent container became unhealthy.

New tests cover the changes: no

Description for the changelog

Add configurable agent healthcheck localhost ip env var.

Licensing

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

README.md Outdated Show resolved Hide resolved
agent/app/run.go Outdated Show resolved Hide resolved
@sparrc
Copy link
Contributor

sparrc commented Mar 18, 2021

there are some existing unit tests for the healtcheck, does it make sense to add a test or two for this? https://github.com/aws/amazon-ecs-agent/blob/90ccb1d4313eb853691465197d324cd76404b1cc/agent/app/healthcheck_test.go

@fierlion fierlion force-pushed the fierlion/healthcheck_override branch from 8df1a05 to 439923c Compare March 18, 2021 20:03
sparrc
sparrc previously approved these changes Mar 18, 2021
angelcar
angelcar previously approved these changes Mar 18, 2021
agent/app/run.go Outdated Show resolved Hide resolved
@fierlion fierlion merged commit 634bb9a into aws:dev Mar 19, 2021
@fierlion fierlion deleted the fierlion/healthcheck_override branch March 19, 2021 20:59
sparrc pushed a commit to sparrc/amazon-ecs-agent that referenced this pull request Mar 26, 2021
@shubham2892 shubham2892 added this to the 1.51.0 milestone Mar 31, 2021
fierlion added a commit to fierlion/amazon-ecs-agent that referenced this pull request Apr 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants