{{- if and (.Values.tls.enabled) (.Values.tls.cert) (.Values.tls.key) (not .Values.tls.existing_secret) }}
apiVersion: v1
kind: Secret
metadata:
  name: {{ include "dragonfly.fullname" . }}-tls
  namespace: {{ .Release.Namespace }}
  labels:
    {{- include "dragonfly.labels" . | nindent 4 }}
type: kubernetes.io/tls
data:
  tls.crt: {{ default "" .Values.tls.cert | b64enc | quote }}
  tls.key: {{ default "" .Values.tls.key | b64enc | quote }}
{{- end }}
