forked from aws/aws-cdk
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ecs-patterns): refactor fargate interfaces and add support for r…
…untimePlatform (aws#21529) Stemming from aws#20756, currently there are a lot of duplicated Fargate props throughout the library ie `cpu`, `memory`. This can make adding Fargate properties tedious as you have to add them into every Fargate type. This PR introduces `FargateServiceBaseProps` which will hold all of the common Fargate properties and allows all Fargate variations to inherit from. As an example, I have added in `runtimePlatform` to all Fargate services. I still need to make a small README update, but want to get this pushed up for thoughts/suggestions/feedback. closes aws#20756 aws#18462 ---- ### All Submissions: * [x ] Have you followed the guidelines in our [Contributing guide?](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) ### Adding new Unconventional Dependencies: * [ ] This PR adds new unconventional dependencies following the process described [here](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md/#adding-new-unconventional-dependencies) ### New Features * [x] Have you added the new feature to an [integration test](https://github.com/aws/aws-cdk/blob/main/INTEGRATION_TESTS.md)? * [x] Did you use `yarn integ` to deploy the infrastructure and generate the snapshot (i.e. `yarn integ` without `--dry-run`)? *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
- Loading branch information
1 parent
09116dc
commit 7722816
Showing
19 changed files
with
1,866 additions
and
357 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
74 changes: 74 additions & 0 deletions
74
packages/@aws-cdk/aws-ecs-patterns/lib/base/fargate-service-base.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
import { FargatePlatformVersion, FargateTaskDefinition, RuntimePlatform } from '@aws-cdk/aws-ecs'; | ||
|
||
|
||
export interface FargateServiceBaseProps { | ||
/** | ||
* The task definition to use for tasks in the service. TaskDefinition or TaskImageOptions must be specified, but not both. | ||
* | ||
* [disable-awslint:ref-via-interface] | ||
* | ||
* @default - none | ||
*/ | ||
readonly taskDefinition?: FargateTaskDefinition; | ||
|
||
/** | ||
* The number of cpu units used by the task. | ||
* | ||
* Valid values, which determines your range of valid values for the memory parameter: | ||
* | ||
* 256 (.25 vCPU) - Available memory values: 0.5GB, 1GB, 2GB | ||
* | ||
* 512 (.5 vCPU) - Available memory values: 1GB, 2GB, 3GB, 4GB | ||
* | ||
* 1024 (1 vCPU) - Available memory values: 2GB, 3GB, 4GB, 5GB, 6GB, 7GB, 8GB | ||
* | ||
* 2048 (2 vCPU) - Available memory values: Between 4GB and 16GB in 1GB increments | ||
* | ||
* 4096 (4 vCPU) - Available memory values: Between 8GB and 30GB in 1GB increments | ||
* | ||
* This default is set in the underlying FargateTaskDefinition construct. | ||
* | ||
* @default 256 | ||
*/ | ||
readonly cpu?: number; | ||
|
||
/** | ||
* The amount (in MiB) of memory used by the task. | ||
* | ||
* This field is required and you must use one of the following values, which determines your range of valid values | ||
* for the cpu parameter: | ||
* | ||
* 512 (0.5 GB), 1024 (1 GB), 2048 (2 GB) - Available cpu values: 256 (.25 vCPU) | ||
* | ||
* 1024 (1 GB), 2048 (2 GB), 3072 (3 GB), 4096 (4 GB) - Available cpu values: 512 (.5 vCPU) | ||
* | ||
* 2048 (2 GB), 3072 (3 GB), 4096 (4 GB), 5120 (5 GB), 6144 (6 GB), 7168 (7 GB), 8192 (8 GB) - Available cpu values: 1024 (1 vCPU) | ||
* | ||
* Between 4096 (4 GB) and 16384 (16 GB) in increments of 1024 (1 GB) - Available cpu values: 2048 (2 vCPU) | ||
* | ||
* Between 8192 (8 GB) and 30720 (30 GB) in increments of 1024 (1 GB) - Available cpu values: 4096 (4 vCPU) | ||
* | ||
* This default is set in the underlying FargateTaskDefinition construct. | ||
* | ||
* @default 512 | ||
*/ | ||
readonly memoryLimitMiB?: number; | ||
|
||
/** | ||
* The platform version on which to run your service. | ||
* | ||
* If one is not specified, the LATEST platform version is used by default. For more information, see | ||
* [AWS Fargate Platform Versions](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/platform_versions.html) | ||
* in the Amazon Elastic Container Service Developer Guide. | ||
* | ||
* @default Latest | ||
*/ | ||
readonly platformVersion?: FargatePlatformVersion; | ||
|
||
/** | ||
* The runtime platform of the task definition | ||
* | ||
* @default - If the property is undefined, `operatingSystemFamily` is LINUX and `cpuArchitecture` is X86_64 | ||
*/ | ||
readonly runtimePlatform?: RuntimePlatform; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.