-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathdevspace.yaml
More file actions
525 lines (496 loc) · 15.3 KB
/
Copy pathdevspace.yaml
File metadata and controls
525 lines (496 loc) · 15.3 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
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
version: v2beta1
name: farm
vars:
DEVSPACE_ENV_FILE: "devspace.env"
PACKAGE_NAME: "nv.svc.farm"
APP_NAME: "farm"
IMAGE: farm
SOURCE_CODE_RELATIVE_LOCATION:
question: "Where is the root of the repository located relative to your devspace.yaml?"
default: "."
ENABLE_VSCODE_REMOTE:
question: "Should DevSpace configure the target container with VSCode Server and Connect to it?"
default: "false"
DEPLOYMENT_LOG_LEVEL: "Info"
REMOTE_WORKING_DIR: "/workspace"
DEVSPACE_PROFILE_DIR: "${SOURCE_CODE_RELATIVE_LOCATION}/helm/${PACKAGE_NAME}/internal/devspace/"
# This is a list of `pipelines` that DevSpace can execute (you can define your own)
pipelines:
# This is the pipeline for the main command: `devspace dev` (or `devspace run-pipeline dev`)
dev:
run: |-
ensure_pull_secrets --all # 1. Ensure pull secrets
run_pipelines databases # 2. Deploy MySQL and Redis
$(is_in "debian" "${DEVSPACE_PROFILES}" && echo "build_images farm-dev farm-debian" || echo "build_images farm-dev")
$(is_in "local" "${DEVSPACE_PROFILES}" && echo "build_images farm-dev farm-local" || echo "build_images farm-dev")
$(is_in "obs" "${DEVSPACE_PROFILES}" && echo "run_pipelines mesh" || echo "create_deployments farm")
$(is_in "nvct-mock" "${DEVSPACE_PROFILES}" && echo "run_pipelines nvct-mock" || echo "")
$(is_in "nvcf-mock" "${DEVSPACE_PROFILES}" && echo "run_pipelines nvcf-mock" || echo "")
start_dev farm # 3. Start dev mode "app" (see "dev" section)
if [ ${ENABLE_VSCODE_REMOTE} == "true" ]; then
echo "code --folder-uri vscode-remote://ssh-remote+farm.devspace${REMOTE_WORKING_DIR}"
else
echo ""
fi
deploy:
run: |-
ensure_pull_secrets --all
run_pipelines databases # Deploy MySQL and Redis
$(is_in "debian" "${DEVSPACE_PROFILES}" && echo "build_images farm-debian" || echo "")
$(is_in "local" "${DEVSPACE_PROFILES}" && echo "build_images farm-local" || echo "")
$(is_in "obs" "${DEVSPACE_PROFILES}" && echo "run_pipelines mesh" || echo "")
$(is_in "nvct-mock" "${DEVSPACE_PROFILES}" && echo "run_pipelines nvct-mock" || echo "")
$(is_in "nvcf-mock" "${DEVSPACE_PROFILES}" && echo "run_pipelines nvcf-mock" || echo "")
create_deployments farm
build:
run: |
build_images --all
build-debian:
run: |
build_images farm-debian
build-dev:
run: |
build_images farm-dev
build-local:
run: |
build_images farm-local
build-distroless:
run: |
build_images farm
build-nvct-mock:
run: |
build_images nvct-mock
build-nvcf-mock:
run: |
build_images nvcf-mock
mesh:
run: |
create_deployments istio-base
create_deployments istiod
create_deployments istio-gateway
create_deployments istio-ingress-gateways
create_deployments prometheus
create_deployments grafana
create_deployments tracing
create_deployments kiali
create_deployments istio-farm-gateway
create_deployments istio-farm-ns-patch
create_deployments farm
nvct-mock:
run: |
build_images nvct-mock
create_deployments nvct-mock farm
nvcf-mock:
run: |
build_images nvcf-mock
create_deployments nvcf-mock farm
databases:
run: |
create_deployments mysql
create_deployments redis
wordctl:
run: |-
build_images wordctl -t dev
# This is a list of `deployments` that DevSpace can create for this project
deployments:
# MySQL deployment for local development
mysql:
helm:
chart:
name: mysql
repo: https://charts.bitnami.com/bitnami
version: "9.10.1"
valuesFiles:
- ./helm/${PACKAGE_NAME}/internal/devspace/mysql-values.yaml
# Redis deployment for local development
redis:
helm:
chart:
name: redis
repo: https://charts.bitnami.com/bitnami
version: "17.11.3"
valuesFiles:
- ./helm/${PACKAGE_NAME}/internal/devspace/redis-values.yaml
# Farm application deployment
farm:
updateImageTags: false
helm:
disableDependencyUpdate: true
chart:
name: ./helm/${PACKAGE_NAME}
valuesFiles:
- ./helm/${PACKAGE_NAME}/internal/devspace/devspace-values.yaml
values:
global:
imagePullSecrets:
- devspace-pull-secrets
nvct-mock:
helm:
chart:
name: component-chart
repo: https://charts.devspace.sh
values:
containers:
- image: ${runtime.images.nvct-mock.image}:${runtime.images.nvct-mock.tag}
service:
ports:
- port: 8877
ingress:
name: nvct
ingressClassName: traefik
rules:
- host: nvct.127-0-0-1.nip.io
nvcf-mock:
helm:
chart:
name: component-chart
repo: https://charts.devspace.sh
values:
containers:
- image: ${runtime.images.nvcf-mock.image}:${runtime.images.nvcf-mock.tag}
service:
ports:
- port: 8877
ingress:
name: nvcf
ingressClassName: traefik
rules:
- host: nvcf.127-0-0-1.nip.io
images:
farm:
dockerfile: "${SOURCE_CODE_RELATIVE_LOCATION}/Dockerfile"
context: "${SOURCE_CODE_RELATIVE_LOCATION}"
skipPush: true
image: ${IMAGE}
rebuildStrategy: default
farm-dev:
dockerfile: "${SOURCE_CODE_RELATIVE_LOCATION}/Dockerfile-dev"
context: "${SOURCE_CODE_RELATIVE_LOCATION}"
skipPush: true
image: ${IMAGE}-dev
rebuildStrategy: default
farm-debian:
dockerfile: "${SOURCE_CODE_RELATIVE_LOCATION}/Dockerfile-debian"
context: "${SOURCE_CODE_RELATIVE_LOCATION}"
skipPush: true
image: ${IMAGE}-debian
rebuildStrategy: default
farm-local:
dockerfile: "${SOURCE_CODE_RELATIVE_LOCATION}/Dockerfile-local"
context: "${SOURCE_CODE_RELATIVE_LOCATION}"
skipPush: true
image: ${IMAGE}-local
rebuildStrategy: default
nvct-mock:
dockerfile: "${SOURCE_CODE_RELATIVE_LOCATION}/mocks/nvct/Dockerfile"
context: "${SOURCE_CODE_RELATIVE_LOCATION}/mocks/nvct"
skipPush: true
image: nvct-mock
rebuildStrategy: default
nvcf-mock:
dockerfile: "${SOURCE_CODE_RELATIVE_LOCATION}/mocks/nvcf/Dockerfile"
context: "${SOURCE_CODE_RELATIVE_LOCATION}/mocks/nvcf"
skipPush: true
image: nvcf-mock
rebuildStrategy: default
wordctl:
dockerfile: "${SOURCE_CODE_RELATIVE_LOCATION}/user-docs/wordctl/Dockerfile"
context: "${SOURCE_CODE_RELATIVE_LOCATION}/user-docs/wordctl"
skipPush: true
image: wordctl
rebuildStrategy: default
localRegistry:
enabled: false
localbuild: true
hooks:
- name: "post-purge-farm-hook"
command: |
echo Removing persistent volumes left-over from deploymet
kubectl --context ${DEVSPACE_CONTEXT} -n ${DEVSPACE_NAMESPACE} delete pvc -l app.kubernetes.io/name=farm || true
kubectl --context ${DEVSPACE_CONTEXT} -n ${DEVSPACE_NAMESPACE} delete job job-definitions-loader || true
kubectl --context ${DEVSPACE_CONTEXT} -n ${DEVSPACE_NAMESPACE} delete jobs --all || true
events: ["after:purge:farm"]
- name: "post-purge-mysql-hook"
command: |
echo "Removing MySQL persistent volumes"
kubectl --context ${DEVSPACE_CONTEXT} -n ${DEVSPACE_NAMESPACE} delete pvc -l app.kubernetes.io/name=mysql || true
events: ["after:purge:mysql"]
- name: "post-purge-redis-hook"
command: |
echo "Removing Redis persistent volumes"
kubectl --context ${DEVSPACE_CONTEXT} -n ${DEVSPACE_NAMESPACE} delete pvc -l app.kubernetes.io/name=redis || true
events: ["after:purge:redis"]
- name: "post-image-build-hook"
command: |
kind load docker-image wordctl:dev
events: ["after:build:wordctl"]
dev:
farm:
labelSelector:
app.kubernetes.io/name: ${DEVSPACE_PROFILE}
app.kubernetes.io/instance: farm
devImage: ${IMAGE}-dev
command: ["sh", "-c", "tail -f /dev/null"]
# Sync files between the local filesystem and the development container
sync:
- path: "${SOURCE_CODE_RELATIVE_LOCATION}/:${REMOTE_WORKING_DIR}/"
excludePaths: [".pytest_cache", ".tox", "artifacts", "cache", ".venv", "node_modules"]
printLogs: true
terminal:
command: "/workspace/scripts/devspace_start.sh ${DEVSPACE_PROFILE}"
logs: {}
ssh:
enabled: true
localHostname: ${APP_NAME}.devspace
# Make the following commands from my local machine available inside the dev container
proxyCommands:
- command: devspace
- command: kubectl
- command: helm
- command: ${DEVSPACE_PROFILE}-svc
- gitCredentials: true
patches:
- op: replace
path: spec.securityContext.runAsUser
value: 0
- op: replace
path: spec.securityContext.allowPrivilegeEscalation
value: true
- op: replace
path: spec.containers[*].securityContext.runAsUser
value: 0
- op: replace
path: spec.containers[*].securityContext.allowPrivilegeEscalation
value: true
- op: replace
path: spec.containers[*].securityContext.runAsNonRoot
value: false
- op: replace
path: spec.containers[0].command
value: []
- op: replace
path: spec.containers[0].args
value: ["${DEVSPACE_PROFILE}-svc"]
# Forward the following ports to be able access your application via localhost
ports:
- port: 8011:8011 # app server `make start -p svc=[svcname]` or start with vscode launch config
- port: 8000:8000 # docs-server `make docs-server`
- port: 9000:9000
# Open the following URLs once they return an HTTP status code other than 502 or 503
open:
- url: http://farm.127-0-0-1.nip.io:8080/queue/management/dashboard/
- url: http://localhost:8011/docs
profiles:
- name: ingress
merge: $(cat ${DEVSPACE_PROFILE_DIR}/ingress.yaml)
- name: controller
- name: agents
- name: capacity
- name: dag
- name: dashboard
- name: retries
- name: results
- name: settings
- name: tasks
- name: logs
- name: jobs
# When this profile is provided Istio service mesh is deployed
- name: obs
merge: $(cat ${DEVSPACE_PROFILE_DIR}/istio-manifests/istio-deps.yaml)
- name: memcached
merge: $(cat ${DEVSPACE_PROFILE_DIR}/memcached.yaml)
# Use latest locally built Debian based image (devspace run build-debian)
- name: debian
merge: $(cat ${DEVSPACE_PROFILE_DIR}/debian.yaml)
# Use latest locally built local (fast-dev) image (devspace run build-local)
- name: local
merge: $(cat ${DEVSPACE_PROFILE_DIR}/local.yaml)
# Use latest locally built distroless based image (devspace run build-distroless)
- name: distroless
merge: $(cat ${DEVSPACE_PROFILE_DIR}/distroless.yaml)
- name: nvct-mock
merge: $(cat ${DEVSPACE_PROFILE_DIR}/nvct-mock.yaml)
- name: nvcf-mock
merge: $(cat ${DEVSPACE_PROFILE_DIR}/nvcf-mock.yaml)
- name: redis-ha-cluster
merge: $(cat ${DEVSPACE_PROFILE_DIR}/redis-ha-cluster.yaml)
- name: tracing
# Use the `commands` section to define repeatable dev workflows for this project
commands:
start:
section: app
command: bash
description: Start application
args: ["-c", "make start run svc=$!{DEVSPACE_PROFILE}"]
smoketest:
section: farm
command: bash
description: Run Farm Smoke Test
args:
- -c
- ./${DEVSPACE_PROFILE_DIR}smoke-test.sh
import-images:
section: farm
command: bash
description: Download and import required images for faster bringup times
args:
- -c
- ./${DEVSPACE_PROFILE_DIR}import.sh
open-dashboard:
section: farm
command: bash
description: Open Farm Dashboard in browser
args:
- -c
- xdg-open http://farm.127-0-0-1.nip.io:8080/queue/management/dashboard/
open-all-links:
section: farm
command: bash
description: Open all farm related links, including observability
args:
- -c
- ./${DEVSPACE_PROFILE_DIR}open-links.sh
build-debian:
section: images
command: bash
description: Build Farm Debian image
args:
- -c
- devspace run-pipeline build-debian
build-local:
section: images
command: bash
description: Build Farm local (fast-dev) image
args:
- -c
- devspace run-pipeline build-local
build-dev:
section: images
command: bash
description: Build Farm development image.
args:
- -c
- devspace run-pipeline build-dev
build-distroless:
section: images
command: bash
description: Build Farm with distroless based image(Farm default).
args:
- -c
- devspace run-pipeline build-distroless
build-nvct-mock:
section: images
command: bash
description: Build Farm with nvct mock service.
args:
- -c
- devspace run-pipeline build-nvct-mock
build-nvcf-mock:
section: images
command: bash
description: Build Farm with nvcf mock service.
args:
- -c
- devspace run-pipeline build-nvcf-mock
tasks-submit:
section: farm-tasks
command: ./${DEVSPACE_PROFILE_DIR}/tests/tasks/submit/test.sh
appendArgs: true
description: Run Farm Task Submit Test (specify test name)
tasks-shot-manager:
section: farm-tasks
command: ./${DEVSPACE_PROFILE_DIR}/tests/tasks/shot-manager/test.sh
appendArgs: true
description: Run Farm Task Shot Manager Test (specify test name)
tasks-submit-graph:
section: farm-tasks
command: ./${DEVSPACE_PROFILE_DIR}/tests/tasks/submit-graph/test.sh
appendArgs: true
description: Run Farm Dag Test (specify scenario name or json file)
results:
section: farm-results
command: ./${DEVSPACE_PROFILE_DIR}/tests/results/test.sh
description: Run Farm Results Service Test
# Database management commands
mysql-shell:
section: databases
command: kubectl
description: Open MySQL shell
args:
- exec
- -it
- statefulset/mysql
- --
- mysql
- -u
- ovfarm
- -povfarm
- ovFarmTaskStore
redis-cli:
section: databases
command: kubectl
description: Open Redis CLI
args:
- exec
- -it
- statefulset/redis-master
- --
- redis-cli
redis-cluster-cli:
section: databases
command: kubectl
description: Open Redis Cluster CLI (use with redis-ha-cluster profile)
args:
- exec
- -it
- redis-cluster-0
- --
- redis-cli
- -c
mysql-logs:
section: databases
command: kubectl
description: Show MySQL logs
args:
- logs
- -f
- statefulset/mysql
redis-logs:
section: databases
command: kubectl
description: Show Redis logs
args:
- logs
- -f
- statefulset/redis-master
database-status:
section: databases
command: kubectl
description: Check database pod status
args:
- get
- pods
- -l
- app.kubernetes.io/name in (mysql,redis)
# Cluster management commands (replaces `devspace nv-core kind create`)
cluster-create:
section: cluster
command: bash
description: Create Kind cluster with Traefik ingress for local development
args:
- -c
- ./${DEVSPACE_PROFILE_DIR}kind-cluster.sh create
cluster-delete:
section: cluster
command: bash
description: Delete the Kind cluster
args:
- -c
- ./${DEVSPACE_PROFILE_DIR}kind-cluster.sh delete
cluster-status:
section: cluster
command: bash
description: Show Kind cluster status and running pods
args:
- -c
- ./${DEVSPACE_PROFILE_DIR}kind-cluster.sh status