3scale-ops / saas-operator

3scale SaaS Operator - www.3scale.net
Apache License 2.0
8 stars 2 forks source link

Redis backups #269

Closed roivaz closed 1 year ago

roivaz commented 1 year ago

This PR adds the redis backups to the saas-operator as a new api with a new controller. An example of the custom resource with the status:

apiVersion: saas.3scale.net/v1alpha1
kind: ShardedRedisBackup
metadata:
  finalizers:
    - saas.3scale.net
  name: backup
  namespace: default
spec:
  dbFile: /data/dump.rdb
  historyLimit: 2
  pause: false
  pollInterval: 10s
  s3Options:
    bucket: my-bucket
    credentialsSecretRef:
      name: aws-credentials
    path: backups
    region: us-east-1
    serviceEndpoint: http://minio.default.svc.cluster.local:9000
  schedule: '* * * * *'
  sentinelRef: sentinel
  sshOptions:
    port: 2222
    privateKeySecretRef:
      name: redis-backup-ssh-private-key
    sudo: true
    user: docker
  timeout: 5m0s
status:
  backups:
    - message: backup scheduled
      scheduledFor: "2023-09-20T08:33:00Z"
      shard: shard02
      state: Pending
    - message: backup scheduled
      scheduledFor: "2023-09-20T08:33:00Z"
      shard: shard01
      state: Pending
    - backupFile: s3://my-bucket/backups/redis-backup_shard02_2023-09-20T08:32:01Z.rdb.gz
      backupSize: 234
      finishedAt: "2023-09-20T08:32:12Z"
      message: backup complete
      scheduledFor: "2023-09-20T08:32:00Z"
      serverAlias: redis-shard-shard02-1
      serverID: 10.244.0.11:6379
      shard: shard02
      startedAt: "2023-09-20T08:32:01Z"
      state: Completed
    - backupFile: s3://my-bucket/backups/redis-backup_shard01_2023-09-20T08:32:01Z.rdb.gz
      backupSize: 232
      finishedAt: "2023-09-20T08:32:12Z"
      message: backup complete
      scheduledFor: "2023-09-20T08:32:00Z"
      serverAlias: redis-shard-shard01-1
      serverID: 10.244.0.8:6379
      shard: shard01
      startedAt: "2023-09-20T08:32:01Z"
      state: Completed

Features:

Limitations:

/kind feature /priority important-soon /assign

roivaz commented 1 year ago

/retitle Redis backups

roivaz commented 1 year ago

@slopezz @raelga the PR is now ready for review

roivaz commented 1 year ago

@slopezz @raelga final commits to fix some bugs are in place and tested in staging env:

3scale-robot commented 1 year ago

LGTM label has been added.

Git tree hash: 69390d9c0adb6672aa8847e235d4caddd6c565e6

slopezz commented 1 year ago

/approve

3scale-robot commented 1 year ago

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: slopezz

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files: - ~~[OWNERS](https://github.com/3scale-ops/saas-operator/blob/main/OWNERS)~~ [slopezz] Approvers can indicate their approval by writing `/approve` in a comment Approvers can cancel approval by writing `/approve cancel` in a comment
roivaz commented 1 year ago

Related to https://github.com/3scale/platform/issues/868