Skip to content

Restic volume populator is a Kubernetes Volume populator to provision a PVC from a restic snapshot

License

Notifications You must be signed in to change notification settings

ansarhun/restic-volume-populator

Repository files navigation

Restic volume populator

Restic volume populator is a Kubernetes Volume populator to provision a PVC from a restic snapshot.

Docker Helm Java CI with Gradle

Install the operator

The following command will install the operator using helm:

helm install restic-volume-populator oci://ghcr.io/ansarhun/charts/restic-volume-populator --version <VERSION>

Basic example

Create a secret with the following content:

apiVersion: v1
kind: Secret
metadata:
  name: freshrss-restic
type: Opaque
stringData:
  AWS_ACCESS_KEY_ID: "<AWS_ACCESS_KEY_ID>"
  AWS_SECRET_ACCESS_KEY: "<AWS_SECRET_ACCESS_KEY>"
  RESTIC_PASSWORD: "<RESTIC_PASSWORD>"
  RESTIC_REPOSITORY: "<RESTIC_REPOSITORY>"

Create the ResticVolumePopulator resource with the hostname used in the restic snapshot and the name of the secret created above:

apiVersion: ansarhun.github.com/v1alpha1
kind: ResticVolumePopulator
metadata:
  name: freshrss
spec:
  secretName: freshrss-restic
  hostname: volsync

Initialize the PersistentVolumeClaim using the dataSourceRef field and refer to the ResticVolumePopulator created above:

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: freshrss
spec:
  accessModes:
    - ReadWriteOnce
  volumeMode: Filesystem
  resources:
    requests:
      storage: 100Mi
  dataSourceRef:
    apiGroup: ansarhun.github.com
    kind: ResticVolumePopulator
    name: freshrss

Note

All of these resources must be in the same namespace.

With these resources, the operator will provision the PersistentVolumeClaim with the content from the restic snapshot.

ResticVolumePopulator resource

Field Required Default value Description
secretName The name of the secret containing parameters for the restic command, e.g.: RESTIC_REPOSITORY
hostname The name of the host from the restic snapshot, e.g.: volsync for VolSync
snapshot latest The id/name of the snapshot
allowUninitializedRepository false Allow provision from an uninitialized repository (will result in an empty PVC)
image.repository restic/restic Image to use for restic restore
image.tag latest Image tag to use for restic restore

Project status

The project is in the early stages of development.

It was tested to be working with: restic snapshots created with VolSync, Longhorn for stage and Minio as the restic repository.

References

The project was inspired by the https://github.com/kubernetes-csi/lib-volume-populator/ project.

About

Restic volume populator is a Kubernetes Volume populator to provision a PVC from a restic snapshot

Resources

License

Stars

Watchers

Forks

Packages