Skip to content

Commit

Permalink
linstor: add basic snapshot functionality
Browse files Browse the repository at this point in the history
Signed-off-by: Andrei Kvapil <[email protected]>
  • Loading branch information
kvaps committed Feb 26, 2025
1 parent 19e0e4c commit 9ae6b2b
Show file tree
Hide file tree
Showing 5 changed files with 77 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/core/platform/bundles/distro-full.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ releases:
chart: cozy-linstor
namespace: cozy-linstor
privileged: true
dependsOn: [piraeus-operator,cilium,cert-manager]
dependsOn: [piraeus-operator,cilium,cert-manager,snapshot-controller]

- name: telepresence
releaseName: traffic-manager
Expand Down
2 changes: 1 addition & 1 deletion packages/core/platform/bundles/paas-full.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ releases:
chart: cozy-linstor
namespace: cozy-linstor
privileged: true
dependsOn: [piraeus-operator,cilium,kubeovn,cert-manager]
dependsOn: [piraeus-operator,cilium,kubeovn,cert-manager,snapshot-controller]

- name: snapshot-controller
releaseName: snapshot-controller
Expand Down
15 changes: 15 additions & 0 deletions packages/system/linstor/templates/plunger/configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
apiVersion: v1
kind: ConfigMap
metadata:
name: linstor-plunger
namespace: cozy-linstor
data:
plunger.sh: |
#!/bin/bash
set -e
while true; do
# workaround for https://github.com/LINBIT/linstor-server/issues/437
linstor -m s l | jq -r '.[][] | select(.flags | contains(["DELETE"])) | "linstor snapshot delete \(.resource_name) \(.name)"' | sh -x
sleep 1m
done
52 changes: 52 additions & 0 deletions packages/system/linstor/templates/plunger/plunger.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: linstor-plunger
namespace: cozy-linstor
spec:
replicas: 1
selector:
matchLabels:
app: linstor-plunger
template:
metadata:
labels:
app: linstor-plunger
annotations:
checksum/config: {{ include (print $.Template.BasePath "/plunger/configmap.yaml") . | sha256sum }}
spec:
containers:
- name: plunger
image: quay.io/piraeusdatastore/piraeus-server:v1.29.2
command: ["/bin/bash", "/scripts/plunger.sh"]
volumeMounts:
- mountPath: /etc/linstor/client
name: client-tls
readOnly: true
- mountPath: /etc/linstor
name: etc-linstor
readOnly: true
- mountPath: /scripts
name: script-volume
readOnly: true
enableServiceLinks: false
serviceAccountName: linstor-controller
tolerations:
- effect: NoSchedule
key: drbd.linbit.com/lost-quorum
- effect: NoSchedule
key: drbd.linbit.com/force-io-error
volumes:
- name: client-tls
projected:
sources:
- secret:
name: linstor-client-tls
- name: etc-linstor
configMap:
name: linstor-controller-config
- name: script-volume
configMap:
name: linstor-plunger
defaultMode: 0755
8 changes: 8 additions & 0 deletions packages/system/linstor/templates/volumesnapshotclass.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: snapshot.storage.k8s.io/v1
kind: VolumeSnapshotClass
metadata:
annotations:
snapshot.storage.kubernetes.io/is-default-class: "true"
name: linstor-snapshots
driver: linstor.csi.linbit.com
deletionPolicy: Delete

0 comments on commit 9ae6b2b

Please sign in to comment.