From 8a1ea8aa32582eec6d32e1ec8c5c6850665caa5f Mon Sep 17 00:00:00 2001
From: Sheogorath <sheogorath@shivering-isles.com>
Date: Sun, 7 Jan 2024 02:46:20 +0100
Subject: [PATCH] feat(longhorn): Add snapshot classes for longhorn

Reference:
https://longhorn.io/docs/1.5.3/snapshots-and-backups/csi-snapshot-support/enable-csi-snapshot-support/
---
 infrastructure/longhorn/kustomization.yaml |  1 +
 infrastructure/longhorn/snapshot.yaml      | 18 ++++++++++++++++++
 2 files changed, 19 insertions(+)
 create mode 100644 infrastructure/longhorn/snapshot.yaml

diff --git a/infrastructure/longhorn/kustomization.yaml b/infrastructure/longhorn/kustomization.yaml
index 42c292fa4..b478ad62c 100644
--- a/infrastructure/longhorn/kustomization.yaml
+++ b/infrastructure/longhorn/kustomization.yaml
@@ -6,6 +6,7 @@ resources:
   - repository.yaml
   - release.yaml
   - monitoring.yaml
+  - snapshot.yaml
   # Add network policies
   - ../../shared/networkpolicies/allow-from-ingress.yaml
   - ../../shared/networkpolicies/allow-from-monitoring.yaml
diff --git a/infrastructure/longhorn/snapshot.yaml b/infrastructure/longhorn/snapshot.yaml
new file mode 100644
index 000000000..1d973ef9b
--- /dev/null
+++ b/infrastructure/longhorn/snapshot.yaml
@@ -0,0 +1,18 @@
+---
+kind: VolumeSnapshotClass
+apiVersion: snapshot.storage.k8s.io/v1
+metadata:
+  name: longhorn-snapshot
+driver: driver.longhorn.io
+deletionPolicy: Delete
+parameters:
+  type: snap
+---
+kind: VolumeSnapshotClass
+apiVersion: snapshot.storage.k8s.io/v1
+metadata:
+  name: longhorn-backup
+driver: driver.longhorn.io
+deletionPolicy: Delete
+parameters:
+  type: bak
\ No newline at end of file
-- 
GitLab