{{- if not .Values.secret.existingSecret }}
apiVersion: v1
kind: Secret
metadata:
  name: {{ include "rustfs.secretName" . }}
  namespace: {{ .Release.Namespace }}
  labels:
    {{- toYaml .Values.commonLabels | nindent 4 }}
type: Opaque
data:
  RUSTFS_ACCESS_KEY: {{ .Values.secret.rustfs.access_key | b64enc | quote }}
  RUSTFS_SECRET_KEY: {{ .Values.secret.rustfs.secret_key | b64enc | quote }}
{{- end }}

---
{{- if .Values.imageRegistryCredentials.enabled }}
apiVersion: v1
kind: Secret
metadata:
  name: {{ include "rustfs.imagePullSecret.name" . }}
  namespace: {{ .Release.Namespace }}
  labels:
    {{- toYaml .Values.commonLabels | nindent 4 }}
type: kubernetes.io/dockerconfigjson
data:
  .dockerconfigjson: {{ template "imagePullSecret" . }}
{{- end }}
