{{- if .Values.secret.create -}}
apiVersion: v1
kind: Secret
metadata:
  name: {{ template "splunk-kubernetes-metrics.secret" . }}
  labels:
    app: {{ template "splunk-kubernetes-metrics.name" . }}
    chart: {{ template "splunk-kubernetes-metrics.chart" . }}
    release: {{ .Release.Name }}
    heritage: {{ .Release.Service }}
type: Opaque
data:
  {{- with or .Values.splunk.hec.token .Values.global.splunk.hec.token }}
  splunk_hec_token: {{ . | b64enc }}
  {{- end }}
  {{- with or .Values.splunk.hec.clientCert .Values.global.splunk.hec.clientCert }}
  hec_client_cert: {{ . | b64enc }}
  {{- end }}
  {{- with or .Values.splunk.hec.clientKey .Values.global.splunk.hec.clientKey }}
  hec_client_key: {{ . | b64enc }}
  {{- end }}
  {{- with or .Values.splunk.hec.caFile .Values.global.splunk.hec.caFile }}
  hec_ca_file: {{ . | b64enc }}
  {{- end }}
{{- end -}}
