apiVersion: v1
kind: Secret
metadata:
  name: {{ include "velero.fullname" . }}-cloud-credentials
  namespace: velero
  labels:
    {{- include "velero.labels" . | nindent 4 }}
type: Opaque
stringData:
  # Standard AWS-compatible credentials file for S3 compatibility
  cloud: |
    [default]
    aws_access_key_id = ${STORJ_ACCESS_KEY_ID}
    aws_secret_access_key = ${STORJ_SECRET_ACCESS_KEY}
    {{- range $key, $value := .Values.backupStorage.config }}
    {{ $key }} = {{ $value }}
    {{- end }}

  # Individual keys that can be referenced in environment variables
  storj_access_key_id: ${STORJ_ACCESS_KEY_ID}
  storj_secret_access_key: ${STORJ_SECRET_ACCESS_KEY}
  storj_access_grant: ${STORJ_ACCESS_GRANT}
