Skip to content

Commit de6a116

Browse files
feat: jetstream eventbus (#589)
* feat: jetstream eventbus
1 parent a2e5e0a commit de6a116

File tree

3 files changed

+59
-2
lines changed

3 files changed

+59
-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: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ global:
9393
enabled: true
9494
# -- Minimum number of available eventbus pods. For eventbus to stay functional the majority of its replicas should always be available.
9595
minAvailable: 2
96+
type: nats # -- Eventbus type. Can be nats or jetstream.
9697
nats:
9798
native:
9899
nodeSelector: {}
@@ -111,6 +112,23 @@ global:
111112
cpu: 200m
112113
memory: 1Gi
113114
ephemeral-storage: 2Gi
115+
jetstream:
116+
version: latest
117+
nodeSelector: {}
118+
tolerations: []
119+
affinity: {}
120+
replicas: 3
121+
maxPayload: "4MB"
122+
containerTemplate:
123+
resources:
124+
limits:
125+
cpu: 500m
126+
memory: 4Gi
127+
ephemeral-storage: 2Gi
128+
requests:
129+
cpu: 200m
130+
memory: 1Gi
131+
ephemeral-storage: 2Gi
114132

115133
# -- Configuration for external ArgoCD
116134
# Should be used when `argo-cd.enabled` is set to false

0 commit comments

Comments
 (0)