-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathclouddeploy.template.yaml
165 lines (163 loc) · 5.23 KB
/
clouddeploy.template.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
###############################################################################
# Note: this is a template YAML which the 08 shell script transforms
# into a proper YAML. This file is not needed server-side, just from
# script 08 to create first 2 Pipelines and N targets (currently 4)
# GKE is regional, we chose everything except prod to be in DEV cluster
# and PROD to be in PROD cluster. We want to use this set up to showcase
# Canary behaviour through Edward Thiele idea.
#
# CD Schema is well documented here:
# https://cloud.google.com/deploy/docs/api/reference/rest/v1/projects.locations.deliveryPipelines
# Tags/Labels/Annotations are documented here:
# https://cloud.google.com/deploy/docs/labels-annotations
###############################################################################
apiVersion: deploy.cloud.google.com/v1
kind: DeliveryPipeline
metadata:
name: app01
annotations:
about: This is a Python sample web frontend built with BuildPacks
labels:
lang: python
CDT_VER: _MY_VERSION_
ricc_app_id: '01'
author_username: ricc
description: |
Delivery pipeline for CI CD App01 (in python) and then
packaged via buildpacks.
CDTv _MY_VERSION_
serialPipeline:
stages:
- targetId: dev
profiles: [dev]
- targetId: staging
profiles: [staging]
- targetId: canary
profiles: [canary]
- targetId: production
profiles: [production]
---
apiVersion: deploy.cloud.google.com/v1
kind: DeliveryPipeline
metadata:
name: app02
annotations:
#ricc: was also here and loves ruby
about: This is a Ruby sample web frontend built with Docker
labels:
lang: ruby
CDT_VER: _MY_VERSION_
ricc_app_id: '02'
author_username: ricc
description: |
Delivery pipeline for CI/CD App02 (in ruby) and then
packaged via Docker.
CDTv _MY_VERSION_
serialPipeline:
stages:
- targetId: dev
profiles: [dev]
- targetId: staging
profiles: [staging]
- targetId: canary
profiles: [canary]
- targetId: production
profiles: [production]
---
## This is currently being tested by Riccardo and Alex. If you want to activate app03, you can just locally uncomment
## This code and the 07 script one-liner to activate app03 build trigger. Make sure to use ENABLE_APP03 in your
## `.env.sh` env as per `.env.sh.dist`.
apiVersion: deploy.cloud.google.com/v1
kind: DeliveryPipeline
metadata:
name: app03
annotations:
about: This is a NodeJS sample web frontend built with Docker (currently under TESTING)
labels:
lang: nodejs
CDT_VER: _MY_VERSION_
ricc_app_id: '03'
author_username: bielski
description: |
Delivery pipeline for CI/CD App03 (in node.js) and then
packaged via Docker.
CDTv _MY_VERSION_
serialPipeline:
stages:
- targetId: dev
profiles: [dev]
- targetId: staging
profiles: [staging]
- targetId: canary-production
profiles: [canary]
- targetId: production
profiles: [production]
---
# Note there are FIVE targets across all apps, but only FOUR are use in each APP.
# - App01/App02 will use normally D/S/C/P.
# - App03 will use D/S/CP/P where CP is Canary (stage) on Production (cluster).
apiVersion: deploy.cloud.google.com/v1
kind: Target
metadata:
name: dev
description: 01 Development cluster (internal, autopush)
gke:
cluster: projects/MY_PROJECT_ID/locations/MY_REGION/clusters/cicd-dev
---
apiVersion: deploy.cloud.google.com/v1
kind: Target
metadata:
name: staging
description: 02 Staging cluster (internal, more testing)
gke:
cluster: projects/MY_PROJECT_ID/locations/MY_REGION/clusters/cicd-dev
---
apiVersion: deploy.cloud.google.com/v1
kind: Target
metadata:
name: canary
description: |
03 canary cluster (external, rather stable).
Used for Traffic Splitting to bedew 90% of traffic into
the canary target (and remaining 10% to prod) for some time before
promoting all traffic to prod.
# Used by App01 and App02 for Solution2.
gke:
cluster: projects/MY_PROJECT_ID/locations/MY_REGION/clusters/cicd-canary
---
apiVersion: deploy.cloud.google.com/v1
kind: Target
metadata:
name: production
description: |
04 production cluster (external, as stable as it can be).
Used for Traffic Splitting to bedew 10% of Traffic into
this canary (while 90% goes to canary) for some time before
promoting all traffic to prod.
gke:
cluster: projects/MY_PROJECT_ID/locations/MY_REGION/clusters/cicd-prod
---
apiVersion: deploy.cloud.google.com/v1
kind: Target
metadata:
name: canary-production
description: |
03 (only app03) production cluster with canary deployment.
Used to showcase canary deployment within a single cluster
before promoting all traffic to newest version.
# Used by App03 for Solution4 (simple solution).
gke:
cluster: projects/MY_PROJECT_ID/locations/MY_REGION/clusters/cicd-prod