jaas-secret.yaml 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. {{- if (include "kafka.createJaasSecret" .) }}
  2. apiVersion: v1
  3. kind: Secret
  4. metadata:
  5. name: {{ template "kafka.fullname" . }}-jaas
  6. labels: {{- include "common.labels.standard" . | nindent 4 }}
  7. {{- if .Values.commonLabels }}
  8. {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
  9. {{- end }}
  10. {{- if .Values.commonAnnotations }}
  11. annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
  12. {{- end }}
  13. type: Opaque
  14. data:
  15. {{- if (include "kafka.client.saslAuthentication" .) }}
  16. {{- $clientUsers := coalesce .Values.auth.sasl.jaas.clientUsers .Values.auth.jaas.clientUsers }}
  17. {{- $clientPasswords := coalesce .Values.auth.sasl.jaas.clientPasswords .Values.auth.jaas.clientPasswords }}
  18. {{- if $clientPasswords }}
  19. client-passwords: {{ join "," $clientPasswords | b64enc | quote }}
  20. {{- else }}
  21. {{- $passwords := list }}
  22. {{- range $clientUsers }}
  23. {{- $passwords = append $passwords (randAlphaNum 10) }}
  24. {{- end }}
  25. client-passwords: {{ join "," $passwords | b64enc | quote }}
  26. {{- end }}
  27. {{- end }}
  28. {{- $zookeeperUser := coalesce .Values.auth.sasl.jaas.zookeeperUser .Values.auth.jaas.zookeeperUser }}
  29. {{- if and .Values.zookeeper.auth.enabled $zookeeperUser }}
  30. {{- $zookeeperPassword := coalesce .Values.auth.sasl.jaas.zookeeperPassword .Values.auth.jaas.zookeeperPassword }}
  31. zookeeper-password: {{ default (randAlphaNum 10) $zookeeperPassword | b64enc | quote }}
  32. {{- end }}
  33. {{- if (include "kafka.interBroker.saslAuthentication" .) }}
  34. {{- $interBrokerPassword := coalesce .Values.auth.sasl.jaas.interBrokerPassword .Values.auth.jaas.interBrokerPassword }}
  35. inter-broker-password: {{ default (randAlphaNum 10) $interBrokerPassword | b64enc | quote }}
  36. {{- end }}
  37. {{- end }}