-
Notifications
You must be signed in to change notification settings - Fork 5
/
devspace.yaml
945 lines (830 loc) · 30.3 KB
/
devspace.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
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
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
version: v2beta1
name: stalker
vars:
RK_ENVIRONMENT: dev
imports:
- path: devspace.dev.yaml
enabled: $(is_equal ${RK_ENVIRONMENT} "dev")
- path: devspace.tests.yaml
enabled: $(is_equal ${RK_ENVIRONMENT} "tests")
- path: devspace.prod.yaml
enabled: $(is_equal ${RK_ENVIRONMENT} "prod-community")
- path: devspace.base.yaml
pipelines:
setup-certificates:
run: |-
create_deployments root-certificates cron-certificates jm-certificates orchestrator-certificates ui-certificates
setup-kafka:
run: |-
# Kafka's keystore and keystore password
${DEVSPACE_KUBECTL_EXECUTABLE} delete secret kafka-jks --ignore-not-found -n ${DEVSPACE_NAMESPACE}
${DEVSPACE_KUBECTL_EXECUTABLE} create secret generic kafka-jks --from-file=kafka.truststore.jks=${KAFKA_TRUSTSTORE_FILE} --from-file=kafka.keystore.jks=${KAFKA_KEYSTORE_FILE} -n ${DEVSPACE_NAMESPACE}
${DEVSPACE_KUBECTL_EXECUTABLE} delete secret kafka-jks-password --ignore-not-found -n ${DEVSPACE_NAMESPACE}
${DEVSPACE_KUBECTL_EXECUTABLE} create secret generic kafka-jks-password --from-literal=password=${KAFKA_KEYSTORE_PASSWORD} --from-literal=keystore-password=${KAFKA_KEYSTORE_PASSWORD} --from-literal=truststore-password=${KAFKA_KEYSTORE_PASSWORD} --from-literal=key-password=${KAFKA_KEYSTORE_PASSWORD} -n ${DEVSPACE_NAMESPACE}
build:
run: |-
build_images stalker-base
build_images ui jobs-manager orchestrator python-job-base nuclei-job-base cron
deploy:
run: |-
run_pipelines build
create_deployments mongo ui jobs-manager kafka orchestrator-service-account orchestrator --sequential
jobs-manager-e2e:
flags:
- name: watch
short: w
type: bool
run: |-
create_deployments namespaces
run_pipelines setup-certificates setup-kafka build
create_deployments mongo kafka orchestrator-service-account orchestrator jobs-manager --sequential
# Wait for kafka and mongo to be ready
wait_pod --label-selector app.kubernetes.io/component=mongodb --timeout 600
wait_pod --label-selector app.kubernetes.io/instance=kafka --timeout 600
# Run tests
if [ $(get_flag "watch") == "true" ];
then
echo "Running tests in watch mode."
start_dev jobs-manager mongo
exec_container --label-selector app.kubernetes.io/component=jobs-manager -n stalker -- /bin/sh -c 'yarn workspace @red-kite/jobs-manager test:e2e:watch'
else
echo "Running tests in ci mode."
start_dev jobs-manager
exec_container --label-selector app.kubernetes.io/component=jobs-manager -n stalker -- /bin/sh -c 'yarn workspace @red-kite/jobs-manager test:e2e:cicd' 2>&1
fi
stop_dev --all
purge:
run: |-
stop_dev --all
purge_deployments mongo ui jobs-manager jobs-manager kafka orchestrator-service-account orchestrator cron --sequential
jobs-manager-e2e-cicd-deploy:
run: |-
# Running the build pipeline is required before running this
create_deployments namespaces
run_pipelines setup-certificates setup-kafka
create_deployments mongo kafka orchestrator-service-account orchestrator jobs-manager --sequential
# Wait for kafka and mongo to be ready
wait_pod --label-selector app.kubernetes.io/component=mongodb --timeout 600
wait_pod --label-selector app.kubernetes.io/instance=kafka --timeout 600
jobs-manager-e2e-cicd-run:
run: |-
# Running jobs-manager-e2e-cicd-deploy pipeline is required before running this
start_dev jobs-manager
exec_container --label-selector app.kubernetes.io/component=jobs-manager -n stalker -- /bin/sh -c 'yarn workspace @red-kite/jobs-manager test:e2e:cicd'
stop_dev --all
dev:
run: |-
create_deployments namespaces
run_pipelines setup-certificates setup-kafka build
# Start mongo and kafka
create_deployments mongo kafka --sequential
start_dev mongo kafka
# Wait for kafka and mongo to be ready
wait_pod --label-selector app.kubernetes.io/component=mongodb --timeout 600
wait_pod --label-selector app.kubernetes.io/instance=kafka --timeout 600
create_deployments ui jobs-manager orchestrator-service-account orchestrator --sequential
# Wait for services before applying network policies
wait_pod --label-selector app.kubernetes.io/component=ui --timeout 600
wait_pod --label-selector app.kubernetes.io/component=jobs-manager --timeout 600
wait_pod --label-selector app.kubernetes.io/component=orchestrator --timeout 600
create_deployments network-policies
create_deployments resource-quotas
# Start microservices + ui
start_dev orchestrator jobs-manager ui
create_deployments cron
wait_pod --label-selector app.kubernetes.io/component=cron --timeout 600
start_dev cron
prod:
run: |-
create_deployments namespaces
run_pipelines setup-certificates
# Start mongo and kafka
create_deployments mongo kafka --sequential
# Wait for kafka and mongo to be ready
wait_pod --label-selector app.kubernetes.io/component=mongodb --timeout 600
wait_pod --label-selector app.kubernetes.io/instance=kafka --timeout 600
create_deployments jobs-manager orchestrator-service-account orchestrator ui --sequential
# Wait for services before applying network policies
wait_pod --label-selector app.kubernetes.io/component=ui --timeout 600
wait_pod --label-selector app.kubernetes.io/component=jobs-manager --timeout 600
wait_pod --label-selector app.kubernetes.io/component=orchestrator --timeout 600
create_deployments network-policies resource-quotas
create_deployments cron
wait_pod --label-selector app.kubernetes.io/component=cron --timeout 600
prod-community:
run: |-
create_deployments namespaces
run_pipelines setup-kafka build
run_pipelines prod
start_dev ui orchestrator jobs-manager cron
images:
stalker-base:
image: ghcr.io/red-kite-solutions/stalker-base
dockerfile: packages/Dockerfile.base
context: .
rebuildStrategy: default
tags:
- latest
jobs-manager:
image: ghcr.io/red-kite-solutions/stalker-jobs-manager
dockerfile: packages/backend/jobs-manager/service/${DOCKERFILE_NAME}
context: .
rebuildStrategy: default
cron:
image: ghcr.io/red-kite-solutions/stalker-cron
dockerfile: packages/backend/cron/service/${DOCKERFILE_NAME}
context: .
rebuildStrategy: default
ui:
image: ghcr.io/red-kite-solutions/stalker-app
dockerfile: packages/frontend/stalker-app/${DOCKERFILE_NAME}
context: .
rebuildStrategy: default
orchestrator:
image: ghcr.io/red-kite-solutions/stalker-orchestrator
dockerfile: packages/backend/orchestrator/service/${DOCKERFILE_NAME}
context: .
rebuildStrategy: default
python-job-base:
image: ghcr.io/red-kite-solutions/stalker-python-job-base
dockerfile: jobs/job-base-images/python/Dockerfile
tags:
- "latest"
- "1"
context: jobs/job-base-images/python
rebuildStrategy: always
nuclei-job-base:
image: ghcr.io/red-kite-solutions/stalker-nuclei-job-base
dockerfile: jobs/job-base-images/python/Dockerfile.nuclei
tags:
- "latest"
- "1"
context: jobs/job-base-images/python/
rebuildStrategy: always
deployments:
jobs-manager:
updateImageTags: $( echo ${UPDATE_IMAGE_TAGS} )
helm:
values:
volumes:
- name: certs
secret:
secretName: jm-certs
containers:
- env:
- name: MONGO_ADDRESS
value: ${JM_MONGO_ADDRESS}
- name: MONGO_DATABASE_NAME
value: ${JM_MONGO_DATABASE_NAME}
- name: JM_JWT_SECRET
value: ${JM_JWT_SECRET}
- name: JM_REFRESH_SECRET
value: ${JM_REFRESH_SECRET}
- name: KAFKA_URI
value: ${KAFKA_URI}
- name: RK_URL
value: ${RK_URL}
- name: MONGO_REPLICA_SET_NAME
value: ${MONGO_REPLICA_SET_NAME}
- name: JM_ENVIRONMENT
value: ${JM_ENVIRONMENT}
- name: RK_CRON_API_TOKEN
value: ${RK_CRON_API_TOKEN}
- name: SECRET_PUBLIC_RSA_KEY
value: ${SECRET_PUBLIC_RSA_KEY}
- name: JM_MONGO_KEY_PASSWORD
value: ${JM_MONGO_KEY_PASSWORD}
- name: JM_KAFKA_KEY_PASSWORD
value: ${JM_KAFKA_KEY_PASSWORD}
- name: RK_VERSION
value: ${RK_VERSION}
- name: EMAIL_SENDER
value: ${JM_EMAIL_SENDER}
- name: MAILJET_API_KEY
value: ${JM_MAILJET_API_KEY}
- name: MAILJET_API_SECRET
value: ${JM_MAILJET_API_SECRET}
- name: EMAIL_RECIPIENTS_FILTER_LIST
value: ${JM_EMAIL_RECIPIENTS_FILTER_LIST}
- name: RK_APP_BASE_URL
value: ${RK_APP_BASE_URL}
- name: DATA_SOURCES
value: ${RK_DATA_SOURCES}
volumeMounts:
- containerPath: /certs
volume:
name: certs
readOnly: true
image: ghcr.io/red-kite-solutions/stalker-jobs-manager:${JM_VERSION}
name: jobs-manager-container
nodeSelector: $(echo ${JM_K8S_NODE_SELECTOR})
service:
type: ClusterIP
ports:
- containerPort: 3000
port: 3000
protocol: TCP
cron:
updateImageTags: $( echo ${UPDATE_IMAGE_TAGS} )
helm:
values:
volumes:
- name: certs
secret:
secretName: cron-certs
containers:
- env:
- name: MONGO_ADDRESS
value: ${CRON_MONGO_ADDRESS}
- name: MONGO_DATABASE_NAME
value: ${JM_MONGO_DATABASE_NAME}
- name: MONGO_REPLICA_SET_NAME
value: ${MONGO_REPLICA_SET_NAME}
- name: CRON_ENVIRONMENT
value: ${JM_ENVIRONMENT} # Follows the same environment as JM since they work together
- name: JM_URL
value: ${JM_URL}
- name: RK_CRON_API_TOKEN
value: ${RK_CRON_API_TOKEN}
- name: CRON_MONGO_KEY_PASSWORD
value: ${CRON_MONGO_KEY_PASSWORD}
volumeMounts:
- containerPath: /certs
volume:
name: certs
readOnly: true
image: ghcr.io/red-kite-solutions/stalker-cron:${CRON_VERSION}
name: cron-container
nodeSelector: $(echo ${CRON_K8S_NODE_SELECTOR})
service:
ports:
- containerPort: 3000
port: 3001
protocol: TCP
ui:
updateImageTags: $( echo ${UPDATE_IMAGE_TAGS} )
helm:
values:
containers:
- env:
image: ghcr.io/red-kite-solutions/stalker-app:${FRONTEND_VERSION}
name: ui-container
nodeSelector: $(echo ${UI_K8S_NODE_SELECTOR})
service:
ports:
- containerPort: 4200
port: 4200
protocol: TCP
mongo: # volumes location: /var/lib/docker/volumes/minikube/_data/hostpath-provisioner/stalker/
helm:
chart:
name: mongodb
repo: https://charts.bitnami.com/bitnami
version: "13.9.1"
values:
architecture: replicaset
nodeSelector: $(echo ${MONGO_K8S_NODE_SELECTOR})
replicaCount: ${MONGO_REPLICA_SET_COUNT}
arbiter:
enabled: false
persistence:
size: ${MONGO_MAX_SIZE}
storageClass: ${MONGO_STORAGE_CLASS}
externalAccess.enabled: true
externalAccess.service.type: LoadBalancer
externalAccess.service.port: 27017
externalAccess.autoDiscovery.enabled: true
serviceAccount.create: true
rbac.create: true
tls:
enabled: true
mode: requireTLS
autoGenerated: false
caCert: ${MONGO_CA_CRT}
caKey: ${MONGO_CA_KEY}
mTls:
enabled: true
service:
ports:
mongodb: 27017
auth:
rootPassword: ${MONGO_ROOT_PASSWORD}
initdbScripts:
init-db.js: |
db = db.getSiblingDB("stalker");
db.createCollection("cronsubscriptions");
var cronRole = {
role: "cronrole",
privileges: [
{
resource: {
db: "stalker",
collection: "cronsubscriptions"
},
actions: ["find"]
},
{
resource: {
db: "stalker",
collection: "alarms"
},
actions: ["find"]
}
],
roles: []
};
db.createRole(cronRole);
var cronUser = { user: "${MONGO_CRON_USER}", pwd: "${MONGO_CRON_PASSWORD}", roles: ["cronrole"] };
db.createUser(cronUser);
var flowRole = {
role: "flowrole",
privileges: [
{
resource: {
db:"stalker",
collection:""
},
actions: ["find", "insert", "remove", "update", "createCollection", "changeStream", "createIndex", "convertToCapped"]
}
],
roles:[]
}
db.createRole(flowRole);
var flowUser = { user: "${MONGO_JM_USER}", pwd: "${MONGO_JM_PASSWORD}", roles: ["flowrole"] };
db.createUser(flowUser);
// The next one is used for e2e testing
var flowRole = {
role: "flowrolee2e",
privileges: [
{
resource: {
db:"stalker",
collection:""
},
actions: ["find", "insert", "remove", "update", "createCollection", "changeStream", "createIndex", "dropCollection", "convertToCapped"]
}
],
roles:[]
}
db.createRole(flowRole);
var flowUser = { user: "${MONGO_JM_USER_E2E}", pwd: "${MONGO_JM_PASSWORD}", roles: ["flowrolee2e"] };
db.createUser(flowUser);
kafka:
helm:
chart:
name: kafka
repo: https://charts.bitnami.com/bitnami
version: "28.0.0"
values:
controller:
nodeSelector: $(echo ${KAFKA_K8S_NODE_SELECTOR})
persistence:
storageClass: ${KAFKA_STORAGE_CLASS}
resources:
nodeSelector: $(echo ${KAFKA_K8S_NODE_SELECTOR})
broker:
nodeSelector: $(echo ${KAFKA_K8S_NODE_SELECTOR})
metrics:
nodeSelector: $(echo ${KAFKA_K8S_NODE_SELECTOR})
# The mapping rules extract the CN part of the certificate to be used as the username in ACL rules
# kafka as a super user is the account used for provisioning and for inter-kafka communications.
# Other accounts have minimal rights defined in "extraProvisioningCommands"
extraConfig: |
authorizer.class.name = org.apache.kafka.metadata.authorizer.StandardAuthorizer
ssl.principal.mapping.rules = RULE:^.*OU=Stalker Kafka Clients.*,CN=(.*?)(,.*)?$/$1/,RULE:^CN=(.*?),OU=Stalker Kafka.*$/$1/,DEFAULT
super.users = User:kafka
listeners:
client:
name: CLIENT
containerPort: 9092
protocol: SSL
sslClientAuth: "required"
controller:
name: CONTROLLER
containerPort: 9093
protocol: SSL
sslClientAuth: "required"
interbroker:
name: INTERNAL
containerPort: 9094
protocol: SSL
sslClientAuth: "required"
tls:
passwordsSecret: kafka-jks-password
existingSecret: kafka-jks
keystorePassword: ${KAFKA_KEYSTORE_PASSWORD}
truststorePassword: ${KAFKA_KEYSTORE_PASSWORD}
endpointIdentificationAlgorithm: "https"
extraEnvVars:
- name: ALLOW_PLAINTEXT_LISTENER
value: "no"
provisioning:
enabled: true
nodeSelector: $(echo ${KAFKA_K8S_NODE_SELECTOR})
auth:
tls:
type: jks
passwordsSecret: kafka-jks-password
certificatesSecret: kafka-jks
keystore: kafka.keystore.jks
truststore: kafka.truststore.jks
topics:
- name: stalker.jobs.findings
partitions: 1
replicationFactor: 1
config:
max.message.bytes: "1048588"
# max.message.bytes: 64000
flush.messages: 1
- name: stalker.jobs.requests
partitions: 1
replicationFactor: 1
config:
max.message.bytes: 64000
flush.messages: 1
- name: stalker.jobs.logs
partitions: 1
replicationFactor: 1
config:
max.message.bytes: 64000
flush.messages: 1
- name: stalker.jobs.models
partitions: 1
replicationFactor: 1
config:
max.message.bytes: 64000
flush.messages: 1
extraProvisioningCommands: # Setting the ACLs
- "/opt/bitnami/kafka/bin/kafka-acls.sh --bootstrap-server $KAFKA_SERVICE --command-config $CLIENT_CONF --add --allow-principal User:jobs-manager --operation read --operation write --operation describe --topic stalker.jobs.findings"
- "/opt/bitnami/kafka/bin/kafka-acls.sh --bootstrap-server $KAFKA_SERVICE --command-config $CLIENT_CONF --add --allow-principal User:jobs-manager --operation write --operation describe --topic stalker.jobs.requests"
- "/opt/bitnami/kafka/bin/kafka-acls.sh --bootstrap-server $KAFKA_SERVICE --command-config $CLIENT_CONF --add --allow-principal User:jobs-manager --operation read --operation describe --topic stalker.jobs.logs"
- "/opt/bitnami/kafka/bin/kafka-acls.sh --bootstrap-server $KAFKA_SERVICE --command-config $CLIENT_CONF --add --allow-principal User:jobs-manager --operation read --operation write --operation describe --topic stalker.jobs.models"
- "/opt/bitnami/kafka/bin/kafka-acls.sh --bootstrap-server $KAFKA_SERVICE --command-config $CLIENT_CONF --add --allow-principal User:orchestrator --operation write --operation describe --topic stalker.jobs.findings"
- "/opt/bitnami/kafka/bin/kafka-acls.sh --bootstrap-server $KAFKA_SERVICE --command-config $CLIENT_CONF --add --allow-principal User:orchestrator --operation read --operation describe --topic stalker.jobs.requests"
- "/opt/bitnami/kafka/bin/kafka-acls.sh --bootstrap-server $KAFKA_SERVICE --command-config $CLIENT_CONF --add --allow-principal User:orchestrator --operation write --operation describe --topic stalker.jobs.logs"
- "/opt/bitnami/kafka/bin/kafka-acls.sh --bootstrap-server $KAFKA_SERVICE --command-config $CLIENT_CONF --add --allow-principal User:orchestrator --operation read --operation describe --topic stalker.jobs.models"
- "/opt/bitnami/kafka/bin/kafka-acls.sh --bootstrap-server $KAFKA_SERVICE --command-config $CLIENT_CONF --add --allow-principal User:jobs-manager --operation read --operation describe --group jobs-manager"
- "/opt/bitnami/kafka/bin/kafka-acls.sh --bootstrap-server $KAFKA_SERVICE --command-config $CLIENT_CONF --add --allow-principal User:jobs-manager --operation read --operation describe --group jobs-manager-job-logs"
- "/opt/bitnami/kafka/bin/kafka-acls.sh --bootstrap-server $KAFKA_SERVICE --command-config $CLIENT_CONF --add --allow-principal User:orchestrator --operation read --operation describe --group stalker"
orchestrator-service-account:
kubectl:
manifests:
- packages/backend/orchestrator/service/orchestrator-service-account.yml
orchestrator:
updateImageTags: $( echo ${UPDATE_IMAGE_TAGS} )
helm:
values:
volumes:
- name: certs
secret:
secretName: orchestrator-certs
serviceAccountName: orchestrator-service-account
containers:
- env:
- name: JobsQueue__QueueUri
value: ${KAFKA_URI}
- name: SECRET_PRIVATE_RSA_KEY
value: ${SECRET_PRIVATE_RSA_KEY}
- name: ORCHESTRATOR_KAFKA_KEY_PASSWORD
value: ${ORCHESTRATOR_KAFKA_KEY_PASSWORD}
- name: JOBS_K8S_NODE_SELECTOR
value: ${ORCHESTRATOR_JOBS_K8S_NODE_SELECTOR}
volumeMounts:
- containerPath: /certs
volume:
name: certs
readOnly: true
image: ghcr.io/red-kite-solutions/stalker-orchestrator:${ORCHESTRATOR_VERSION}
name: orchestrator-container
nodeSelector: $(echo ${ORCHESTRATOR_K8S_NODE_SELECTOR})
service:
ports:
- containerPort: 80
port: 80
protocol: TCP
namespaces:
kubectl:
manifests:
- jobs/namespace.yml
resource-quotas:
kubectl:
manifests:
- jobs/${RESOURCE_QUOTA}
network-policies:
kubectl:
manifests:
- network-policy.yml
- packages/frontend/stalker-app/${NETWORK_POLICY}
- packages/backend/jobs-manager/service/${NETWORK_POLICY}
- packages/backend/cron/service/${NETWORK_POLICY}
- packages/backend/orchestrator/service/${NETWORK_POLICY}
- database/${NETWORK_POLICY}
- queue/${NETWORK_POLICY}
- jobs/${NETWORK_POLICY}
root-certificates:
kubectl:
inlineManifest: |-
apiVersion: v1
kind: Secret
metadata:
name: root-ca
data:
rks-ca.crt: ${ROOT_RKS_CA_CRT}
cron-certificates:
kubectl:
inlineManifest: |-
apiVersion: v1
kind: Secret
metadata:
name: cron-certs
data:
ca.pem: ${CRON_CERTIFICATES_CA_PEM}
client-signed.crt: ${CRON_CERTIFICATES_CLIENT_SIGNED_CRT}
client.key: ${CRON_CERTIFICATES_CLIENT_KEY}
rks-ca.crt: ${CRON_CERTIFICATES_RKS_CA_CRT}
jm-certificates:
kubectl:
inlineManifest: |-
apiVersion: v1
kind: Secret
metadata:
name: jm-certs
data:
ca.pem: ${JM_CERTIFICATES_CA_PEM}
client-signed.crt: ${JM_CERTIFICATES_CLIENT_SIGNED_CRT}
client.key: ${JM_CERTIFICATES_CLIENT_KEY}
kafka-ca.crt: ${JM_CERTIFICATES_KAFKA_CA_CRT}
kafka-client-signed.crt: ${JM_CERTIFICATES_KAFKA_CLIENT_SIGNED_CRT}
kafka-client.key: ${JM_CERTIFICATES_KAFKA_CLIENT_KEY}
ssl-private.key: ${JM_CERTIFICATES_SSL_PRIVATE_KEY}
ssl-certificate-chain.pem: ${JM_CERTIFICATES_SSL_CERTIFICATE_CHAIN_PEM}
orchestrator-certificates:
kubectl:
inlineManifest: |-
apiVersion: v1
kind: Secret
metadata:
name: orchestrator-certs
data:
kafka-ca.crt: ${ORCHESTRATOR_CERTIFICATES_KAFKA_CA_CRT}
kafka-client-signed.crt: ${ORCHESTRATOR_CERTIFICATES_KAFKA_CLIENT_SIGNED_CRT}
kafka-client.key: ${ORCHESTRATOR_CERTIFICATES_KAFKA_CLIENT_KEY}
rks-ca.crt: ${ORCHESTRATOR_CERTIFICATES_RKS_CA_CRT}
ui-certificates:
kubectl:
inlineManifest: |-
apiVersion: v1
kind: Secret
metadata:
name: app-certs
data:
tls.crt: ${UI_CERTIFICATES_NGINX_CHAIN_PEM}
tls.key: ${UI_CERTIFICATES_NGINX_KEY}
dev:
mongo:
labelSelector:
app.kubernetes.io/component: mongodb
ports:
- port: "27017"
kafka:
labelSelector:
app.kubernetes.io/instance: kafka
jobs-manager:
labelSelector:
app.kubernetes.io/component: jobs-manager
container: jobs-manager-container
logs:
enabled: true
sync:
- path: ./package.json:/app/package.json
disableDownload: true
- path: ./yarn.lock:/app/yarn.lock
disableDownload: true
- path: ./packages:/app/packages
disableDownload: true
excludePaths:
- node_modules/
- "**/.angular/**/*"
- "**/dist/**/*"
- "**/node_modules/**/*"
restartHelper:
inject: false
ports:
- port: "3000"
cron:
labelSelector:
app.kubernetes.io/component: cron
container: cron-container
logs:
enabled: true
sync:
- path: ./package.json:/app/package.json
disableDownload: true
- path: ./yarn.lock:/app/yarn.lock
disableDownload: true
- path: ./packages:/app/packages
disableDownload: true
excludePaths:
- node_modules/
- "**/.angular/**/*"
- "**/dist/**/*"
- "**/node_modules/**/*"
restartHelper:
inject: false
ports:
- port: "3001:3000"
ui:
labelSelector:
app.kubernetes.io/component: ui
container: ui-container
sync:
- path: ./package.json:/app/package.json
disableDownload: true
- path: ./yarn.lock:/app/yarn.lock
disableDownload: true
- path: ./packages:/app/packages
disableDownload: true
excludePaths:
- node_modules/
- "**/.angular/**/*"
- "**/dist/**/*"
- "**/node_modules/**/*"
restartHelper:
inject: false
ports:
- port: "4200"
orchestrator:
labelSelector:
app.kubernetes.io/component: orchestrator
container: orchestrator-container
sync:
- path: ./package.json:/app/package.json
disableDownload: true
- path: ./yarn.lock:/app/yarn.lock
disableDownload: true
- path: ./packages:/app/packages
disableDownload: true
excludePaths:
- node_modules/
- "**/.angular/**/*"
- "**/dist/**/*"
- "**/node_modules/**/*"
- backend/orchestrator/**/bin/**/*
- backend/orchestrator/**/obj/**/*
restartHelper:
inject: false
ports:
- port: "5135:80"
hooks:
- events:
- after:deploy:mongo
wait:
running: true
terminatedWithCode: 0
container:
labelSelector:
app.kubernetes.io/component: mongodb
containerName: mongo-container
- events:
- after:deploy:jobs-manager
wait:
running: true
terminatedWithCode: 0
container:
labelSelector:
app.kubernetes.io/component: jobs-manager
containerName: jobs-manager-container
- events:
- after:deploy:cron
wait:
running: true
terminatedWithCode: 0
container:
labelSelector:
app.kubernetes.io/component: cron
containerName: cron-container
- events:
- after:deploy:ui
wait:
running: true
terminatedWithCode: 0
container:
labelSelector:
app.kubernetes.io/component: ui
containerName: ui-container
- events:
- after:deploy:orchestrator
wait:
running: true
terminatedWithCode: 0
container:
labelSelector:
app.kubernetes.io/component: orchestrator
containerName: orchestrator-container
- events:
- after:deploy:kafka
wait:
running: true
terminatedWithCode: 0
container:
labelSelector:
app.kubernetes.io/instance: kafka
containerName: kafka-container
profiles:
- name: e2e
activation:
- vars:
RK_ENVIRONMENT: tests
patches:
- op: replace
path: dev.jobs-manager.ports
value:
- port: "9229"
- op: remove
path: dev.jobs-manager.sync
- name: prod
activation:
- vars:
RK_ENVIRONMENT: "^prod-?.*$"
patches:
# Orchestrator modifications
- op: remove
path: dev.orchestrator.sync
- op: remove
path: dev.orchestrator.ports
# Mongo modifications
- op: remove
path: dev.mongo.ports
# Cron modifications
- op: remove
path: dev.cron.sync
- op: remove
path: dev.cron.ports
# Jobs Manager modifications
- op: remove
path: dev.jobs-manager.ports
- op: replace
path: dev.jobs-manager.resources
value:
limits:
memory: 1Gi
# UI modifications
- op: replace
path: dev.ui.ports
value:
- port: "${RK_PORT}:443"
bindAddress: ${RK_BIND_ADDRESS}
- op: replace
path: dev.ui.resources
value:
limits:
memory: 2Gi
cpu: 1
- op: replace
path: deployments.ui
value:
updateImageTags: $( echo ${UPDATE_IMAGE_TAGS} )
helm:
values:
volumes:
- name: certs
secret:
defaultMode: 0777
secretName: app-certs
- name: root-ca
secret:
secretName: root-ca
initContainers:
- name: init-ca
image: nginx:1.27.0-alpine
command:
- sh
- -c
- |
apk update && apk add ca-certificates
update-ca-certificates
volumeMounts:
- containerPath: /etc/nginx/certs/
volume:
name: certs
readOnly: true
- containerPath: /usr/local/share/ca-certificates
volume:
name: root-ca
readOnly: true
containers:
- env: []
volumeMounts:
- containerPath: /etc/nginx/certs/
volume:
name: certs
readOnly: true
image: ghcr.io/red-kite-solutions/stalker-app:${FRONTEND_VERSION}
name: ui-container
nodeSelector: $(echo ${UI_K8S_NODE_SELECTOR})
service:
type: ClusterIP
ports:
- containerPort: 443
port: ${RK_PORT}
protocol: TCP