{{- /*
Copyright Broadcom, Inc. All Rights Reserved.
SPDX-License-Identifier: APACHE-2.0
*/}}

{{- if include "influxdb.store.secret.create" . }}
apiVersion: v1
kind: Secret
metadata:
  name: {{ template "influxdb.store.secret.name" . }}
  namespace: {{ include "common.names.namespace" . | quote }}
  labels: {{- include "common.labels.standard" (dict "customLabels" .Values.commonLabels "context" .) | nindent 4 }}
    app.kubernetes.io/part-of: influxdb
    app.kubernetes.io/component: influxdb
  {{- if .Values.commonAnnotations }}
  annotations: {{- include "common.tplvalues.render" (dict "value" .Values.commonAnnotations "context" .) | nindent 4 }}
  {{- end }}
type: Opaque
data:
  {{- if eq .Values.objectStore "s3" }}
  s3-access-key-id: {{ .Values.s3.auth.accessKeyId | b64enc | quote }}
  s3-secret-access-key: {{ .Values.s3.auth.secretAccessKey | b64enc | quote }}
  {{- else if eq .Values.objectStore "google" }}
  google-service-account-key: {{ .Values.google.auth.serviceAccountKey | b64enc | quote }}
  {{- else if eq .Values.objectStore "azure" }}
  azure-storage-access-key: {{ .Values.azure.auth.accessKey | b64enc | quote }}
  {{- end }}
{{- end }}
