From fb602763b0674851dfbed032bf26776b087168f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anatol=20Karalko=C5=AD?= Date: Tue, 11 Feb 2025 17:08:16 +0100 Subject: [PATCH] Add repeaters to sqli --- charts/sqli/templates/deployment.yaml | 31 +++++++++++++++++---------- charts/sqli/templates/ingress.yaml | 3 ++- 2 files changed, 22 insertions(+), 12 deletions(-) diff --git a/charts/sqli/templates/deployment.yaml b/charts/sqli/templates/deployment.yaml index 5dd0eab..be24713 100644 --- a/charts/sqli/templates/deployment.yaml +++ b/charts/sqli/templates/deployment.yaml @@ -1,3 +1,9 @@ +{{- $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 (and (hasKey .Values "global") (hasKey .Values.global "cluster") .Values.global.cluster) .Values.cluster) }} +{{- $timeout := (or (and (hasKey .Values "global") (hasKey .Values.global "timeout") .Values.global.timeout) .Values.timeout "30000") }} +{{- $repeaterImageTag := (or (and (hasKey .Values "global") (hasKey .Values.global "repeaterImageTag") .Values.global.repeaterImageTag) .Values.repeaterImageTag "latest") }} + --- apiVersion: apps/v1 kind: Deployment @@ -113,28 +119,31 @@ spec: # command: ["sh", "-c", "curl -k -s http://sqli/Less-1/?id=12"] # initialDelaySeconds: 120 # periodSeconds: 60 - {{- if and .Values.repeaterID .Values.token .Values.cluster }} - - name: repeater - image: brightsec/cli{{ if ne .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)" - - "--id=$(REPEATER_ID)" - - "--cluster=$(CLUSTER)" - - "--timeout=$(TIMEOUT)" + - "--token=$(TOKEN)" + - "--id=$(REPEATER_ID)" + - "--cluster=$(CLUSTER)" + - "--timeout=$(TIMEOUT)" + - "--log-level=verbose" resources: requests: cpu: 200m 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 }} restartPolicy: Always diff --git a/charts/sqli/templates/ingress.yaml b/charts/sqli/templates/ingress.yaml index 5afc7fa..f5bd742 100644 --- a/charts/sqli/templates/ingress.yaml +++ b/charts/sqli/templates/ingress.yaml @@ -1,4 +1,5 @@ -{{- if not (and .Values.repeaterID .Values.token .Values.cluster) }} +{{- $repeaterIDs := (or (and (hasKey .Values "global") (hasKey .Values.global "repeaterIDs") .Values.global.repeaterIDs) (list .Values.repeaterID)) }} +{{- if eq (len $repeaterIDs) 0 }} --- apiVersion: networking.k8s.io/v1 kind: Ingress