-
Notifications
You must be signed in to change notification settings - Fork 180
Expand file tree
/
Copy pathdevspace.yaml
More file actions
512 lines (507 loc) · 17.4 KB
/
Copy pathdevspace.yaml
File metadata and controls
512 lines (507 loc) · 17.4 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
version: v2beta1
name: infra-controller
vars:
LOCAL_DEV_NAMESPACE:
source: env
default: nico-system
LOCAL_DEV_CERT_ISSUER_KIND:
source: env
default: Issuer
LOCAL_DEV_CERT_ISSUER_NAME:
source: env
default: local-ca-issuer
LOCAL_DEV_CERT_ISSUER_GROUP:
source: env
default: cert-manager.io
LOCAL_DEV_REST_POSTGRES_DB:
source: env
default: nico_rest
LOCAL_DEV_REST_POSTGRES_USER:
source: env
default: nico_rest
LOCAL_DEV_REST_POSTGRES_PASSWORD:
source: env
default: nico_rest
LOCAL_DEV_REST_API_FORWARD_PORT:
source: env
default: "18388"
LOCAL_DEV_KEYCLOAK_FORWARD_PORT:
source: env
default: "18082"
LOCAL_DEV_DSX_GATEWAY_FORWARD_PORT:
source: env
default: "18080"
LOCAL_DEV_DSX_GATEWAY_PROFILE: "0"
pipelines:
build: |-
run_dependencies --all --pipeline build
build_local_images
dev: |-
run_dependencies --all
ensure_pull_secrets --all
build_local_images
create_deployments --all
start_dev --all
deploy: |-
run_dependencies --all
ensure_pull_secrets --all
build_local_images
create_deployments --all
purge: |-
CONTEXT=$(kubectl config current-context 2>/dev/null || echo "")
case "$CONTEXT" in
kind-*)
LOCAL_DEV_NAMESPACE=${DEVSPACE_NAMESPACE} dev/deployment/devspace/reset-kind-cluster.sh
;;
*)
run_default_pipeline purge
;;
esac
functions:
build_local_images: |-
build_images core-artifacts nico-rest-api nico-rest-workflow \
nico-rest-site-manager nico-rest-site-agent nico-rest-db \
nico-rest-cert-manager nico-mcp
# Custom-build onChange state can outlive the corresponding local Docker
# image. Always invoke these inexpensive second-stage builds so the tags
# consumed by the Kind image-loading hook are guaranteed to exist.
build_images nico-api nico-bmc-proxy machine-a-tron --force-rebuild
images:
core-artifacts:
image: nico-devspace-core-artifacts
tags:
- latest
dockerfile: dev/deployment/devspace/Dockerfile.core-artifacts
context: .
buildKit: {}
skipPush: true
nico-api:
image: nico-api
custom:
command: |-
docker build -t ${runtime.images.nico-api.image}:${runtime.images.nico-api.tag} -f dev/deployment/devspace/Dockerfile.api .
onChange:
- .dockerignore
- Cargo.toml
- Cargo.lock
- rust-toolchain.toml
- .cargo
- crates
- include
- dev/docker/Dockerfile.build-container-x86_64
- dev/deployment/devspace/Dockerfile.core-artifacts
- dev/deployment/devspace/Dockerfile.core-artifacts.dockerignore
- dev/deployment/devspace/Dockerfile.api
- dev/deployment/devspace/Dockerfile.api.dockerignore
- pxe/templates
- pxe/static/blobs/internal/aarch64/secure-boot-pk.pem
nico-bmc-proxy:
image: nico-bmc-proxy
custom:
command: |-
docker build -t ${runtime.images.nico-bmc-proxy.image}:${runtime.images.nico-bmc-proxy.tag} -f dev/deployment/devspace/Dockerfile.bmc-proxy .
onChange:
- .dockerignore
- Cargo.toml
- Cargo.lock
- rust-toolchain.toml
- .cargo
- crates
- dev/docker/Dockerfile.build-container-x86_64
- dev/deployment/devspace/Dockerfile.core-artifacts
- dev/deployment/devspace/Dockerfile.core-artifacts.dockerignore
- dev/deployment/devspace/Dockerfile.bmc-proxy
- dev/deployment/devspace/Dockerfile.bmc-proxy.dockerignore
machine-a-tron:
image: machine-a-tron
custom:
command: |-
docker build -t ${runtime.images.machine-a-tron.image}:${runtime.images.machine-a-tron.tag} -f dev/deployment/devspace/Dockerfile.machine-a-tron .
onChange:
- .dockerignore
- Cargo.toml
- Cargo.lock
- rust-toolchain.toml
- .cargo
- crates
- include
- dev/docker/Dockerfile.build-container-x86_64
- dev/deployment/devspace/Dockerfile.core-artifacts
- dev/deployment/devspace/Dockerfile.core-artifacts.dockerignore
- dev/deployment/devspace/Dockerfile.machine-a-tron
- dev/deployment/devspace/Dockerfile.machine-a-tron.dockerignore
nico-rest-api:
image: localhost:5000/nico-rest-api
tags:
- ${DEVSPACE_GIT_COMMIT}-${DEVSPACE_TIMESTAMP}
dockerfile: rest-api/docker/local/Dockerfile.nico-rest-api
context: rest-api
buildKit: {}
skipPush: true
nico-rest-workflow:
image: localhost:5000/nico-rest-workflow
tags:
- ${DEVSPACE_GIT_COMMIT}-${DEVSPACE_TIMESTAMP}
dockerfile: rest-api/docker/local/Dockerfile.nico-rest-workflow
context: rest-api
buildKit: {}
skipPush: true
nico-rest-site-manager:
image: localhost:5000/nico-rest-site-manager
tags:
- ${DEVSPACE_GIT_COMMIT}-${DEVSPACE_TIMESTAMP}
dockerfile: rest-api/docker/local/Dockerfile.nico-rest-site-manager
context: rest-api
buildKit: {}
skipPush: true
nico-rest-site-agent:
image: localhost:5000/nico-rest-site-agent
tags:
- ${DEVSPACE_GIT_COMMIT}-${DEVSPACE_TIMESTAMP}
dockerfile: rest-api/docker/local/Dockerfile.nico-rest-site-agent
context: rest-api
buildKit: {}
skipPush: true
nico-rest-db:
image: localhost:5000/nico-rest-db
tags:
- ${DEVSPACE_GIT_COMMIT}-${DEVSPACE_TIMESTAMP}
dockerfile: rest-api/docker/local/Dockerfile.nico-rest-db
context: rest-api
buildKit: {}
skipPush: true
nico-rest-cert-manager:
image: localhost:5000/nico-rest-cert-manager
tags:
- ${DEVSPACE_GIT_COMMIT}-${DEVSPACE_TIMESTAMP}
dockerfile: rest-api/docker/local/Dockerfile.nico-rest-cert-manager
context: rest-api
buildKit: {}
skipPush: true
deployments:
carbide-local:
namespace: ${LOCAL_DEV_NAMESPACE}
updateImageTags: false
helm:
chart:
path: ./helm
values:
global:
image:
repository: ${runtime.images.nico-api.image}
tag: ${runtime.images.nico-api.tag}
pullPolicy: IfNotPresent
certificate:
issuerRef:
kind: ${LOCAL_DEV_CERT_ISSUER_KIND}
name: ${LOCAL_DEV_CERT_ISSUER_NAME}
group: ${LOCAL_DEV_CERT_ISSUER_GROUP}
nico-bmc-proxy:
image:
repository: ${runtime.images.nico-bmc-proxy.image}
tag: ${runtime.images.nico-bmc-proxy.tag}
pullPolicy: IfNotPresent
nico-machine-a-tron:
image:
repository: ${runtime.images.machine-a-tron.image}
tag: ${runtime.images.machine-a-tron.tag}
pullPolicy: IfNotPresent
valuesFiles:
- dev/deployment/devspace/values.base.yaml
- dev/deployment/devspace/values.generated.yaml
nico-rest:
namespace: nico-rest
updateImageTags: false
helm:
chart:
path: ./helm/rest/nico-rest
values:
global:
image:
repository: localhost:5000
tag: ${runtime.images.nico-rest-api.tag}
pullPolicy: Never
imagePullSecrets: []
certificate:
issuerRef:
kind: ClusterIssuer
name: nico-rest-ca-issuer
group: cert-manager.io
nico-rest-common:
secrets:
dbCreds:
username: ${LOCAL_DEV_REST_POSTGRES_USER}
password: ${LOCAL_DEV_REST_POSTGRES_PASSWORD}
nico-rest-api:
nodePort:
enabled: true
port: 30388
config:
db:
host: postgres.postgres.svc.cluster.local
name: ${LOCAL_DEV_REST_POSTGRES_DB}
user: ${LOCAL_DEV_REST_POSTGRES_USER}
keycloak:
enabled: true
baseURL: http://keycloak:8082
externalBaseURL: http://localhost:${LOCAL_DEV_KEYCLOAK_FORWARD_PORT}
realm: nico-dev
clientID: nico-api
serviceAccount: true
nico-rest-workflow:
secrets:
dbCreds: db-creds
config:
db:
host: postgres.postgres.svc.cluster.local
name: ${LOCAL_DEV_REST_POSTGRES_DB}
user: ${LOCAL_DEV_REST_POSTGRES_USER}
nico-rest-db:
db:
host: postgres.postgres.svc.cluster.local
name: ${LOCAL_DEV_REST_POSTGRES_DB}
user: ${LOCAL_DEV_REST_POSTGRES_USER}
nico-rest-site-agent:
namespace: nico-rest
updateImageTags: false
helm:
chart:
path: ./helm/rest/nico-rest-site-agent
values:
global:
image:
repository: localhost:5000
tag: ${runtime.images.nico-rest-api.tag}
pullPolicy: Never
imagePullSecrets: []
certificate:
issuerRef:
kind: ClusterIssuer
name: nico-rest-ca-issuer
group: cert-manager.io
certificate:
uris:
- spiffe://nico.local/nico-system/sa/elektra-site-agent
envConfig:
NICO_ADDRESS: nico-api.${LOCAL_DEV_NAMESPACE}.svc.cluster.local:1079
NICO_SEC_OPT: "2"
CORE_GRPC_ADDRESS: nico-api.${LOCAL_DEV_NAMESPACE}.svc.cluster.local:1079
CORE_GRPC_SEC_OPT: "2"
FLOW_GRPC_ENABLED: "false"
CLUSTER_ID: 00000000-0000-4000-8000-000000000001
# The REST workflow ignores inventory for 3m5s after a machine update.
# Keep the local inventory cadence beyond that guard to avoid skipped hosts.
TEMPORAL_INVENTORY_SCHEDULE: "@every 4m"
TEMPORAL_SERVER: site.server.temporal.local
TEMPORAL_SUBSCRIBE_NAMESPACE: 00000000-0000-4000-8000-000000000001
TEMPORAL_SUBSCRIBE_QUEUE: site
hooks:
- name: build-base-image
events: ["before:build"]
command: |-
docker image inspect build-container-localdev >/dev/null 2>&1 || \
docker build --pull=false -t build-container-localdev -f dev/docker/Dockerfile.build-container-x86_64 .
- name: load-images-into-local-cluster
events: ["before:deploy"]
command: |-
CONTEXT=$(kubectl config current-context 2>/dev/null || echo "")
case "$CONTEXT" in
kind-*)
echo "Loading images into kind cluster..."
kind load docker-image --name "${CONTEXT#kind-}" \
"${runtime.images.nico-api.image}:${runtime.images.nico-api.tag}" \
"${runtime.images.nico-bmc-proxy.image}:${runtime.images.nico-bmc-proxy.tag}" \
"${runtime.images.machine-a-tron.image}:${runtime.images.machine-a-tron.tag}"
;;
# Add new local K8s tools here
esac
- name: load-rest-images-into-local-cluster
events: ["before:deploy"]
command: |-
CONTEXT=$(kubectl config current-context 2>/dev/null || echo "")
case "$CONTEXT" in
kind-*)
echo "Loading REST images into kind cluster..."
kind load docker-image --name "${CONTEXT#kind-}" \
"${runtime.images.nico-rest-api.image}:${runtime.images.nico-rest-api.tag}" \
"${runtime.images.nico-rest-workflow.image}:${runtime.images.nico-rest-workflow.tag}" \
"${runtime.images.nico-rest-site-manager.image}:${runtime.images.nico-rest-site-manager.tag}" \
"${runtime.images.nico-rest-site-agent.image}:${runtime.images.nico-rest-site-agent.tag}" \
"${runtime.images.nico-rest-db.image}:${runtime.images.nico-rest-db.tag}" \
"${runtime.images.nico-rest-cert-manager.image}:${runtime.images.nico-rest-cert-manager.tag}"
;;
esac
- name: setup-rest-integration
events: ["after:deploy"]
command: |-
LOCAL_DEV_REST_API_FORWARD_PORT=${LOCAL_DEV_REST_API_FORWARD_PORT} \
LOCAL_DEV_KEYCLOAK_FORWARD_PORT=${LOCAL_DEV_KEYCLOAK_FORWARD_PORT} \
dev/deployment/devspace/setup-rest-integration.sh
profiles:
- name: dsx-exchange
patches:
- op: replace
path: vars.LOCAL_DEV_DSX_GATEWAY_PROFILE
value: "1"
- op: add
path: images.nico-mcp
value:
image: localhost:5000/nico-mcp
tags:
- ${DEVSPACE_GIT_COMMIT}-${DEVSPACE_TIMESTAMP}
dockerfile: rest-api/docker/local/Dockerfile.nico-mcp
context: rest-api
buildKit: {}
skipPush: true
- op: add
path: deployments.nico-mcp
value:
namespace: nico-rest
updateImageTags: false
helm:
chart:
path: ./helm/rest/nico-mcp
values:
global:
image:
repository: localhost:5000
tag: ${runtime.images.nico-rest-api.tag}
pullPolicy: Never
imagePullSecrets: []
config:
baseURL: http://nico-rest-api:8388
apiName: nico
- op: add
path: deployments.dsx-gateway-csc
value:
namespace: dsx-gateway-csc
updateImageTags: false
helm:
chart:
path: ./.devspace/dsx-exchange-v2.9.1/deploy/dsx-agent-gateway
valuesFiles:
- dev/deployment/devspace/dsx-agent-gateway-common.yaml
- dev/deployment/devspace/dsx-agent-gateway-csc.yaml
values:
auth:
jwt:
providers:
nico-dev:
issuer: http://localhost:${LOCAL_DEV_KEYCLOAK_FORWARD_PORT}/realms/nico-dev
- op: add
path: hooks
value:
name: prepare-dsx-exchange-source
events: ["before:build"]
command: dev/deployment/devspace/prepare-dsx-exchange.sh >/dev/null
- op: add
path: hooks
value:
name: install-dsx-gateway-prereqs
events: ["before:deploy"]
command: dev/deployment/devspace/install-dsx-gateway-prereqs.sh
- op: add
path: hooks
value:
name: load-dsx-profile-images-into-local-cluster
events: ["before:deploy"]
command: |-
CONTEXT=$(kubectl config current-context 2>/dev/null || echo "")
case "$CONTEXT" in
kind-*)
echo "Loading the NICo MCP image into the kind cluster..."
kind load docker-image --name "${CONTEXT#kind-}" \
"${runtime.images.nico-mcp.image}:${runtime.images.nico-mcp.tag}"
;;
esac
- op: replace
path: hooks.name=setup-rest-integration.command
value: |-
LOCAL_DEV_REST_API_FORWARD_PORT=${LOCAL_DEV_REST_API_FORWARD_PORT} \
LOCAL_DEV_KEYCLOAK_FORWARD_PORT=${LOCAL_DEV_KEYCLOAK_FORWARD_PORT} \
LOCAL_DEV_DSX_GATEWAY_FORWARD_PORT=${LOCAL_DEV_DSX_GATEWAY_FORWARD_PORT} \
LOCAL_DEV_DSX_GATEWAY_ENABLED=${LOCAL_DEV_DSX_GATEWAY_PROFILE} \
dev/deployment/devspace/setup-rest-integration.sh
- op: add
path: deployments.dsx-exchange
value:
namespace: ${LOCAL_DEV_NAMESPACE}
helm:
chart:
name: nats
version: "2.12.6"
repo: https://nats-io.github.io/k8s/helm/charts/
values:
fullnameOverride: dsx-exchange
config:
cluster:
enabled: false
jetstream:
enabled: true
fileStore:
enabled: true
maxSize: 256Mi
pvc:
enabled: false
memoryStore:
enabled: true
maxSize: 64Mi
mqtt:
enabled: true
port: 1883
merge:
stream_replicas: 1
consumer_memory_storage: true
container:
resources:
requests:
cpu: 50m
memory: 64Mi
limits:
cpu: 500m
memory: 512Mi
natsBox:
enabled: false
podDisruptionBudget:
enabled: false
- op: add
path: deployments.carbide-local.helm.values.nico-api
value:
dsxExchangeEventBusConfig: '{enabled=true,mqtt_endpoint="dsx-exchange",mqtt_broker_port=1883,auth={auth_mode="none"},periodic_state_republish={interval="10s"}}'
- name: core-only
patches:
- op: add
path: hooks
value:
name: reject-dsx-gateway-with-core-only
events: ["before:build", "before:deploy"]
command: |-
if [ "${LOCAL_DEV_DSX_GATEWAY_PROFILE}" = "1" ]; then
echo "the dsx-exchange and core-only profiles cannot be combined" >&2
exit 1
fi
- op: replace
path: functions.build_local_images
value: |-
build_images core-artifacts
build_images nico-api nico-bmc-proxy machine-a-tron
- op: remove
path: images.nico-rest-api
- op: remove
path: images.nico-rest-workflow
- op: remove
path: images.nico-rest-site-manager
- op: remove
path: images.nico-rest-site-agent
- op: remove
path: images.nico-rest-db
- op: remove
path: images.nico-rest-cert-manager
- op: remove
path: deployments.nico-rest
- op: remove
path: deployments.nico-rest-site-agent
- op: remove
path: hooks.name=load-rest-images-into-local-cluster
- op: remove
path: hooks.name=setup-rest-integration