diff --git a/clusters/testing/kustomization.yaml b/clusters/testing/kustomization.yaml index b23187a..bbff85c 100644 --- a/clusters/testing/kustomization.yaml +++ b/clusters/testing/kustomization.yaml @@ -14,3 +14,4 @@ resources: - ../../configs/letsencrypt/letsencrypt.yaml - ../../configs/certificates/certificates.yaml - ../../configs/telegram-alerts/telegram-alerts.yaml + - ../../configs/longhorn-jobs/longhorn-jobs.yaml diff --git a/configs/artifacts.yaml b/configs/artifacts.yaml index 10f29eb..96119a6 100644 --- a/configs/artifacts.yaml +++ b/configs/artifacts.yaml @@ -24,3 +24,8 @@ spec: copy: - from: "@foundation/configs/telegram-alerts/**" to: "@artifact/" + - name: longhorn-jobs + originRevision: "@foundation" + copy: + - from: "@foundation/configs/longhorn-jobs/**" + to: "@artifact/" diff --git a/configs/longhorn-jobs/kustomization.yaml b/configs/longhorn-jobs/kustomization.yaml new file mode 100644 index 0000000..048b0b0 --- /dev/null +++ b/configs/longhorn-jobs/kustomization.yaml @@ -0,0 +1,6 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +resources: + - recurring-job-backup.yaml + - recurring-job-snapshot.yaml + - recurring-job-trim.yaml diff --git a/configs/longhorn-jobs/longhorn-jobs.yaml b/configs/longhorn-jobs/longhorn-jobs.yaml new file mode 100644 index 0000000..fbd69ab --- /dev/null +++ b/configs/longhorn-jobs/longhorn-jobs.yaml @@ -0,0 +1,16 @@ +apiVersion: kustomize.toolkit.fluxcd.io/v1 +kind: Kustomization +metadata: + name: longhorn-jobs + namespace: flux-system +spec: + interval: 1h + retryInterval: 2m + timeout: 5m + dependsOn: + - name: longhorn + sourceRef: + kind: ExternalArtifact + name: longhorn-jobs + prune: true + wait: true diff --git a/configs/longhorn-jobs/recurring-job-backup.yaml b/configs/longhorn-jobs/recurring-job-backup.yaml new file mode 100644 index 0000000..74aca5e --- /dev/null +++ b/configs/longhorn-jobs/recurring-job-backup.yaml @@ -0,0 +1,14 @@ +apiVersion: longhorn.io/v1beta2 +kind: RecurringJob +metadata: + name: backup + namespace: longhorn-system +spec: + cron: "0 5 * * *" + task: "backup" + retain: 14 + concurrency: 1 + groups: + - default + parameters: + full-backup-interval: "7" diff --git a/configs/longhorn-jobs/recurring-job-snapshot.yaml b/configs/longhorn-jobs/recurring-job-snapshot.yaml new file mode 100644 index 0000000..52afce4 --- /dev/null +++ b/configs/longhorn-jobs/recurring-job-snapshot.yaml @@ -0,0 +1,12 @@ +apiVersion: longhorn.io/v1beta2 +kind: RecurringJob +metadata: + name: snapshot + namespace: longhorn-system +spec: + cron: "0 */12 * * *" + task: "snapshot" + retain: 14 + concurrency: 1 + groups: + - default diff --git a/configs/longhorn-jobs/recurring-job-trim.yaml b/configs/longhorn-jobs/recurring-job-trim.yaml new file mode 100644 index 0000000..5a1ed36 --- /dev/null +++ b/configs/longhorn-jobs/recurring-job-trim.yaml @@ -0,0 +1,11 @@ +apiVersion: longhorn.io/v1beta2 +kind: RecurringJob +metadata: + name: trim + namespace: longhorn-system +spec: + cron: "0 0 7 * *" + task: "filesystem-trim" + concurrency: 1 + groups: + - default