Enable longhorn backup
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Adrien Reslinger 2022-05-17 16:57:24 +02:00
parent f813c839a2
commit 6d35239db7
Signed by: adrien
GPG key ID: DA7B27055C66D6DE
2 changed files with 50 additions and 18 deletions

View file

@ -14,26 +14,22 @@
create_namespace: yes create_namespace: yes
release_namespace: "{{ storage_longhorn.namespace }}" release_namespace: "{{ storage_longhorn.namespace }}"
values: values:
# persistence: persistence:
# defaultClass: true defaultClass: true
# defaultClassReplicaCount: 3 # defaultClassReplicaCount: 3
# reclaimPolicy: Delete # reclaimPolicy: Delete
# recurringJobs: recurringJobSelector:
# enable: true enable: true
# jobList: [ jobList: '[
# { {
# "name":"snap", "name":"snapshot",
# "task":"snapshot", "isGroup":true,
# "cron":"*/1 * * * *", },
# "retain":1 {
# }, "name":"backup-daily",
# { "isGroup":true,
# "name":"backup", }
# "task":"backup", ]'
# "cron":"*/2 * * * *",
# "retain":1
# }
# ]
defaultSettings: defaultSettings:
defaultDataPath: "/var/lib/longhorn/" defaultDataPath: "/var/lib/longhorn/"
backupTarget: "nfs://longhorn-test-nfs-svc.default:/opt/backupstore" backupTarget: "nfs://longhorn-test-nfs-svc.default:/opt/backupstore"
@ -91,6 +87,27 @@
value: "best-effort" value: "best-effort"
} }
- name: Install longhorn Recurring Jobs
kubernetes.core.k8s:
state: present
context: "{{ my_context }}"
apply: true
namespace: "{{ storage_longhorn.namespace }}"
resource_definition: "{{ lookup('template', 'longhorn/longhorn/longhorn_recurringjob.yml.j2') | from_yaml }}"
with_items:
- {
name: "snapshot",
cron: "1 * * * *",
task: "snapshot",
retain: 25
}
- {
name: "backup-daily",
cron: "0 1 * * *",
task: "backup",
retain: 8
}
# - name: Install longhorn UI Ingress # - name: Install longhorn UI Ingress
# kubernetes.core.k8s: # kubernetes.core.k8s:
# state: present # state: present

View file

@ -0,0 +1,15 @@
apiVersion: longhorn.io/v1beta1
kind: RecurringJob
metadata:
name: "{{ item.name }}"
namespace: "{{ storage_longhorn.namespace }}"
spec:
cron: "{{ item.cron }}"
task: "{{ item.task }}"
groups:
- default
retain: {{ item.retain }}
concurrency: 2
# labels:
# label/1: a
# label/2: b