Skip to content

Commit bd16102

Browse files
authored
Updated for examples rule by template plugin (#69)
This PR was merged by Kapetanios.
1 parent e2744c5 commit bd16102

File tree

127 files changed

+2259
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

127 files changed

+2259
-0
lines changed

.pipe/analysis-template.yaml

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
apiVersion: pipecd.dev/v1beta1
2+
kind: AnalysisTemplate
3+
spec:
4+
metrics:
5+
http_error_rate:
6+
interval: 1m
7+
provider: prometheus-dev
8+
expected:
9+
max: 0
10+
query: |
11+
sum by (job) (rate(http_requests_total{status=~"5.*", job="{{ .App.Name }}"}[1m]))
12+
/
13+
sum by (job) (rate(http_requests_total{job="{{ .App.Name }}"}[1m]))
14+
15+
http_request_duration_99th_quantile:
16+
interval: 1m
17+
provider: prometheus-dev
18+
expected:
19+
max: 0.5
20+
query: |
21+
histogram_quantile(
22+
0.99,
23+
sum without (instance, job) (rate(http_request_duration_seconds_bucket{job="{{ .App.Name }}"}[1m]))
24+
)
25+
26+
container_cpu_usage_seconds_total:
27+
interval: 1m
28+
provider: prometheus-dev
29+
failureLimit: 2
30+
expected:
31+
max: 20
32+
query: |
33+
sum by (job) (
34+
rate(container_cpu_usage_seconds_total{
35+
namespace="{{ .K8s.Namespace }}",
36+
pod="{{ .App.Name }}-[0-9a-zA-Z]+(-[0-9a-zA-Z]+)"
37+
}[5m]) * 100
38+
)

.pipe/event-watcher-helm.yaml

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
apiVersion: pipecd.dev/v1beta1
2+
kind: EventWatcher
3+
spec:
4+
events:
5+
# For those who want to update the deployment config file when releasing a new Helm package.
6+
- name: helm-release
7+
replacements:
8+
- file: kubernetes/helm-remote-chart/.pipe.yaml
9+
yamlField: $.spec.input.helmChart.version

.pipe/event-watcher-k8s.yaml

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
apiVersion: pipecd.dev/v1beta1
2+
kind: EventWatcher
3+
spec:
4+
events:
5+
# For those who want to update the manifest file when a new docker image was pushed.
6+
- name: image-update
7+
replacements:
8+
- file: kubernetes/simple/deployment.yaml
9+
yamlField: $.spec.template.spec.containers[0].image
10+
# For those who want to identify Events using labels.
11+
- name: image-update
12+
labels:
13+
repoId: repo-1
14+
appName: simple
15+
replacements:
16+
- file: kubernetes/simple/deployment.yaml
17+
yamlField: $.spec.template.spec.containers[0].image

.pipe/event-watcher-using-regex.yaml

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
apiVersion: pipecd.dev/v1beta1
2+
kind: EventWatcher
3+
spec:
4+
events:
5+
# For those who want to update a file using regex
6+
- name: image-update-with-regex
7+
replacements:
8+
- file: kubernetes/simple/deployment.yaml
9+
regex: "image: gcr.io/pipecd/helloworld:(v[0-9].[0-9].[0-9])"

cloudrun/analysis/.pipe.yaml

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
apiVersion: pipecd.dev/v1beta1
2+
kind: CloudRunApp
3+
spec:
4+
pipeline:
5+
stages:
6+
# Promote new version to receive amount of traffic.
7+
- name: CLOUDRUN_PROMOTE
8+
with:
9+
percent: 10
10+
# Optional: We can also add an ANALYSIS stage to verify the new version.
11+
# If this stage finds any not good metrics of the new version,
12+
# a rollback process to the previous version will be executed.
13+
- name: ANALYSIS
14+
with:
15+
duration: 10m
16+
threshold: 2
17+
https:
18+
- url: https://canary-endpoint.pipecd.dev
19+
method: GET
20+
expected: 200
21+
interval: 1m
22+
# Promote new version to receive all traffic.
23+
- name: CLOUDRUN_PROMOTE
24+
with:
25+
percent: 100

cloudrun/analysis/service.yaml

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
apiVersion: serving.knative.dev/v1
2+
kind: Service
3+
metadata:
4+
name: analysis
5+
spec:
6+
template:
7+
metadata:
8+
annotations:
9+
autoscaling.knative.dev/maxScale: '2'
10+
spec:
11+
containerConcurrency: 80
12+
containers:
13+
- args:
14+
- server
15+
image: gcr.io/pipecd/helloworld:v0.5.0
16+
ports:
17+
- containerPort: 9085
18+
resources:
19+
limits:
20+
cpu: 1000m
21+
memory: 128Mi

cloudrun/canary/.pipe.yaml

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Deployment pipeline with canary strategy.
2+
apiVersion: pipecd.dev/v1beta1
3+
kind: CloudRunApp
4+
spec:
5+
pipeline:
6+
stages:
7+
# Promote new version to receive amount of traffic.
8+
- name: CLOUDRUN_PROMOTE
9+
with:
10+
percent: 10
11+
- name: WAIT
12+
with:
13+
duration: 30s
14+
# Promote new version to receive amount of traffic.
15+
- name: CLOUDRUN_PROMOTE
16+
with:
17+
percent: 50
18+
- name: WAIT
19+
with:
20+
duration: 30s
21+
# Promote new version to receive all traffic.
22+
- name: CLOUDRUN_PROMOTE
23+
with:
24+
percent: 100

cloudrun/canary/service.yaml

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
apiVersion: serving.knative.dev/v1
2+
kind: Service
3+
metadata:
4+
name: canary
5+
spec:
6+
template:
7+
metadata:
8+
annotations:
9+
autoscaling.knative.dev/maxScale: '2'
10+
spec:
11+
containerConcurrency: 80
12+
containers:
13+
- args:
14+
- server
15+
image: gcr.io/pipecd/helloworld:v0.5.0
16+
ports:
17+
- containerPort: 9085
18+
resources:
19+
limits:
20+
cpu: 1000m
21+
memory: 128Mi

cloudrun/secret-management/.pipe.yaml

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
apiVersion: pipecd.dev/v1beta1
2+
kind: CloudRunApp
3+
spec:
4+
encryption:
5+
encryptedSecrets:
6+
key: {ENCRYPTED_DATA_GENERATED_FROM_WEB}
7+
decryptionTargets:
8+
- service.yaml
+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
apiVersion: serving.knative.dev/v1
2+
kind: Service
3+
metadata:
4+
name: secret-management
5+
spec:
6+
template:
7+
metadata:
8+
annotations:
9+
autoscaling.knative.dev/maxScale: '2'
10+
spec:
11+
containerConcurrency: 80
12+
containers:
13+
- args:
14+
- server
15+
image: gcr.io/pipecd/helloworld:v0.5.0
16+
env:
17+
- name: KEY
18+
value: "{{ .encryptedSecrets.key }}"
19+
ports:
20+
- containerPort: 9085
21+
resources:
22+
limits:
23+
cpu: 1000m
24+
memory: 128Mi

cloudrun/simple/.pipe.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Quick sync by rolling out the new version and switching all traffic to it.
2+
apiVersion: pipecd.dev/v1beta1
3+
kind: CloudRunApp

cloudrun/simple/service.yaml

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
apiVersion: serving.knative.dev/v1
2+
kind: Service
3+
metadata:
4+
name: simple
5+
spec:
6+
template:
7+
metadata:
8+
annotations:
9+
autoscaling.knative.dev/maxScale: '2'
10+
spec:
11+
containerConcurrency: 80
12+
containers:
13+
- args:
14+
- server
15+
image: gcr.io/pipecd/helloworld:v0.5.0
16+
ports:
17+
- containerPort: 9085
18+
resources:
19+
limits:
20+
cpu: 1000m
21+
memory: 128Mi

ecs/bluegreen/.pipe.yaml

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
apiVersion: pipecd.dev/v1beta1
2+
kind: ECSApp
3+
spec:
4+
input:
5+
serviceDefinitionFile: servicedef.yaml
6+
taskDefinitionFile: taskdef.yaml
7+
targetGroups:
8+
# Primary target group is pointed by LB (ALB/NLB) live listener, the Primary task set
9+
# will be registered to this target group.
10+
primary:
11+
targetGroupArn: arn:aws:elasticloadbalancing:ap-northeast-1:XXXX:targetgroup/ecs-tg-blue/YYYY
12+
containerName: web
13+
containerPort: 80
14+
# Canary target group can also be pointed by LB (ALB/NLB) live listener at
15+
# the beginning of deployment, the Canary task set will be registered to this target group.
16+
# CAUTION: To enable PipeCD performs bluegreen deployment strategy, this canary target group
17+
# is required.
18+
canary:
19+
targetGroupArn: arn:aws:elasticloadbalancing:ap-northeast-1:XXXX:targetgroup/ecs-tg-green/ZZZZ
20+
containerName: web
21+
containerPort: 80
22+
pipeline:
23+
stages:
24+
# Rollout CANARY variant's workload.
25+
# scale represents the percentage of workload will be rolled out,
26+
# in this case 100% of the current PRIMARY variant's workload is set.
27+
# Note: Rolled out variant serves no traffic at this time.
28+
- name: ECS_CANARY_ROLLOUT
29+
with:
30+
scale: 100
31+
# Change the traffic routing state where
32+
# the CANARY workloads will receive the specified percentage of traffic.
33+
# In blue-green deployment strategy, 100% of traffic will be routed to
34+
# CANARY workloads.
35+
- name: ECS_TRAFFIC_ROUTING
36+
with:
37+
canary: 100
38+
# Hold the deployment process for 150 seconds.
39+
- name: WAIT
40+
with:
41+
duration: 150s
42+
# Update the workload of PRIMARY variant to the new version.
43+
- name: ECS_PRIMARY_ROLLOUT
44+
# Change the traffic routing state where
45+
# the PRIMARY workloads will receive 100% of the traffic.
46+
- name: ECS_TRAFFIC_ROUTING
47+
with:
48+
primary: 100
49+
# Destroy all workloads of CANARY variant.
50+
- name: ECS_CANARY_CLEAN

ecs/bluegreen/servicedef.yaml

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
cluster: arn:aws:ecs:ap-northeast-1:XXXX:cluster/test-cluster
2+
serviceName: nginx-bluegreen-service
3+
desiredCount: 2
4+
deploymentConfiguration:
5+
maximumPercent: 200
6+
minimumHealthyPercent: 0
7+
schedulingStrategy: REPLICA
8+
# CAUTION: To enable PipeCD controls the deployment
9+
# DeploymentController of type EXTERNAL is required.
10+
deploymentController:
11+
type: EXTERNAL
12+
enableECSManagedTags: true
13+
propagateTags: SERVICE
14+
launchType: FARGATE
15+
networkConfiguration:
16+
awsvpcConfiguration:
17+
assignPublicIp: ENABLED
18+
securityGroups:
19+
- sg-YYYY
20+
subnets:
21+
- subnet-YYYY
22+
- subnet-YYYY

ecs/bluegreen/taskdef.yaml

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
family: nginx-service-fam
2+
executionRoleArn: arn:aws:iam::XXXX:role/ecsTaskExecutionRole
3+
containerDefinitions:
4+
- command: null
5+
cpu: 100
6+
image: XXXX.dkr.ecr.ap-northeast-1.amazonaws.com/nginx:1
7+
memory: 100
8+
mountPoints: []
9+
name: web
10+
portMappings:
11+
- containerPort: 80
12+
compatibilities:
13+
- FARGATE
14+
requiresCompatibilities:
15+
- FARGATE
16+
networkMode: awsvpc
17+
memory: 512
18+
cpu: 256
19+
pidMode: ""
20+
volumes: []

ecs/canary/.pipe.yaml

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
apiVersion: pipecd.dev/v1beta1
2+
kind: ECSApp
3+
spec:
4+
input:
5+
serviceDefinitionFile: servicedef.yaml
6+
taskDefinitionFile: taskdef.yaml
7+
targetGroups:
8+
# Primary target group is pointed by LB (ALB/NLB) live listener, the Primary task set
9+
# will be registered to this target group.
10+
primary:
11+
targetGroupArn: arn:aws:elasticloadbalancing:ap-northeast-1:XXXX:targetgroup/ecs-canary-blue/YYYY
12+
containerName: web
13+
containerPort: 80
14+
# Canary target group can also be pointed by LB (ALB/NLB) live listener at
15+
# the beginning of deployment, the Canary task set will be registered to this target group.
16+
# CAUTION: To enable PipeCD performs canary deployment strategy, this canary target group
17+
# is required.
18+
canary:
19+
targetGroupArn: arn:aws:elasticloadbalancing:ap-northeast-1:XXXX:targetgroup/ecs-canary-green/ZZZZ
20+
containerName: web
21+
containerPort: 80
22+
pipeline:
23+
stages:
24+
# Rollout CANARY variant's workload.
25+
# scale represents the percentage of workload will be rolled out,
26+
# in this case 30% of the current PRIMARY variant's workload is set.
27+
# Note: Rolled out variant serves no traffic at this time.
28+
- name: ECS_CANARY_ROLLOUT
29+
with:
30+
scale: 30
31+
# Change the traffic routing state where
32+
# the CANARY workloads will receive the specified percentage of traffic
33+
# (20% in this case). This is known as multi-phase canary strategy.
34+
- name: ECS_TRAFFIC_ROUTING
35+
with:
36+
canary: 20
37+
# Hold the deployment process for 150 seconds.
38+
- name: WAIT
39+
with:
40+
duration: 150s
41+
# Update the workload of PRIMARY variant to the new version.
42+
- name: ECS_PRIMARY_ROLLOUT
43+
# Change the traffic routing state where
44+
# the PRIMARY workloads will receive 100% of the traffic.
45+
- name: ECS_TRAFFIC_ROUTING
46+
with:
47+
primary: 100
48+
# Destroy all workloads of CANARY variant.
49+
- name: ECS_CANARY_CLEAN

ecs/canary/servicedef.yaml

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
cluster: arn:aws:ecs:ap-northeast-1:XXXX:cluster/test-cluster
2+
serviceName: nginx-canary-service
3+
desiredCount: 2
4+
deploymentConfiguration:
5+
maximumPercent: 200
6+
minimumHealthyPercent: 0
7+
schedulingStrategy: REPLICA
8+
# CAUTION: To enable PipeCD controls the deployment
9+
# DeploymentController of type EXTERNAL is required.
10+
deploymentController:
11+
type: EXTERNAL
12+
enableECSManagedTags: true
13+
propagateTags: SERVICE
14+
launchType: FARGATE
15+
networkConfiguration:
16+
awsvpcConfiguration:
17+
assignPublicIp: ENABLED
18+
securityGroups:
19+
- sg-YYYY
20+
subnets:
21+
- subnet-YYYY
22+
- subnet-YYYY

0 commit comments

Comments
 (0)