Skip to content

Commit 74e441a

Browse files
author
Aleksandr Orekhov
committed
Add extra command flags for helper template
1 parent 5ac2d0d commit 74e441a

File tree

1 file changed

+22
-6
lines changed

1 file changed

+22
-6
lines changed

charts/ingress-nginx/templates/_helpers.tpl

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ Create the name of the controller service account to use
275275
image: "{{ .Values.controller.wallarm.helpers.image }}:{{ .Values.controller.wallarm.helpers.tag }}"
276276
{{- end }}
277277
imagePullPolicy: "{{ .Values.controller.image.pullPolicy }}"
278-
args: ["wcli", "run", {{ include "ingress-nginx.wcli-args" . }}]
278+
args: ["wcli", "run", {{ include "ingress-nginx.wcli-args" . | trimSuffix ", " | replace "\n" "" }}]
279279
env:
280280
{{- include "wallarm.credentials" . | nindent 2 }}
281281
- name: WALLARM_NODE_NAME
@@ -487,14 +487,30 @@ Extra modules.
487487
mountPath: /modules_mount
488488
{{- end -}}
489489

490+
{{/*
491+
Convert camelCase to kebab‑case
492+
*/}}
493+
{{- define "wallarm.kebabcase" -}}
494+
{{- regexReplaceAll "([a-z0-9])([A-Z])" . "${1}-${2}" | lower -}}
495+
{{- end }}
496+
490497
{{/*
491498
Wcli arguments building
492499
*/}}
493500
{{- define "ingress-nginx.wcli-args" -}}
494501
"-log-level", "{{ .Values.controller.wallarm.wcli.logLevel }}",{{ " " }}
495-
{{- with .Values.controller.wallarm.wcli.commands -}}
496-
{{- range $name, $value := . -}}
497-
"job:{{ $name }}", "-log-level", "{{ $value.logLevel }}",{{ " " }}
498-
{{- end -}}
499-
{{- end -}}
502+
{{- with .Values.controller.wallarm.wcli.commands }}
503+
{{- range $jobName, $jobCfg := . }}
504+
"job:{{ $jobName }}",{{ " " }}
505+
{{- range $key, $val := $jobCfg }}
506+
{{- $flag := include "wallarm.kebabcase" $key -}}
507+
{{- if eq $flag "tarantool-throttle-options" }}
508+
"-{{ $flag }}", {{ $val | toJson | quote }},{{ " " }}
509+
{{- else if ne $flag "log-level" }}
510+
"-{{ $flag }}", {{ $val | quote }},{{ " " }}
511+
{{- end }}
512+
{{- end }}
513+
"-log-level", "{{ $jobCfg.logLevel | default $.Values.controller.wallarm.wcli.logLevel }}",{{ " " }}
514+
{{- end }}
515+
{{- end }}
500516
{{- end -}}

0 commit comments

Comments
 (0)