Repository navigation
Use static IP for daemon tasks. - #4881
Merged
Merged
Conversation
JoseVillalta
previously approved these changes
Feb 24, 2026
aaithal
reviewed
Feb 24, 2026
aaithal
previously approved these changes
Feb 24, 2026
aviral92
force-pushed
the
daemonIP2
branch
3 times, most recently
from
February 25, 2026 22:04
a4b3be8 to
10f535b
Compare
- Always block IMDS access for daemon-bridge tasks - Follows same pattern as awsvpc on managed instances - Uses blackhole route (netlink RouteAdd with RTN_BLACKHOLE) - Blocks access to both IPv4 (169.254.169.254) and IPv6 (fd00:ec2::254) IMDS endpoints - Executes inside daemon namespace using ExecInNSPath - Add comprehensive unit tests for IMDS blocking functionality
aaithal
approved these changes
Feb 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Related bridge plugin PR(this needs to be merged first) - aws/amazon-ecs-cni-plugins#120
ECS agent now tells the IPAM plugin assign 169.254.172.2 to this daemon container instead of pick any available IP from the subnet. ALso, Implements IMDS (Instance Metadata Service) blocking for daemon-bridge network mode tasks by integrating the functionality into the bridge CNI plugin, following the same pattern as the vpc-branch-eni plugin.
Implementation details
Overview
This PR enables daemon tasks to use a static IP address (169.254.172.2) and adds support for connected subnet routes in awsvpc tasks to enable direct communication between replica and daemon tasks via the bridge network.
Key Changes
1. Static IP Assignment for Daemon Tasks
2. Connected Subnet Route Support
3. Daemon Namespace Detection
4. Block IMDS on Daemon-bridge tasks similar to awsvpc tasks which already block IMDS via the vpc-branch-eni plugin.
ECS Agent Changes:
Bridge CNI Plugin Changes:
Testing
Testing
UTs and build an AMI with the ecs-bridge changes for E2E testing.
New tests cover the changes: Yes.
Description for the changelog
Use static IP for daemon tasks.
Additional Information
Does this PR include breaking model changes? If so, Have you added transformation functions?
No.
Does this PR include the addition of new environment variables in the README?
No.
Licensing
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
Apendix :
How the IPAM Plugin Works
The IPAM (IP Address Management) plugin has two modes:
Static IP Mode (NEW - what this commit enables):
if assignedAddress.IP != nil {
// IP was specified in configuration, try to assign this ip as used
err := ipManager.Assign(assignedAddress.IP.String(), conf.ID)
}
Dynamic IP Mode (OLD - before this commit):
else {
// Get the next ip from db based on the last used ip
nextIP, err := getIPV4AddressFromDB(ipManager, conf)
assignedAddress.IP = net.ParseIP(nextIP)
}
Why Environment Variables Were Added
The environment variables tell the IPAM plugin where to store its state:
m.common.os.Setenv(IPAMDataPathEnv, filepath.Join(m.common.stateDBDir, IPAMDataFileName))
// Sets: IPAM_DB_PATH=/var/lib/ecs/data/eni-ipam.db
Purpose: