{{- if (include "kafka.createJaasSecret" .) }}
apiVersion: v1
kind: Secret
metadata:
  name: {{ template "kafka.fullname" . }}-jaas
  labels: {{- include "kafka.labels" . | nindent 4 }}
type: Opaque
data:
  {{- if (include "kafka.client.saslAuthentication" .) }}
  client-password: {{ ternary (randAlphaNum 10) .Values.auth.jaas.clientPassword (empty .Values.auth.jaas.clientPassword) | b64enc | quote }}
  {{- end }}
  {{- if .Values.auth.jaas.zookeeperUser }}
  zookeeper-password: {{ ternary (randAlphaNum 10) .Values.auth.jaas.zookeeperPassword (empty .Values.auth.jaas.zookeeperPassword) | b64enc | quote }}
  {{- end }}
  {{- if (include "kafka.interBroker.saslAuthentication" .) }}
  inter-broker-password: {{ ternary (randAlphaNum 10) .Values.auth.jaas.interBrokerPassword (empty .Values.auth.jaas.interBrokerPassword) | b64enc | quote }}
  {{- end }}
{{- end }}
