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 for setting PIDs limit for ECS tasks #3790

Merged
merged 1 commit into from
Jul 11, 2023

Conversation

sparrc
Copy link
Contributor

@sparrc sparrc commented Jul 7, 2023

Summary

Adds a new agent configuration variable: ECS_TASK_PIDS_LIMIT

This variable defaults to being unset, which results in the current behavior of no PID limit being set at the task level.

If the user sets this to a value 1 or more, then agent will set the pids.max pid limit cgroup parameter to the provided value, for the task-level cgroup for all ECS tasks that are launched on this container instance. Note that this limit is applied for the whole task, not per-container.

addresses aws/containers-roadmap#354 for the EC2 launch type.

Implementation details

Testing

Functionality was verified manually and unit tests were added in this PR. Functional tests will be added before merging to dev branch.

New tests cover the changes: yes

Description for the changelog

Enhancement: ECS_TASK_PIDS_LIMIT for setting the task-level PIDs limit.

Licensing

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

@@ -363,9 +363,10 @@ func (task *Task) PostUnmarshalTask(cfg *config.Config,

task.adjustForPlatform(cfg)

// TODO, add rudimentary plugin support and call any plugins that want to
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this TODO was 8 years old....probably time to remove

@@ -1,3 +1,6 @@
//go:build unit
Copy link
Contributor Author

Choose a reason for hiding this comment

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

unrelated to this change, but these tests were not running without this tag

assert.Equal(t, 0, parseTaskPidsLimit())
}

func TestParseContainerInstanceTags(t *testing.T) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this test is unrelated to this change, but am going to add a bunch of unrelated unit tests for the parse.go function that didnt previously exist

fierlion
fierlion previously approved these changes Jul 10, 2023
agent/config/parse.go Outdated Show resolved Hide resolved
@Realmonia
Copy link
Contributor

Do we need to update https://github.com/aws/amazon-ecs-agent/blob/dev/agent/config/parse_unsupported.go too?

@sparrc sparrc merged commit c0ff233 into aws:feature/task-pids-limit Jul 11, 2023
6 checks passed
Copy link
Member

@fierlion fierlion left a comment

Choose a reason for hiding this comment

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

(comment resolved)

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