-
Notifications
You must be signed in to change notification settings - Fork 632
Fault Injection - Multi-ENI detection for host mode tasks & IPv6-only task detection for all tasks #4670
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
Conversation
…ple default interfaces in host mode and update IPv6-only task identification
@@ -21,6 +21,7 @@ import ( | |||
"github.com/aws/amazon-ecs-agent/ecs-agent/logger" | |||
"github.com/aws/amazon-ecs-agent/ecs-agent/logger/field" | |||
tmdsv4 "github.com/aws/amazon-ecs-agent/ecs-agent/tmds/handlers/v4/state" | |||
"github.com/pkg/errors" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: could better format the imports here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right.. let me do this as a follow-up.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://github.com/daixiang0/gci can help you regroup imports which can be integrated into the repo if needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressed in #4671
} else { | ||
taskNetworkConfig = tmdsv4.NewTaskNetworkConfig(task.GetNetworkMode(), task.GetNetworkNamespace(), task.GetDefaultIfname()) | ||
// For bridge mode there is no concept of task network interfaces in ECS |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also true for "none" network mode as well
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right.. let me do this as a follow-up.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressed in #4671
@@ -21,6 +21,7 @@ import ( | |||
"github.com/aws/amazon-ecs-agent/ecs-agent/logger" | |||
"github.com/aws/amazon-ecs-agent/ecs-agent/logger/field" | |||
tmdsv4 "github.com/aws/amazon-ecs-agent/ecs-agent/tmds/handlers/v4/state" | |||
"github.com/pkg/errors" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://github.com/daixiang0/gci can help you regroup imports which can be integrated into the repo if needed.
…ple default interfaces in host mode and update IPv6-only task identification (aws#4670)
Summary
This PR modifies the behavior of the
GetTaskMetadataWithTaskNetworkConfig
method ofTMDSAgentState
implementation to:The definition of IPv6-only tasks in the context of Fault Injection handlers has been updated accordingly. The new definition states that an IPv6-only task has a single network interface with no IPv4 addresses and at least one IPv6 address. This updated definition correctly identifies host mode tasks with separate default network interfaces for IPv4 and IPv6 as not IPv6-only. The
isIPv6OnlyTask
function has been updated to reflect this change.Implementation details
TMDSAgentState.getTaskMetadata
method that's responsible for populating task network configuration for all tasks on all platforms is updated so that it populates IP addresses for awsvpc tasks.TMDSAgentState.GetTaskMetadataWithTaskNetworkConfig
method for Linux specifically is updated so that for host mode tasks it looks up default network interfaces for IPv4 and IPv6 using theGetDefaultNetworkInterfaces
utility function that was introduced in Net utils for finding default network interfaces #4665.isIPv6OnlyTask
function inecs-agent/tmds/handlers/fault/v1/handlers/handlers.go
is updated as per the new definition mentioned above.Testing
Launched two instances, one IPv6-only and another one with two ENIs - IPv4-only and IPv6-only (we will call this v4v6 instance). On both instances I temporarily renamed
ip6tables
utility so that it is not found by Agent.On v4v6 instance, verified that start blackhole port fault request do not fail but the fault is not injected for IPv6 traffic.
On the IPv6-only instance this causes an internal server error.
Logs on IPv6-only instance -
New tests cover the changes: yes
Description for the changelog
enhancement: [TMDS Fault Injection] Improve network interface detection to handle multiple default interfaces in host mode and update IPv6-only task identification
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.