{{- with .Values.certs }}
{{- if and .server.key .server.crt .ca.crt }}
apiVersion: v1
kind: Secret
metadata:
  name: {{ include "falco.fullname" $ }}-certs
  namespace: {{ include "falco.namespace" $ }}
  labels:
    {{- include "falco.labels" $ | nindent 4 }}
type: Opaque
data:
  {{ $key := .server.key }}
  server.key: {{ $key | b64enc | quote }}
  {{ $crt := .server.crt }}
  server.crt: {{ $crt | b64enc | quote }}
  falco.pem: {{ print $key $crt | b64enc | quote }}
  ca.crt: {{ .ca.crt | b64enc | quote }}
{{- end }}
{{- end }}