12345678910111213141516171819202122232425262728293031323334353637 |
- {{- if (include "kafka.createJaasSecret" .) }}
- apiVersion: v1
- kind: Secret
- metadata:
- name: {{ template "kafka.fullname" . }}-jaas
- labels: {{- include "common.labels.standard" . | nindent 4 }}
- {{- if .Values.commonLabels }}
- {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
- {{- end }}
- {{- if .Values.commonAnnotations }}
- annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
- {{- end }}
- type: Opaque
- data:
- {{- if (include "kafka.client.saslAuthentication" .) }}
- {{- $clientUsers := coalesce .Values.auth.sasl.jaas.clientUsers .Values.auth.jaas.clientUsers }}
- {{- $clientPasswords := coalesce .Values.auth.sasl.jaas.clientPasswords .Values.auth.jaas.clientPasswords }}
- {{- if $clientPasswords }}
- client-passwords: {{ join "," $clientPasswords | b64enc | quote }}
- {{- else }}
- {{- $passwords := list }}
- {{- range $clientUsers }}
- {{- $passwords = append $passwords (randAlphaNum 10) }}
- {{- end }}
- client-passwords: {{ join "," $passwords | b64enc | quote }}
- {{- end }}
- {{- end }}
- {{- $zookeeperUser := coalesce .Values.auth.sasl.jaas.zookeeperUser .Values.auth.jaas.zookeeperUser }}
- {{- if and .Values.zookeeper.auth.enabled $zookeeperUser }}
- {{- $zookeeperPassword := coalesce .Values.auth.sasl.jaas.zookeeperPassword .Values.auth.jaas.zookeeperPassword }}
- zookeeper-password: {{ default (randAlphaNum 10) $zookeeperPassword | b64enc | quote }}
- {{- end }}
- {{- if (include "kafka.interBroker.saslAuthentication" .) }}
- {{- $interBrokerPassword := coalesce .Values.auth.sasl.jaas.interBrokerPassword .Values.auth.jaas.interBrokerPassword }}
- inter-broker-password: {{ default (randAlphaNum 10) $interBrokerPassword | b64enc | quote }}
- {{- end }}
- {{- end }}
|