From 5b36c48ac4a6332a418e43e01f9d24c99f718d65 Mon Sep 17 00:00:00 2001 From: Jon Whitcraft Date: Mon, 17 Feb 2025 15:06:37 -0500 Subject: [PATCH] fix: ability to set an existing secret on the helm chart This allows for the sasl secret to be already set in a k8s secret and this allows it to not be pushed in vai a param Signed-off-by: Jon Whitcraft --- charts/kafka-exporter/Chart.yaml | 2 +- charts/kafka-exporter/templates/deployment.yaml | 9 ++++++++- charts/kafka-exporter/values.yaml | 1 + 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/charts/kafka-exporter/Chart.yaml b/charts/kafka-exporter/Chart.yaml index 518d8d0d..5f229d1b 100644 --- a/charts/kafka-exporter/Chart.yaml +++ b/charts/kafka-exporter/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v1 appVersion: "1.0" description: A Helm chart for Kubernetes name: kafka-exporter -version: 1.2.0 +version: 1.2.1 home: /~https://github.com/abhishekjiitr/kafka-exporter-helm maintainers: - name: abhishekjiitr diff --git a/charts/kafka-exporter/templates/deployment.yaml b/charts/kafka-exporter/templates/deployment.yaml index e2449a2d..b461fc7b 100644 --- a/charts/kafka-exporter/templates/deployment.yaml +++ b/charts/kafka-exporter/templates/deployment.yaml @@ -32,7 +32,7 @@ spec: "metrics": {{ .Values.datadog.metrics | toJson | nindent 16 -}} } ] - {{- end }} + {{- end }} labels: app.kubernetes.io/name: {{ include "kafka-exporter.name" . }} app.kubernetes.io/instance: {{ .Release.Name }} @@ -44,6 +44,11 @@ spec: - name: {{ .Chart.Name }} image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" imagePullPolicy: {{ .Values.image.pullPolicy }} + {{- if .Values.kafkaExporter.sasl.existingSecret }} + envFrom: + - secretRef: + name: {{ .Values.kafkaExporter.sasl.existingSecret }} + {{- else }} args: {{- if .Values.kafkaExporter}} {{- range .Values.kafkaExporter.kafka.servers }} @@ -59,7 +64,9 @@ spec: - --sasl.handshake=false {{- end }} - --sasl.username={{ .Values.kafkaExporter.sasl.username }} + {{- if eq .Values.kafkaExporter.sasl.existingSecret "" }} - --sasl.password={{ .Values.kafkaExporter.sasl.password }} + {{- end }} - --sasl.mechanism={{ .Values.kafkaExporter.sasl.mechanism }} {{- end }} {{- if .Values.kafkaExporter.tls.enabled}} diff --git a/charts/kafka-exporter/values.yaml b/charts/kafka-exporter/values.yaml index 2fc97147..0bea9f4c 100644 --- a/charts/kafka-exporter/values.yaml +++ b/charts/kafka-exporter/values.yaml @@ -27,6 +27,7 @@ kafkaExporter: handshake: true username: "" password: "" + existingSecret: "" # has the password stored in it. If set, will override password mechanism: "" tls: