{{- if and ( not .Values.existingSecrets) (.Values.secrets) }}
apiVersion: v1
kind: Secret
metadata:
  name: {{ template "akhq.fullname" . }}-secrets
  labels:
    app.kubernetes.io/name: {{ include "akhq.name" . }}
    helm.sh/chart: {{ include "akhq.chart" . }}
    app.kubernetes.io/instance: {{ .Release.Name }}
    app.kubernetes.io/managed-by: {{ .Release.Service }}
type: Opaque
data:
  application-secrets.yml: {{ toYaml .Values.secrets | b64enc | quote }}
  {{- if .Values.kafkaSecrets }}
  {{- range $key, $value := .Values.kafkaSecrets }}
  {{ $key }}: {{ $value | quote }}
  {{- end }}
  {{- end }}
  {{- end }}
