{{- $kafkaProtocol := include "schema-registry.listenerType" ( dict "protocol" (ternary .Values.kafka.auth.clientProtocol .Values.externalKafka.auth.protocol .Values.kafka.enabled) ) -}}
{{- if and (not .Values.kafka.enabled) (contains "SASL" $kafkaProtocol) }}
apiVersion: v1
kind: Secret
metadata:
  name: {{ printf "%s-external-kafka" (include "common.names.fullname" .) }}
  namespace: {{ include "common.names.namespace" . | quote }}
  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:
    {{- if .Values.commonAnnotations }}
    {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
    {{- end }}
  {{- end }}
type: Opaque
data:
  client-passwords: {{ include "common.secrets.passwords.manage" (dict "secret" (include "common.names.fullname" .) "key" "client-password" "providedValues" (list "externalKafka.auth.jaas.password" ) "context" $) }}
{{- end }}
