Skip to content

Commit b99cd7d

Browse files
committed
Add repeaters to webhooks-receiver
1 parent f61c978 commit b99cd7d

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

charts/webhooks-receiver/templates/deployment.yaml

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
{{- $repeaterIDs := (or (and (hasKey .Values "global") (hasKey .Values.global "repeaterIDs") .Values.global.repeaterIDs) (list .Values.repeaterID)) }}
2+
{{- $token := (or (and (hasKey .Values "global") (hasKey .Values.global "token") .Values.global.token) .Values.token) }}
3+
{{- $cluster := (or (hasKey .Values "global") (hasKey .Values.global "cluster") .Values.global.cluster) .Values.cluster) }}
4+
{{- $timeout := (or (hasKey .Values "global") (hasKey .Values.global "timeout") .Values.global.timeout) .Values.timeout "30000") }}
5+
{{- $repeaterImageTag := (or (hasKey .Values "global") (hasKey .Values.global "repeaterImageTag") .Values.global.repeaterImageTag) .Values.repeaterImageTag "latest") }}
6+
7+
---
18
apiVersion: apps/v1
29
kind: Deployment
310
metadata:
@@ -36,9 +43,10 @@ spec:
3643
port: 8080
3744
scheme: HTTP
3845

39-
{{- if and .Values.repeaterID .Values.token .Values.cluster }}
40-
- name: repeater
41-
image: brightsec/cli{{ if .Values.repeaterImageTag }}:{{ .Values.repeaterImageTag }}{{ else }}:latest{{ end }}
46+
{{- if and $token $cluster }}
47+
{{- range $index, $repeaterID := $repeaterIDs }}
48+
- name: repeater-{{ $index }}
49+
image: brightsec/cli:{{ $repeaterImageTag }}
4250
command: ["bright-cli", "repeater"]
4351
args:
4452
- "--token=$(TOKEN)"
@@ -52,11 +60,12 @@ spec:
5260
memory: 100Mi
5361
env:
5462
- name: REPEATER_ID
55-
value: "{{ .Values.repeaterID }}"
63+
value: "{{ $repeaterID }}"
5664
- name: TOKEN
57-
value: "{{ .Values.token }}"
65+
value: "{{ $token }}"
5866
- name: CLUSTER
59-
value: "{{ .Values.cluster }}"
67+
value: "{{ $cluster }}"
6068
- name: TIMEOUT
61-
value: "{{ .Values.timeout | default "30000" }}"
69+
value: "{{ $timeout }}"
70+
{{- end }}
6271
{{- end }}

0 commit comments

Comments
 (0)