Set default CPU limit as 2 and show in TMDEv2/v3/v4 task metadata #2783
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
This PR sets default CPU limit from 0 to
2
if Null, zero, and CPU values of 1 is assigned to a container in a task definition.Cases and the corresponding Task metadata endpoint (TMDE) task response are listed as followed:
Null or 0 or 1
for a container in the task definition -> TMDEv2/v3/v4 task metadata shows the container with CPU limit as2
>= 2
for a container in the task definition -> TMDEv2/v3/v4 task metadata shows the container with CPU limit defined in the task definitionReference of CPU limit can be found here
Implementation details
minimumCPUUnit
anddefaultCPU
as2
container.CPU
in ContainerResponse if it is less than minimumCPUUnitTesting
New tests cover the changes: no
Manual tests
Run a task definition with 5 containers with different CPU limits as follows:
All containers have Memory limit 50.
Task metadata from TMDEv3
curl ${ECS_CONTAINER_METADATA_URI}/task
Task metadata from TMDEv4
curl ${ECS_CONTAINER_METADATA_URI_V4}/task
Description for the changelog
Bug - Fixed the number of cpu units the Agent will reserve for the Linux container instances.
Licensing
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.