{{- if .Values.chartmuseum.enabled }}
apiVersion: v1
kind: Secret
metadata:
  name: {{ printf "%s-secret" (include "harbor.chartmuseum" .) }}
  namespace: {{ .Release.Namespace | quote }}
  labels: {{- include "common.labels.standard" . | nindent 4 }}
    {{- if .Values.commonLabels }}
    {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
    {{- end }}
    app.kubernetes.io/component: chartmuseum
  {{- if .Values.commonAnnotations }}
  annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
  {{- end }}
type: Opaque
data:
  {{- if .Values.chartmuseum.useRedisCache }}
  CACHE_REDIS_PASSWORD: {{ include "harbor.redis.rawPassword" . | b64enc | quote }}
  {{- end }}
  {{- if eq .Values.persistence.imageChartStorage.type "azure" }}
  AZURE_STORAGE_ACCESS_KEY: {{ .Values.persistence.imageChartStorage.azure.accountkey | b64enc | quote }}
  {{- else if eq .Values.persistence.imageChartStorage.type "gcs" }}
  GCS_KEY_DATA: {{ .Values.persistence.imageChartStorage.gcs.encodedkey | quote }}
  {{- else if eq .Values.persistence.imageChartStorage.type "s3" }}
  {{- if .Values.persistence.imageChartStorage.s3.secretkey }}
  AWS_SECRET_ACCESS_KEY: {{ .Values.persistence.imageChartStorage.s3.secretkey | b64enc | quote }}
  {{- end }}
  {{- else if eq .Values.persistence.imageChartStorage.type "swift" }}
  OS_PASSWORD: {{ .Values.persistence.imageChartStorage.swift.password | b64enc | quote }}
  {{- else if eq .Values.persistence.imageChartStorage.type "oss" }}
  ALIBABA_CLOUD_ACCESS_KEY_SECRET: {{ .Values.persistence.imageChartStorage.oss.accesskeysecret | b64enc | quote }}
  {{- end }}
{{- end }}
