Skip to content

Commit cc76639

Browse files
committed
fixed eventbus name across sensors and eventsources
1 parent 9b5ed30 commit cc76639

File tree

7 files changed

+20
-8
lines changed

7 files changed

+20
-8
lines changed

charts/gitops-runtime/templates/_components/event-reporters/rollout-reporter/_event-source.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ metadata:
77
{{- include "event-reporters.rollout-reporter.labels" . | nindent 4}}
88
spec:
99
replicas: {{ .Values.rollout.eventSource.replicas }}
10-
eventBusName: {{ default "codefresh-eventbus" .Values.global.runtime.eventBus.name }}
10+
eventBusName: {{ include "codefresh-gitops-runtime.eventbus.name" .Values.global.runtime.eventBus }}
1111
resource:
1212
analysisruns:
1313
eventTypes:

charts/gitops-runtime/templates/_components/event-reporters/rollout-reporter/_sensor.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ spec:
1717
- name: analysisruns
1818
eventSourceName: rollout-reporter
1919
eventName: analysisruns
20-
eventBusName: {{ default "codefresh-eventbus" .Values.global.runtime.eventBus.name }}
20+
eventBusName: {{ include "codefresh-gitops-runtime.eventbus.name" .Values.global.runtime.eventBus }}
2121
template:
2222
serviceAccountName: {{ include "event-reporters.rollout-reporter.serviceAccountName" .}}
2323
container:

charts/gitops-runtime/templates/_components/event-reporters/workflow-reporter/_event-source.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ metadata:
77
{{- include "event-reporters.workflow-reporter.labels" . | nindent 4 }}
88
spec:
99
replicas: {{ .Values.workflow.eventSource.replicas }}
10-
eventBusName: {{ default "codefresh-eventbus" .Values.global.runtime.eventBus.name }}
10+
eventBusName: {{ include "codefresh-gitops-runtime.eventbus.name" .Values.global.runtime.eventBus }}
1111
resource:
1212
workflows:
1313
eventTypes:

charts/gitops-runtime/templates/_components/event-reporters/workflow-reporter/_sensor.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ spec:
1111
- eventName: workflows
1212
eventSourceName: workflow-reporter
1313
name: workflows
14-
eventBusName: {{ default "codefresh-eventbus" .Values.global.runtime.eventBus.name }}
14+
eventBusName: {{ include "codefresh-gitops-runtime.eventbus.name" .Values.global.runtime.eventBus }}
1515
template:
1616
serviceAccountName: {{ include "event-reporters.workflow-reporter.serviceAccountName" .}}
1717
container:

charts/gitops-runtime/templates/_helpers.tpl

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -522,3 +522,17 @@ HTTPS_PROXY: {{ .Values.global.httpsProxy }}
522522
NO_PROXY: {{ .Values.global.noProxy }}
523523
{{- end }}
524524
{{- end -}}
525+
526+
{{- define "codefresh-gitops-runtime.eventbus.name" }}
527+
{{- $eventBusName := "" }}
528+
{{- $eventBusType := .type }}
529+
{{- if eq $eventBusType "nats" }}
530+
{{- $eventBusName = default "codefresh-eventbus" .name }}
531+
{{- else if eq $eventBusType "jetstream" }}
532+
{{- $eventBusName = default "codefresh-eventbus-jetstream" .name }}
533+
{{- else }}
534+
{{- fail (printf "ERROR: EventBus type %s is inavlid, must be nats|jetstream" $eventBusType ) }}
535+
{{- end }}
536+
537+
{{- printf "%s" $eventBusName }}
538+
{{- end }}

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{{- $eventBusName := .Values.global.runtime.eventBus.name }}
1+
{{- $eventBusName := (include "codefresh-gitops-runtime.eventbus.name" .Values.global.runtime.eventBus) }}
22
{{- $eventBusSpec := .Values.global.runtime.eventBus }}
33
{{- $eventBusType := .Values.global.runtime.eventBus.type }}
44
{{/* Remove name from eventbus spec */}}
@@ -16,14 +16,12 @@
1616

1717
{{- if eq $eventBusType "nats" }}
1818
{{- $eventBusSpec = unset $eventBusSpec "jetstream" }}
19-
{{- $eventBusName = default "codefresh-eventbus" $eventBusName }}
2019
{{- $_ := set $eventBusSpec.nats.native "nodeSelector" ($eventBusSpec.nats.native.nodeSelector | default .Values.global.nodeSelector) }}
2120
{{- $_ := set $eventBusSpec.nats.native "tolerations" ($eventBusSpec.nats.native.tolerations | default .Values.global.tolerations) }}
2221
{{- end }}
2322

2423
{{- if eq $eventBusType "jetstream" }}
2524
{{- $eventBusSpec = unset $eventBusSpec "nats" }}
26-
{{- $eventBusName = default "codefresh-eventbus-jetstream" $eventBusName }}
2725
{{- $_ := set $eventBusSpec.jetstream "nodeSelector" ($eventBusSpec.jetstream.nodeSelector | default .Values.global.nodeSelector) }}
2826
{{- $_ := set $eventBusSpec.jetstream "tolerations" ($eventBusSpec.jetstream.tolerations | default .Values.global.tolerations) }}
2927
{{- end }}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{{- $eventBusName := default "codefresh-eventbus" .Values.global.runtime.eventBus.name }}
1+
{{- $eventBusName := (include "codefresh-gitops-runtime.eventbus.name" .Values.global.runtime.eventBus) }}
22
{{- if .Values.global.runtime.eventBus.pdb.enabled }}
33
apiVersion: policy/v1
44
kind: PodDisruptionBudget

0 commit comments

Comments
 (0)