dragonflydb / dragonfly-operator

A Kubernetes operator to install and manage Dragonfly instances.
https://www.dragonflydb.io/docs/managing-dragonfly/operator/installation
Apache License 2.0
144 stars 34 forks source link

How to snapshot to s3? #240

Closed jonathon2nd closed 2 months ago

jonathon2nd commented 2 months ago

Hello!

I am reviewing the guide for s3, and wondering how I can setup s3 for non-aws, such as wasabi?

jonathon2nd commented 2 months ago

NVM, I figured it out. Posting here if it helps anyone.

apiVersion: dragonflydb.io/v1alpha1
kind: Dragonfly
metadata:
  name: api-cache
  namespace: api-cache
  resourceVersion: '843691383'
  uid: f4a7c374-6c0c-44d7-9cc4-a29425d25006
spec:
  args:
    - '--s3_endpoint=s3.ca-central-1.wasabisys.com/'
  authentication:
    passwordFromSecret:
      key: password
      name: db-password
      optional: false
  env:
    - name: AWS_ACCESS_KEY_ID
      valueFrom:
        secretKeyRef:
          key: awsAccessKeyId
          name: wasabi-credentials
    - name: AWS_SECRET_ACCESS_KEY
      valueFrom:
        secretKeyRef:
          key: awsSecretAccessKey
          name: wasabi-credentials
    - name: AWS_REGION
      value: ca-central-1
    - name: AWS_BUCKET_NAME
      value: preprod-dragonfly-operator
  image: docker.dragonflydb.io/dragonflydb/dragonfly:v1.22.0
  replicas: 3
  resources:
    limits: {}
    requests:
      cpu: 250m
      memory: 250Mi
  snapshot:
    cron: '*/5 * * * *'
    dir: s3://preprod-dragonfly-operator/api-cache/dragonfly/snapshots
    persistentVolumeClaimSpec:
      accessModes:
        - ReadWriteOnce
      resources:
        requests:
          storage: 10Gi
      storageClassName: linstor-replica-one-local
status:
  phase: ready
Pothulapati commented 2 months ago

@jonathon2nd Glad that you figured it out!

We also have a document to do it with workload identity: https://www.dragonflydb.io/docs/managing-dragonfly/operator/snapshot-s3