Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Schedule purges on clusters that have Medusa configured #1154

Closed
2 tasks
adejanovski opened this issue Jan 5, 2024 · 0 comments · Fixed by #1167
Closed
2 tasks

Schedule purges on clusters that have Medusa configured #1154

adejanovski opened this issue Jan 5, 2024 · 0 comments · Fixed by #1167
Assignees
Labels
done Issues in the state 'done'

Comments

@adejanovski
Copy link
Contributor

adejanovski commented Jan 5, 2024

Each cluster with Medusa enabled should have purges scheduled automatically once per day.
This can be done by creating a CronJob which will create a MedusaTask for a purge operation. The CronJobs should be created by the K8ssandraCluster controller and use a finalizer for cleanup as such resources may live in the dataplanes. The MedusaTask resources need to be in the same cluster and namespace as the datacenter they relate to.

Here's a base for the CronJob spec:

spec:
  schedule: 0 0 * * *
  suspend: false
  jobTemplate:
    spec:
      template:
        metadata:
          name: k8ssandra-purge-backups
        spec:
          containers:
            - name: medusa-purge-cronjob
              image: bitnami/kubectl:1.17.3
              command:
                - bin/bash
                - '-c'
                - >-
                  printf "apiVersion: medusa.k8ssandra.io/v1alpha1\nkind:
                  MedusaTask\nmetadata:\n  name: purge-backups-timestamp\n 
                  namespace: k8ssandra-operator\nspec:\n  cassandraDatacenter:
                  dc2\n  operation: purge" | sed "s/timestamp/$(date
                  +%Y%m%d%H%M%S)/g" | kubectl apply -f -
              resources: {}
              terminationMessagePath: /dev/termination-log
              terminationMessagePolicy: File
              imagePullPolicy: IfNotPresent
          restartPolicy: OnFailure
          terminationGracePeriodSeconds: 30
          dnsPolicy: ClusterFirst
          schedulerName: default-scheduler
  successfulJobsHistoryLimit: 3
  failedJobsHistoryLimit: 1

Definition of Done

@adejanovski adejanovski added the ready Issues in the state 'ready' label Jan 5, 2024
@emerkle826 emerkle826 self-assigned this Jan 8, 2024
@adejanovski adejanovski added in-progress Issues in the state 'in-progress' and removed ready Issues in the state 'ready' labels Jan 8, 2024
@adejanovski adejanovski added ready-for-review Issues in the state 'ready-for-review' and removed in-progress Issues in the state 'in-progress' labels Jan 17, 2024
@olim7t olim7t self-assigned this Jan 18, 2024
@adejanovski adejanovski added review Issues in the state 'review' and removed ready-for-review Issues in the state 'ready-for-review' labels Jan 18, 2024
@adejanovski adejanovski added done Issues in the state 'done' and removed review Issues in the state 'review' labels Jan 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
done Issues in the state 'done'
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants