diff --git a/clusters/base/infra/longhorn/recurring-jobs/kustomization.yaml b/clusters/base/infra/longhorn/recurring-jobs/kustomization.yaml new file mode 100644 index 0000000..8a55bfe --- /dev/null +++ b/clusters/base/infra/longhorn/recurring-jobs/kustomization.yaml @@ -0,0 +1,4 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +resources: + - recurringjob-backup.yaml diff --git a/clusters/base/infra/longhorn/recurring-jobs/recurringjob-backup.yaml b/clusters/base/infra/longhorn/recurring-jobs/recurringjob-backup.yaml new file mode 100644 index 0000000..ad355b5 --- /dev/null +++ b/clusters/base/infra/longhorn/recurring-jobs/recurringjob-backup.yaml @@ -0,0 +1,21 @@ +apiVersion: longhorn.io/v1beta2 +kind: RecurringJob +metadata: + name: backup + namespace: longhorn-system +spec: + task: "backup" + cron: "0 3 * * *" + retain: 7 + concurrency: 2 + # "default" is a special group name: Longhorn auto-applies it to every + # volume that has NO recurring-job label at all - i.e. opt-out. To + # exclude a specific volume, give it any other (job-less) group label, + # e.g.: + # recurring-job-group.longhorn.io/no-backup: enabled + # (having *any* recurring-job label disqualifies it from "default" - + # there's no dedicated "disabled" flag, this placeholder-group is the + # documented workaround) + groups: + - default + labels: {} diff --git a/clusters/home/infra/kustomization.yaml b/clusters/home/infra/kustomization.yaml index 4a66715..eb7d9fd 100644 --- a/clusters/home/infra/kustomization.yaml +++ b/clusters/home/infra/kustomization.yaml @@ -4,5 +4,6 @@ resources: - longhorn/longhorn-system.yaml - longhorn/storage-classes.yaml - longhorn/s3-backup-proxy.yaml + - longhorn/recurring-jobs.yaml - cert-manager/certificate-issuers.yaml - metallb.yaml diff --git a/clusters/home/infra/longhorn/recurring-jobs.yaml b/clusters/home/infra/longhorn/recurring-jobs.yaml new file mode 100644 index 0000000..81f2834 --- /dev/null +++ b/clusters/home/infra/longhorn/recurring-jobs.yaml @@ -0,0 +1,16 @@ +apiVersion: kustomize.toolkit.fluxcd.io/v1 +kind: Kustomization +metadata: + name: longhorn-recurring-jobs + namespace: flux-system +spec: + interval: 10m + sourceRef: + kind: GitRepository + name: flux-system + path: ./clusters/base/infra/longhorn/recurring-jobs + prune: true + wait: true + dependsOn: + - name: longhorn-system + retryInterval: 5s