Skip to content

Commit cd973e5

Browse files
mikhail-klimkoATGardner
authored andcommitted
feat: jetstream eventbus (#589)
* feat: jetstream eventbus
1 parent acdc619 commit cd973e5

File tree

3 files changed

+60
-2
lines changed

3 files changed

+60
-2
lines changed

charts/gitops-runtime/templates/eventbus/codefresh-eventbus.yaml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{{- $eventBusName := default "codefresh-eventbus" .Values.global.runtime.eventBus.name }}
22
{{- $eventBusSpec := .Values.global.runtime.eventBus }}
3+
{{- $eventBusType := .Values.global.runtime.eventBus.type }}
34
{{/* Remove name from eventbus spec */}}
45
{{- if hasKey $eventBusSpec "name" }}
56
{{- $eventBusSpec = unset $eventBusSpec "name" }}
@@ -8,12 +9,22 @@
89
{{- if hasKey $eventBusSpec "pdb" }}
910
{{- $eventBusSpec = unset $eventBusSpec "pdb" }}
1011
{{- end }}
12+
{{/* Remove annotations from eventbus spec */}}
1113
{{- if hasKey $eventBusSpec "annotations" }}
1214
{{- $eventBusSpec = unset $eventBusSpec "annotations" }}
1315
{{- end }}
1416

15-
{{- $_ := set $eventBusSpec.nats.native "nodeSelector" ($eventBusSpec.nats.native.nodeSelector | default .Values.global.nodeSelector) }}
16-
{{- $_ := set $eventBusSpec.nats.native "tolerations" ($eventBusSpec.nats.native.tolerations | default .Values.global.tolerations) }}
17+
{{- if eq $eventBusType "nats" }}
18+
{{- $eventBusSpec = unset $eventBusSpec "jetstream" }}
19+
{{- $_ := set $eventBusSpec.nats.native "nodeSelector" ($eventBusSpec.nats.native.nodeSelector | default .Values.global.nodeSelector) }}
20+
{{- $_ := set $eventBusSpec.nats.native "tolerations" ($eventBusSpec.nats.native.tolerations | default .Values.global.tolerations) }}
21+
{{- end }}
22+
23+
{{- if eq $eventBusType "jetstream" }}
24+
{{- $eventBusSpec = unset $eventBusSpec "nats" }}
25+
{{- $_ := set $eventBusSpec.jetstream "nodeSelector" ($eventBusSpec.jetstream.nodeSelector | default .Values.global.nodeSelector) }}
26+
{{- $_ := set $eventBusSpec.jetstream "tolerations" ($eventBusSpec.jetstream.tolerations | default .Values.global.tolerations) }}
27+
{{- end }}
1728

1829
apiVersion: argoproj.io/v1alpha1
1930
kind: EventBus
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
2+
suite: eventbus tests
3+
templates:
4+
- eventbus/codefresh-eventbus.yaml
5+
tests:
6+
- it: Should create an EventBus with the correct type (nats)
7+
template: eventbus/codefresh-eventbus.yaml
8+
values:
9+
- ./values/mandatory-values.yaml
10+
set:
11+
global.runtime.eventBus.type: nats
12+
asserts:
13+
- exists:
14+
path: spec.nats
15+
- notExists:
16+
path: spec.jetstream
17+
18+
- it: Should create an EventBus with the correct type (jetstream)
19+
template: eventbus/codefresh-eventbus.yaml
20+
values:
21+
- ./values/mandatory-values.yaml
22+
set:
23+
global.runtime.eventBus.type: jetstream
24+
asserts:
25+
- exists:
26+
path: spec.jetstream
27+
- notExists:
28+
path: spec.nats

charts/gitops-runtime/values.yaml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ global:
8989
enabled: true
9090
# -- Minimum number of available eventbus pods. For eventbus to stay functional the majority of its replicas should always be available.
9191
minAvailable: 2
92+
type: nats # -- Eventbus type. Can be nats or jetstream.
9293
nats:
9394
native:
9495
nodeSelector: {}
@@ -107,6 +108,24 @@ global:
107108
cpu: 200m
108109
memory: 1Gi
109110
ephemeral-storage: 2Gi
111+
jetstream:
112+
version: latest
113+
nodeSelector: {}
114+
tolerations: []
115+
affinity: {}
116+
replicas: 3
117+
maxPayload: "4MB"
118+
containerTemplate:
119+
resources:
120+
limits:
121+
cpu: 500m
122+
memory: 4Gi
123+
ephemeral-storage: 2Gi
124+
requests:
125+
cpu: 200m
126+
memory: 1Gi
127+
ephemeral-storage: 2Gi
128+
110129
# -- Configuration for external ArgoCD
111130
# Should be used when `argo-cd.enabled` is set to false
112131
external-argo-cd:

0 commit comments

Comments
 (0)