Skip to content

Commit

Permalink
Add an example of ECS canary for Service Discovery (pipe-cd#4691)
Browse files Browse the repository at this point in the history
Signed-off-by: t-kikuc <[email protected]>
Signed-off-by: 鈴木 優耀 <[email protected]>
  • Loading branch information
t-kikuc authored and 鈴木 優耀 committed Feb 12, 2024
1 parent 18d89ef commit 42b6173
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 0 deletions.
31 changes: 31 additions & 0 deletions examples/ecs/servicediscovery/canary/app.pipecd.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
apiVersion: pipecd.dev/v1beta1
kind: ECSApp
spec:
name: servicediscovery-canary
labels:
env: example
team: xyz
input:
serviceDefinitionFile: servicedef.yaml
taskDefinitionFile: taskdef.yaml
# When you use ECS Service Discovery for interservice networking, you must specify 'SERVICE_DISCOVERY' for 'accessType'.
accessType: SERVICE_DISCOVERY
# 'targetGroups' is not used in Service Discovery type.
pipeline:
stages:
# Rollout CANARY variant's workload.
# scale represents the percentage of workload will be rolled out,
# in this case 30% of the current PRIMARY variant's workload is set.
# Note: Rolled out variant DOES serve traffic at this time unlike the ELB type.
- name: ECS_CANARY_ROLLOUT
with:
scale: 100
# Hold the deployment process for 150 seconds.
- name: WAIT
with:
duration: 150s
# Update the workload of PRIMARY variant to the new version.
# NOTE: The new PRIMARY variant will serve 100% of the traffic at this time.
- name: ECS_PRIMARY_ROLLOUT
# Destroy all workloads of CANARY variant.
- name: ECS_CANARY_CLEAN
26 changes: 26 additions & 0 deletions examples/ecs/servicediscovery/canary/servicedef.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
cluster: arn:aws:ecs:ap-northeast-1:XXXX:cluster/test-cluster
serviceName: nginx-canary-service
desiredCount: 2
deploymentConfiguration:
maximumPercent: 200
minimumHealthyPercent: 0
schedulingStrategy: REPLICA
# CAUTION: To enable PipeCD controls the deployment
# DeploymentController of type EXTERNAL is required.
deploymentController:
type: EXTERNAL
enableECSManagedTags: true
propagateTags: SERVICE
launchType: FARGATE
networkConfiguration:
awsvpcConfiguration:
assignPublicIp: ENABLED
securityGroups:
- sg-YYYY
subnets:
- subnet-YYYY
- subnet-YYYY
# Service Discovery Config.
serviceRegistries:
# You need to specify the service id of the service discovery namespace.
- registryArn: arn:aws:servicediscovery:ap-northeast-1:XXXX:service/srv-XXXXX
20 changes: 20 additions & 0 deletions examples/ecs/servicediscovery/canary/taskdef.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
family: nginx-service-fam
executionRoleArn: arn:aws:iam::XXXX:role/ecsTaskExecutionRole
containerDefinitions:
- command: null
cpu: 100
image: XXXX.dkr.ecr.ap-northeast-1.amazonaws.com/nginx:1
memory: 100
mountPoints: []
name: web
portMappings:
- containerPort: 80
compatibilities:
- FARGATE
requiresCompatibilities:
- FARGATE
networkMode: awsvpc
memory: 512
cpu: 256
pidMode: ""
volumes: []

0 comments on commit 42b6173

Please sign in to comment.