Skip to content

Commit

Permalink
fix: ability to set an existing secret on the helm chart
Browse files Browse the repository at this point in the history
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 <jwhitcraft@mac.com>
  • Loading branch information
jwhitcraft committed Feb 17, 2025
1 parent 8ec2407 commit 5b36c48
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion charts/kafka-exporter/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 8 additions & 1 deletion charts/kafka-exporter/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand All @@ -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 }}
Expand All @@ -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}}
Expand Down
1 change: 1 addition & 0 deletions charts/kafka-exporter/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ kafkaExporter:
handshake: true
username: ""
password: ""
existingSecret: "" # has the password stored in it. If set, will override password
mechanism: ""

tls:
Expand Down

0 comments on commit 5b36c48

Please sign in to comment.