{{/* vim: set filetype=mustache: */}} {{/* annotations */}} {{- define "prometheus-fail2ban-exporter.daemonSet.annotations" -}} {{ include "prometheus-fail2ban-exporter.annotations" . }} {{- if .Values.daemonSet.annotations }} {{ toYaml .Values.daemonSet.annotations }} {{- end }} {{- end }} {{/* env */}} {{- define "prometheus-fail2ban-exporter.daemonSet.env" -}} {{- $env := dict "env" (.Values.daemonSet.fail2banExporter.env | default (list) ) }} {{- if and (hasKey .Values.daemonSet.fail2banExporter.resources "limits") (hasKey .Values.daemonSet.fail2banExporter.resources.limits "cpu") }} {{- $env = merge $env (dict "env" (list (dict "name" "GOMAXPROCS" "valueFrom" (dict "resourceFieldRef" (dict "divisor" "1" "resource" "limits.cpu"))))) }} {{- end }} {{ toYaml $env }} {{- end -}} {{/* image */}} {{- define "prometheus-fail2ban-exporter.daemonSet.images.fail2ban-exporter.fqin" -}} {{- $registry := .Values.daemonSet.fail2banExporter.image.registry -}} {{- $repository := .Values.daemonSet.fail2banExporter.image.repository -}} {{- $tag := default .Chart.AppVersion .Values.daemonSet.fail2banExporter.image.tag -}} {{- printf "%s/%s:%s" $registry $repository $tag -}} {{- end -}} {{/* labels */}} {{- define "prometheus-fail2ban-exporter.daemonSet.labels" -}} {{ include "prometheus-fail2ban-exporter.labels" . }} {{- if .Values.daemonSet.labels }} {{ toYaml .Values.daemonSet.labels }} {{- end }} {{- end }} {{/* serviceAccount */}} {{- define "prometheus-fail2ban-exporter.daemonSet.serviceAccount" -}} {{- if .Values.serviceAccount.existing.enabled -}} {{- printf "%s" .Values.serviceAccount.existing.serviceAccountName -}} {{- else -}} {{- include "prometheus-fail2ban-exporter.fullname" . -}} {{- end -}} {{- end }} {{/* volumeMounts */}} {{- define "prometheus-fail2ban-exporter.daemonSet.volumeMounts" -}} {{- $volumeMounts := .Values.daemonSet.fail2banExporter.volumeMounts | default list }} {{- $volumeMounts = concat $volumeMounts (list (dict "name" "config-d" "mountPath" "/etc/prometheus-fail2ban-exporter/config.d" )) }} {{ toYaml (dict "volumeMounts" $volumeMounts) }} {{- end -}} {{/* volumes */}} {{- define "prometheus-fail2ban-exporter.daemonSet.volumes" -}} {{- $volumes := .Values.daemonSet.volumes | default list }} {{- $webConfigSecretName := .Values.config.webConfig.existingSecret.secretName -}} {{- if not .Values.config.webConfig.existingSecret.enabled }} {{- $webConfigSecretName = printf "%s-web-config" (include "prometheus-fail2ban-exporter.fullname" . ) }} {{- end }} {{- $volumes = concat $volumes (list (dict "name" "config-d" "secret" (dict "secretName" $webConfigSecretName))) }} {{ toYaml (dict "volumes" $volumes) }} {{- end -}}