-
Notifications
You must be signed in to change notification settings - Fork 422
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
docs: add task def override #2763
Changes from 1 commit
8ee445a
443a9a4
61886e5
145aa77
fbe2049
ec1dfe6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,55 @@ | ||||||||||||||
# Task Definition Overrides | ||||||||||||||
If there are fields that are not configurable in the [manifest](../manifest/overview.en.md), users can bypass some of the [ECS Task Definition setting](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-taskdefinition.html) by applying override rules to the CloudFormation template Copilot generates out of the manifest. | ||||||||||||||
iamhopaul123 marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||
|
||||||||||||||
## How to specify override rules? | ||||||||||||||
For each override rule, users need to construct the **path** and **value** of the CloudFormation resource field they want to override. | ||||||||||||||
iamhopaul123 marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||
|
||||||||||||||
``` yaml | ||||||||||||||
taskdef_overrides: | ||||||||||||||
- path: <ECS Task Definition field path> | ||||||||||||||
value: <value> | ||||||||||||||
``` | ||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What do you think of this? (inspired by https://datatracker.ietf.org/doc/html/rfc6902)
Each rule is applied sequentially to the CloudFormation template. The resulting CloudFormation template becomes the target of the next rule. Evaluation continues until all rules are successfully applied or an error is encountered.
|
||||||||||||||
|
||||||||||||||
## Override Behaviors | ||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||
|
||||||||||||||
- Use `-` as index to append a new member to a `list` field | ||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we make this the last item in the list? |
||||||||||||||
|
||||||||||||||
- When applying the override rule, Copilot inserts or updates the fields along the path. More specifically, Copilot recursively inserts fields if they don't exist in the **path**. For example: if `B` and `C` don't exist, `A.B[-].C` will create `B` and `C` | ||||||||||||||
iamhopaul123 marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||
|
||||||||||||||
!!! Attention | ||||||||||||||
Users are not allowed to modify the following fields in the task definition. | ||||||||||||||
|
||||||||||||||
* [Family](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-taskdefinition.html#cfn-ecs-taskdefinition-family) | ||||||||||||||
* [ContainerDefinitions[<index>].Name](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-containerdefinitions.html#cfn-ecs-taskdefinition-containerdefinition-name) | ||||||||||||||
|
||||||||||||||
efekarakus marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||
## Examples | ||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice examples! |
||||||||||||||
|
||||||||||||||
**Add [`Ulimits`](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-containerdefinitions-ulimit.html) to the main container** | ||||||||||||||
|
||||||||||||||
``` yaml | ||||||||||||||
taskdef_overrides: | ||||||||||||||
- path: ContainerDefinitions[0].Ulimits[-] | ||||||||||||||
value: | ||||||||||||||
Name: "cpu" | ||||||||||||||
SoftLimit: 1024 | ||||||||||||||
HardLimit: 2048 | ||||||||||||||
``` | ||||||||||||||
|
||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We might want to explain a bit how this works, for example
and samesies for the other examples. |
||||||||||||||
**Expose an extra UDP port** | ||||||||||||||
|
||||||||||||||
``` yaml | ||||||||||||||
taskdef_overrides: | ||||||||||||||
- path: "ContainerDefinitions[0].PortMappings[-].ContainerPort" | ||||||||||||||
value: 2056 | ||||||||||||||
// PortMappings[1] gets the port mapping added by the previous rule, since by default Copilot creates a port mapping. | ||||||||||||||
- path: "ContainerDefinitions[0].PortMappings[1].Protocol" | ||||||||||||||
value: "udp" | ||||||||||||||
``` | ||||||||||||||
|
||||||||||||||
**Give read-only access to the root file system** | ||||||||||||||
|
||||||||||||||
``` yaml | ||||||||||||||
taskdef_overrides: | ||||||||||||||
- path: "ContainerDefinitions[0].ReadonlyRootFilesystem" | ||||||||||||||
value: true | ||||||||||||||
``` |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -241,7 +241,7 @@ Optional. The full config file path in your custom Fluent Bit image. | |||||
<div class="separator"></div> | ||||||
|
||||||
<a id="taskdef_overrides" href="#taskdef_overrides" class="field">`taskdef_overrides`</a> <span class="type">Array</span> | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: maybe
Suggested change
|
||||||
The `taskdef_overrides` section allows users to apply overriding rules to their ECS Task Definitions (see examples [here](../developing/overrides.en.md#task-definition-override)). | ||||||
The `taskdef_overrides` section allows users to apply overriding rules to their ECS Task Definitions (see examples [here](../developing/taskdef-overrides.en.md#examples)). | ||||||
|
||||||
<span class="parent-field">taskdef_overrides.</span><a id="taskdef_overrides-path" href="#taskdef_overrides-path" class="field">`path`</a> <span class="type">String</span> | ||||||
Required. Path to the Task Definition field to override. | ||||||
|
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.
let's move this to last in the list as it's an advanced feature 🙏