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

Support firelens for bridge mode ServiceConnect task #3693

Merged
merged 4 commits into from
May 23, 2023

Conversation

yinyic
Copy link
Contributor

@yinyic yinyic commented May 11, 2023

Summary

Currently, if a task is ServiceConnect-enabled, and runs in bridge network mode, then it won't be able to use awsfirelens log driver.
This PR makes awsfirelens compatible with SC-enabled, bridge mode tasks.

Implementation details

ECS Agent is responsible for injecting FLUENT_HOST environment variable to application containers. The variable contains the IP address assigned to the FireLens container. See public doc. So far, ECS Agent resolves the container IP by directly querying the container network info from docker inspect. This becomes an issue with ServiceConnect bridge mode tasks, because we are launching pause containers for each application container (for network namespace configuration). In that case, the application container will not have the expected network info, as the info is now associated with its pause container.

This PR makes changes in two places -

  1. When resolving container IP for FireLens container itself
  2. When resolving FireLens container IP for other application containers

In both cases, we now retrieve the container IP from the FireLens pause container instead, using the readily available GetBridgeModePauseContainerForTaskContainer function.

Testing

  • Added unit test for CreateContainer and StartContainer for both SC and non-SC bridge mode tasks.
  • E2E test by running a bridge task with SC enabled that also use awsfirelens log driver - verified that 1) task is able to run, and 2) application log was successfully delivered to my fluentd destination (an S3 bucket)

Description for the changelog

Support firelens for bridge mode ServiceConnect task

Licensing

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

@yinyic yinyic requested a review from a team as a code owner May 11, 2023 23:57
sparrc
sparrc previously approved these changes May 16, 2023
@yinyic yinyic changed the title [WIP]Support firelens for bridge mode ServiceConnect task Support firelens for bridge mode ServiceConnect task May 16, 2023
@yinyic yinyic merged commit ebc2c02 into aws:dev May 23, 2023
@ubhattacharjya ubhattacharjya mentioned this pull request May 24, 2023
@yinyic yinyic deleted the sc-bridge-firelens branch June 9, 2023 16:30
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.

5 participants