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 fault-injection capability #4325

Merged
merged 4 commits into from
Sep 11, 2024
Merged

Add fault-injection capability #4325

merged 4 commits into from
Sep 11, 2024

Conversation

harishxr
Copy link
Contributor

@harishxr harishxr commented Sep 9, 2024

Summary

Added support to advertise fault injection capability (ecs.capability.fault-injection) to ecs agent when the required network packages are present on the host.

Implementation details

  • Updated agent capabilities to include the fault inject capability.
  • Added checkNetworkTooling() to check if the required network packages are available on the host for the capability to be advertised.
  • Adjusted unit tests to verify fault injection capability based on available network tooling.

Testing

  • Added unit tests to ensure capability is enabled only when network tooling packages are available.
  • Installed iproute-tc and iptables package on the host and ran aws ecs describe-container-instances --cluster <cluster-name> --container-instances <instance-id>
{
                    "name": "ecs.capability.fault-injection"
                },
  • The ecs.capability.fault-injection is enabled when the required packages are present on the host.
  • If required packages are not present, following message is found in ecs.agent.log
level=warn time=2024-09-09T21:17:08Z msg="Fault injection capability not enabled: Required network tools (iptables, tc) are missing" module=agent_capability.go

New tests cover the changes: yes

Description for the changelog

  • Added fault injection capability to ECS Agent.

Additional Information

Does this PR include breaking model changes? If so, Have you added transformation functions?

Does this PR include the addition of new environment variables in the README?

Licensing

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

@harishxr harishxr requested a review from a team as a code owner September 9, 2024 21:28
agent/app/agent_capability_unix.go Outdated Show resolved Hide resolved
agent/app/agent_capability_unix.go Show resolved Hide resolved
agent/app/agent_capability_test.go Outdated Show resolved Hide resolved
agent/app/agent_capability_test.go Outdated Show resolved Hide resolved
@@ -236,3 +237,19 @@ func (agent *ecsAgent) getTaskENIPluginVersionAttribute() (*ecs.Attribute, error
func defaultIsPlatformExecSupported() (bool, error) {
return true, nil
}

// var to allow mocking for checkNetworkTooling
var isNetworkToolingAvailable = checkNetworkTooling
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You'll probably need to implement a no-op/dummy function for non-linux as well.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Implemented in 1a3ea5b

@harishxr harishxr merged commit 8e3ac0a into aws:dev Sep 11, 2024
40 checks passed
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.

4 participants