What problem are you trying to solve?
I need to backup external data (for example an S3 bucket) using runJob hooks.
Right now SnapshotPolicy only accepts existing PVCs in spec.sources, so I have to create a temporary PVC just for the backup. After that it is no longer needed, but it still has to be managed and cleaned up.
Proposed solution
Add an ephemeral source type to spec.sources.
Kopiur could create a temporary PVC before the Snapshot, mount it into the backup hooks, and remove it after the Snapshot.
Example:
apiVersion: kopiur.home-operations.com/v1alpha1
kind: SnapshotPolicy
metadata:
name: nextcloud-garage
spec:
repository:
kind: ClusterRepository
name: shared
credentialProjection:
enabled: true
copyMethod: Direct
sources:
- ephemeral:
size: 50Gi
hooks:
beforeSnapshot:
- runJob:
jobSpec:
template:
spec:
restartPolicy: Never
containers:
- name: backup
image: amazon/aws-cli:latest
envFrom:
- secretRef:
name: nextcloud-garage-key
command:
- aws
- s3
- sync
- s3://nextcloud
- /backup
volumeMounts:
- name: backup
mountPath: /backup
volumes:
- name: backup
persistentVolumeClaim:
claimName: <generated pvc name?>
retention:
keepLatest: 3
keepDaily: 7
keepWeekly: 2
compression:
compressor: zstd
Alternatives considered
Using a regular PVC and cleaning it up in an afterSnapshot hook.
This works, but requires creating and managing a PVC that is only needed for a single snapshot.
What problem are you trying to solve?
I need to backup external data (for example an S3 bucket) using
runJobhooks.Right now
SnapshotPolicyonly accepts existing PVCs inspec.sources, so I have to create a temporary PVC just for the backup. After that it is no longer needed, but it still has to be managed and cleaned up.Proposed solution
Add an
ephemeralsource type tospec.sources.Kopiur could create a temporary PVC before the Snapshot, mount it into the backup hooks, and remove it after the Snapshot.
Example:
Alternatives considered
Using a regular PVC and cleaning it up in an
afterSnapshothook.This works, but requires creating and managing a PVC that is only needed for a single snapshot.