Repository navigation
Expand file tree
/
Copy pathexample.yaml
More file actions
293 lines (269 loc) · 7.26 KB
/
Copy pathexample.yaml
File metadata and controls
293 lines (269 loc) · 7.26 KB
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
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
# example.yaml — a runnable showcase of every kind this chart supports.
#
# Install (from chart root):
# helm template -f example.yaml demo-persist . # renders only persist-context resources
# helm template -f example.yaml demo-core . # renders only core-context resources
#
# This file is referenced from docs/ — snippets there are copied from here, so
# every fragment you read in the docs renders in the context of this file.
# Read the docs (start at docs/README.md) for the tutorial-shaped walkthrough;
# this file is the "all kinds at once" reference.
# ----------------------------------------------------------------------------
# Globals — see docs/globals.md
# ----------------------------------------------------------------------------
xDeployment:
persist: demo-persist # data + databases — install first, never re-install
core: demo-core # services — install once persist is up
xValidKinds: [deployment, ballancer, pvc, configmap, secret, pg-database, pg-backup, ray]
xCommonStorageClass: &global-storage
class: standard
xEnvGlobal: &global-env
HTTPS_PROXY: ""
xWaitDependencyImage: cerit.io/rationai/production/wait-for-200:v0.0.1
xNetworkPolicy:
enabled: false
name: kube-system
xAdditionalNoProxy:
- localhost
xGlobalUser: 1000
xGlobalGroup: 1000
xGlobalFsGroup: 1002
# ----------------------------------------------------------------------------
# Persist context — PVCs and databases. Survives across app re-installs.
# ----------------------------------------------------------------------------
# A shared persistent volume mounted by the app — see docs/pvc.md
sharedData:
kind: pvc
context: persist
name: shared-data
specs:
<<: *global-storage
size: 5Gi
# A Postgres cluster (CloudNativePG) — see docs/pg-database.md
appDb:
kind: pg-database
context: persist
name: app-db
specs:
<<: *global-storage
image: ghcr.io/cloudnative-pg/postgresql:15
instances: 1
username: appuser
dbname: appdb
storage: 2Gi
# A scheduled volume-snapshot backup of appDb — see docs/pg-database.md
appDbBackup:
kind: pg-backup
context: persist
name: app-db-backup
specs:
backupSchedule: "0 0 3 * * *"
referencedCluster: demo-persist-app-db-postgres
# ----------------------------------------------------------------------------
# Core context — applications. Install once persist is up.
# ----------------------------------------------------------------------------
# A configmap mounted as a file into the api pod — see docs/configmap.md
appConfig:
kind: configmap
context: core
name: app-config
content: |
log_level: info
feature_flags:
experimental_api: false
# A second configmap in the same context — see docs/configmap.md
# Each `configmap` entry renders one ConfigMap with one data key; declare as many
# as you need and mount them side by side.
gatewayConfig:
kind: configmap
context: core
name: gateway.conf
content: |
listen 8080;
admin_listen 9901;
upstream api;
# A secret — see docs/secret.md
# Two forms: a literal value, and a computed value (`uri.internal` returns a
# bare string; helpers that return YAML fragments are NOT usable in data:).
apiSecret:
kind: secret
context: core
name: api-secret
data:
API_TOKEN: "replace-me-with-a-real-token"
WORKER_HOST:
function: uri.internal
args: [worker, host]
# The api deployment — see docs/deployment.md
# Talks to the database (via env.postgress.*), to the worker (via env.serviceUri),
# mounts the shared PVC and the appConfig configmap, and is exposed via ingress.
api:
kind: deployment
context: core
name: api
port: 8000
pod:
image: ghcr.io/example/api:v1
imagePullPolicy: IfNotPresent
replicas: 2
targetPort: 8080
requests:
cpu: 200m
memory: 256Mi
limits:
cpu: 1
memory: 1Gi
heartbeat: /healthz
pvc:
- name: data
target: sharedData
mount: /data
- name: config
target: appConfig
mount: /etc/app
awaitEnv:
function: env.serviceUri
args: [worker, health]
env:
<<: *global-env
APP_LOG_LEVEL: info
DB_HOST:
function: env.postgress.host
args: [appDb]
DB_PASSWORD:
function: env.postgress.secret
args: [appDb]
DB_NAME: appdb
DB_USER: appuser
API_TOKEN:
function: env.secret
args: [apiSecret, API_TOKEN]
WORKER_URL:
function: env.serviceUri
args: [worker, url]
NO_PROXY:
function: env.noproxy
args: [worker]
ingress:
domainname: demo.example.com
pathprefix: /api
api:
health: /healthz
metrics: /metrics
# The worker deployment — see docs/deployment.md
# Internal-only (no ingress). The api waits for it via awaitEnv.
worker:
kind: deployment
context: core
name: worker
port: 9000
pod:
image: ghcr.io/example/worker:v1
replicas: 1
targetPort: 9000
requests:
cpu: 100m
memory: 128Mi
limits:
cpu: 500m
memory: 512Mi
heartbeat: /health
env:
<<: *global-env
DB_HOST:
function: env.postgress.host
args: [appDb]
DB_PASSWORD:
function: env.postgress.secret
args: [appDb]
DB_NAME: appdb
DB_USER: appuser
api:
health: /health
# A multi-port deployment behind an ingress — see docs/deployment.md#multiple-ports
# Uses the named-ports form: the public traffic port is named `http`, which is what
# the ingress backend and the NetworkPolicy resolve to. The `admin` port is reachable
# only in-cluster, at <release>-<name>:9901 — the ingress never sees it.
gateway:
kind: deployment
context: core
name: gateway
ports:
http:
port: 8080
targetPort: 8080
admin:
port: 9901
targetPort: 9901
pod:
image: ghcr.io/example/gateway:v1
replicas: 1
requests:
cpu: 100m
memory: 128Mi
limits:
cpu: 500m
memory: 512Mi
pvc:
- name: gateway-conf
target: gatewayConfig
mount: /etc/gateway/gateway.conf
subPath: gateway.conf
# the named-ports form has no single implied HTTP path, so string-form
# `heartbeat` is replaced by an explicit probe here
livenessProbe:
tcpSocket:
port: 8080
ingress:
domainname: demo.example.com
pathprefix: /gateway
env:
<<: *global-env
ADMIN_PORT:
function: env.namedPort
args: [gateway, admin, service]
# A load-balancer service — see docs/deployment.md#ballancer
# `ballancer` differs from `deployment` only by emitting `type: LoadBalancer`.
edgeProxy:
kind: ballancer
context: core
name: edge-proxy
port: 80
pod:
image: ghcr.io/example/edge-proxy:v1
replicas: 1
targetPort: 8080
requests:
cpu: 50m
memory: 64Mi
limits:
cpu: 200m
memory: 128Mi
# A small Ray service — see docs/ray.md
mlServe:
kind: ray
context: core
name: ml-serve
image: rayproject/ray:2.24.0
serveConfigV2: |
applications:
- name: hello
route_prefix: /
import_path: hello:app
head:
requests:
cpu: 500m
memory: 1Gi
limits:
cpu: 1
memory: 2Gi
workers:
- name: cpu-worker
replicas: 1
resources:
requests:
cpu: 500m
memory: 1Gi
limits:
cpu: 1
memory: 2Gi