{{- if and (.Values.agent.enabled) (not .Values.agent.tlsSecret) -}}
kind: Secret
apiVersion: v1
metadata:
  name: {{ template "kiam.fullname" . }}-agent
type: Opaque
data:
{{- if .Values.agent.tlsFiles.ca }}
{{ toYaml .Values.agent.tlsFiles | indent 2 }}
{{- else }}
{{ include "kiam.agent.gen-certs" . | indent 2 }}
{{- end -}}
{{- end }}
