diff --git a/charts/webhooks-receiver/templates/deployment.yaml b/charts/webhooks-receiver/templates/deployment.yaml index 3c1bdde..8e5d8d3 100644 --- a/charts/webhooks-receiver/templates/deployment.yaml +++ b/charts/webhooks-receiver/templates/deployment.yaml @@ -1,3 +1,10 @@ +{{- $repeaterIDs := (or (and (hasKey .Values "global") (hasKey .Values.global "repeaterIDs") .Values.global.repeaterIDs) (list .Values.repeaterID)) }} +{{- $token := (or (and (hasKey .Values "global") (hasKey .Values.global "token") .Values.global.token) .Values.token) }} +{{- $cluster := (or (hasKey .Values "global") (hasKey .Values.global "cluster") .Values.global.cluster) .Values.cluster) }} +{{- $timeout := (or (hasKey .Values "global") (hasKey .Values.global "timeout") .Values.global.timeout) .Values.timeout "30000") }} +{{- $repeaterImageTag := (or (hasKey .Values "global") (hasKey .Values.global "repeaterImageTag") .Values.global.repeaterImageTag) .Values.repeaterImageTag "latest") }} + +--- apiVersion: apps/v1 kind: Deployment metadata: @@ -36,9 +43,10 @@ spec: port: 8080 scheme: HTTP - {{- if and .Values.repeaterID .Values.token .Values.cluster }} - - name: repeater - image: brightsec/cli{{ if .Values.repeaterImageTag }}:{{ .Values.repeaterImageTag }}{{ else }}:latest{{ end }} + {{- if and $token $cluster }} + {{- range $index, $repeaterID := $repeaterIDs }} + - name: repeater-{{ $index }} + image: brightsec/cli:{{ $repeaterImageTag }} command: ["bright-cli", "repeater"] args: - "--token=$(TOKEN)" @@ -52,11 +60,12 @@ spec: memory: 100Mi env: - name: REPEATER_ID - value: "{{ .Values.repeaterID }}" + value: "{{ $repeaterID }}" - name: TOKEN - value: "{{ .Values.token }}" + value: "{{ $token }}" - name: CLUSTER - value: "{{ .Values.cluster }}" + value: "{{ $cluster }}" - name: TIMEOUT - value: "{{ .Values.timeout | default "30000" }}" + value: "{{ $timeout }}" + {{- end }} {{- end }}