Skip to content

feat: jetstream eventbus (#589) #592

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: release/0.22
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{{- $eventBusName := default "codefresh-eventbus" .Values.global.runtime.eventBus.name }}
{{- $eventBusSpec := .Values.global.runtime.eventBus }}
{{- $eventBusType := .Values.global.runtime.eventBus.type }}
{{/* Remove name from eventbus spec */}}
{{- if hasKey $eventBusSpec "name" }}
{{- $eventBusSpec = unset $eventBusSpec "name" }}
Expand All @@ -8,12 +9,22 @@
{{- if hasKey $eventBusSpec "pdb" }}
{{- $eventBusSpec = unset $eventBusSpec "pdb" }}
{{- end }}
{{/* Remove annotations from eventbus spec */}}
{{- if hasKey $eventBusSpec "annotations" }}
{{- $eventBusSpec = unset $eventBusSpec "annotations" }}
{{- end }}

{{- $_ := set $eventBusSpec.nats.native "nodeSelector" ($eventBusSpec.nats.native.nodeSelector | default .Values.global.nodeSelector) }}
{{- $_ := set $eventBusSpec.nats.native "tolerations" ($eventBusSpec.nats.native.tolerations | default .Values.global.tolerations) }}
{{- if eq $eventBusType "nats" }}
{{- $eventBusSpec = unset $eventBusSpec "jetstream" }}
{{- $_ := set $eventBusSpec.nats.native "nodeSelector" ($eventBusSpec.nats.native.nodeSelector | default .Values.global.nodeSelector) }}
{{- $_ := set $eventBusSpec.nats.native "tolerations" ($eventBusSpec.nats.native.tolerations | default .Values.global.tolerations) }}
{{- end }}

{{- if eq $eventBusType "jetstream" }}
{{- $eventBusSpec = unset $eventBusSpec "nats" }}
{{- $_ := set $eventBusSpec.jetstream "nodeSelector" ($eventBusSpec.jetstream.nodeSelector | default .Values.global.nodeSelector) }}
{{- $_ := set $eventBusSpec.jetstream "tolerations" ($eventBusSpec.jetstream.tolerations | default .Values.global.tolerations) }}
{{- end }}

apiVersion: argoproj.io/v1alpha1
kind: EventBus
Expand Down
28 changes: 28 additions & 0 deletions charts/gitops-runtime/tests/eventbus_test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
suite: eventbus tests
templates:
- eventbus/codefresh-eventbus.yaml
tests:
- it: Should create an EventBus with the correct type (nats)
template: eventbus/codefresh-eventbus.yaml
values:
- ./values/mandatory-values.yaml
set:
global.runtime.eventBus.type: nats
asserts:
- exists:
path: spec.nats
- notExists:
path: spec.jetstream

- it: Should create an EventBus with the correct type (jetstream)
template: eventbus/codefresh-eventbus.yaml
values:
- ./values/mandatory-values.yaml
set:
global.runtime.eventBus.type: jetstream
asserts:
- exists:
path: spec.jetstream
- notExists:
path: spec.nats
19 changes: 19 additions & 0 deletions charts/gitops-runtime/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ global:
enabled: true
# -- Minimum number of available eventbus pods. For eventbus to stay functional the majority of its replicas should always be available.
minAvailable: 2
type: nats # -- Eventbus type. Can be nats or jetstream.
nats:
native:
nodeSelector: {}
Expand All @@ -107,6 +108,24 @@ global:
cpu: 200m
memory: 1Gi
ephemeral-storage: 2Gi
jetstream:
version: latest
nodeSelector: {}
tolerations: []
affinity: {}
replicas: 3
maxPayload: "4MB"
containerTemplate:
resources:
limits:
cpu: 500m
memory: 4Gi
ephemeral-storage: 2Gi
requests:
cpu: 200m
memory: 1Gi
ephemeral-storage: 2Gi

# -- Configuration for external ArgoCD
# Should be used when `argo-cd.enabled` is set to false
external-argo-cd:
Expand Down