Kubernetes instance backups using Dragonfly Operator

How are you handling snapshots + backups? I currently have snapshots to PVC enabled with cron of every 5 minutes or so, which ensures persistence, however I would also like to do a daily backups to S3 or something. If I understand correctly, the CRD only allows you to configure snapshots to PVC or S3 - not both. Plus it would also have to be a different cron expression for the S3 one.. Looking for some ideas on how are you handling requirements such as these.

It is not possible to define more than one snapshot schedule to the Operator. Because Dragonfly doesn’t support multiple snapshot schedules. However, you can have a hack to acheive this. You can have a small sidecar application that has its own cron schedule and that takes the latest snapshot from the volume and push it to s3.

  apiVersion: dragonflydb.io/v1alpha1
  kind: Dragonfly
  metadata:
    name: dragonfly-db-1
    namespace: dragonfly-databases
  spec:
    replicas: 2
    snapshot:
      cron: "*/5 * * * *"
      persistentVolumeClaimSpec:
        accessModes: [ReadWriteOnce]
        resources:
          requests:
            storage: 20Gi
    additionalContainers:
      - name: s3-archiver
        image: amazon/aws-cli:latest
        command: ["/bin/sh", "-c"]
        args:
          - echo "" # your script
        env:
          - name: AWS_REGION
            value: ca-central-1
          - name: AWS_ACCESS_KEY_ID
            valueFrom:
              secretKeyRef:
                name: s3-backup-creds
                key: access_key
          - name: AWS_SECRET_ACCESS_KEY
            valueFrom:
              secretKeyRef:
                name: s3-backup-creds
                key: secret_key
        volumeMounts:
          - name: df                       # same volume Dragonfly writes to
            mountPath: /dragonfly/snapshots
            readOnly: true