-
Notifications
You must be signed in to change notification settings - Fork 104
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create example for testing parallel ECS updates (#1334)
Adding an example to test parallel updates to components like ECS services. Currently component updates are serialized (#1250), but pulumi/pulumi#7629 fixed that. I used this test for verifying the changes locally, now that the change is released we can use this as a regression test
- Loading branch information
1 parent
2f165d6
commit f26ad55
Showing
7 changed files
with
166 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
name: ecs-parallel | ||
runtime: nodejs | ||
description: An ECS cluster with a Fargate service |
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,50 @@ | ||
import * as pulumi from "@pulumi/pulumi"; | ||
import * as aws from "@pulumi/aws"; | ||
import * as awsx from "@pulumi/awsx"; | ||
|
||
const image = "docker.io/memcached:1.6.28" | ||
|
||
const clusterA = new aws.ecs.Cluster("cluster-a", {}); | ||
const clusterB = new aws.ecs.Cluster("cluster-b", {}); | ||
|
||
for (let i = 0; i < 5; i++) { | ||
new awsx.ecs.FargateService(`cluster-a-service-${i}`, { | ||
cluster: clusterA.arn, | ||
assignPublicIp: true, | ||
desiredCount: 1, | ||
taskDefinitionArgs: { | ||
container: { | ||
name: `cluster-a-service-${i}`, | ||
image, | ||
cpu: 128, | ||
memory: 512, | ||
essential: true, | ||
}, | ||
}, | ||
forceNewDeployment: true, | ||
triggers: { | ||
redeployment: Date.now().toString(), | ||
} | ||
}); | ||
} | ||
|
||
for (let i = 0; i < 5; i++) { | ||
new awsx.ecs.FargateService(`cluster-b-service-${i}`, { | ||
cluster: clusterB.arn, | ||
assignPublicIp: true, | ||
desiredCount: 1, | ||
taskDefinitionArgs: { | ||
container: { | ||
name: `cluster-b-service-${i}`, | ||
image, | ||
cpu: 128, | ||
memory: 512, | ||
essential: true, | ||
}, | ||
}, | ||
forceNewDeployment: true, | ||
triggers: { | ||
redeployment: Date.now().toString(), | ||
} | ||
}); | ||
} |
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,10 @@ | ||
{ | ||
"name": "ecs-parallel", | ||
"devDependencies": { | ||
"@types/node": "^10.0.0" | ||
}, | ||
"dependencies": { | ||
"@pulumi/aws": "^6.0.4", | ||
"@pulumi/pulumi": "^3.0.0" | ||
} | ||
} |
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,50 @@ | ||
import * as pulumi from "@pulumi/pulumi"; | ||
import * as aws from "@pulumi/aws"; | ||
import * as awsx from "@pulumi/awsx"; | ||
|
||
const image = "docker.io/memcached:1.6.29" | ||
|
||
const clusterA = new aws.ecs.Cluster("cluster-a", {}); | ||
const clusterB = new aws.ecs.Cluster("cluster-b", {}); | ||
|
||
for (let i = 0; i < 5; i++) { | ||
new awsx.ecs.FargateService(`cluster-a-service-${i}`, { | ||
cluster: clusterA.arn, | ||
assignPublicIp: true, | ||
desiredCount: 1, | ||
taskDefinitionArgs: { | ||
container: { | ||
name: `cluster-a-service-${i}`, | ||
image, | ||
cpu: 128, | ||
memory: 512, | ||
essential: true, | ||
}, | ||
}, | ||
forceNewDeployment: true, | ||
triggers: { | ||
redeployment: Date.now().toString(), | ||
} | ||
}); | ||
} | ||
|
||
for (let i = 0; i < 5; i++) { | ||
new awsx.ecs.FargateService(`cluster-b-service-${i}`, { | ||
cluster: clusterB.arn, | ||
assignPublicIp: true, | ||
desiredCount: 1, | ||
taskDefinitionArgs: { | ||
container: { | ||
name: `cluster-b-service-${i}`, | ||
image, | ||
cpu: 128, | ||
memory: 512, | ||
essential: true, | ||
}, | ||
}, | ||
forceNewDeployment: true, | ||
triggers: { | ||
redeployment: Date.now().toString(), | ||
} | ||
}); | ||
} |
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,18 @@ | ||
{ | ||
"compilerOptions": { | ||
"strict": true, | ||
"outDir": "bin", | ||
"target": "es2016", | ||
"module": "commonjs", | ||
"moduleResolution": "node", | ||
"sourceMap": true, | ||
"experimentalDecorators": true, | ||
"pretty": true, | ||
"noFallthroughCasesInSwitch": true, | ||
"noImplicitReturns": true, | ||
"forceConsistentCasingInFileNames": true | ||
}, | ||
"files": [ | ||
"index.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
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