Categorygithub.com/smoothify/velero-volume-controller
modulepackage
0.2.9
Repository: https://github.com/smoothify/velero-volume-controller.git
Documentation: pkg.go.dev

# README

velero-volume-controller

velero-volume-controller is a Kubernetes controller for velero that detects and adds relevant backup annotation to pods with volumes

Overview

velero is one of the best bur(backup and restore) tools for workloads running on Kubernetes, and its Restic Integration capability provides an out-of-the-box solution for backing up and restoring almost any type of Kubernetes volume*, so we can use Velero with Restic Integration to backup and restore Kubernetes applications and its relevant volumes data.

But one requirement of velero Restic Integration is that users have to add relevant backup annotation to pods, defining which pod volume(s) they want to back up, and in the meantime velero hasn't provided a do-one-command or automatic way to backup all volume resources in the cluster without annotations. Therefore, users have to add backup annotation for all pods with volumes in cluster by hand, which is complicated and unpractical in a production environment.

To solve this, velero-volume-controller helps users to do this dull job automatically.

Precondition

  • Velero's restic integration requires the Kubernetes MountPropagation feature, which is enabled by default in Kubernetes v1.10.0 and later.

Principle

The logic of velero-volume-controller is kept as simple as possible - watch pod ADD|UPDATE events and add relevant backup annotation to pods with volumes as below:

Running

External

velero-volume-controller can be run outside of the kubernetes as below:

$ bash hack/start.sh

Internal

Running velero-volume-controller inside a kubernetes is more convenient compared with the external as this controller has added Leader Election Mechanism and Kubernetes deployment helps to keep it high-available:

# Generated image
$ make dockerfiles.build
# Retag and push to your docker registry
$ docker tag duyanghao/velero-volume-controller:v2.0 xxx/duyanghao/velero-volume-controller:v2.0
$ docker push xxx/duyanghao/velero-volume-controller:v2.0
# Update the deployment 'Image' field with the built image name
$ sed -i 's|REPLACE_IMAGE|xxx/duyanghao/velero-volume-controller:v2.0|g' examples/deployment/velero-volume-controller.yaml
# Create ClusterRole and ClusterRoleBinding
$ kubectl apply -f examples/deployment/cluster-role.yaml
$ kubectl apply -f examples/deployment/cluster-role-binding.yaml
# Create ConfigMap
$ kubectl apply -f examples/deployment/configmap.yaml
# Create velero-volume-controller deployment
$ kubectl apply -f examples/deployment/velero-volume-controller.yaml

Configuration

The following table lists the configurable parameters of the velero-volume-controller and the default values.

ParameterDescriptionDefault
ClusterServerCfg
clusterServerCfg.masterURLThe address of the Kubernetes API server. Overrides any value in kubeconfig. Only required if out-of-cluster.
clusterServerCfg.kubeConfigPath to a kubeconfig. Only required if out-of-cluster.
clusterServerCfg.leaseLockNamespaceThe Namespace of LeaseLock object for controller Leader Election.velero
clusterServerCfg.leaseLockNameThe Name of LeaseLock object for controller Leader Election.velero-volume-controller
veleroVolumeCfg
veleroVolumeCfg.includeNamespacesThe comma-separated list of namespaces to include in the backup annotation addition (default: all namespaces).
veleroVolumeCfg.excludeNamespacesThe comma-separated list of namespaces to exclude from the backup annotation addition.
veleroVolumeCfg.includeVolumeTypesThe comma-separated list of volume types to include in the backup annotation addition (default: persistentVolumeClaim]). If persistentVolumeClaim is present in this list then all claims will be included regardless of the underlying volume type, otherwise the underlying volume type will be checked against the list.persistentVolumeClaim
veleroVolumeCfg.excludeVolumeTypesThe comma-separated list of volume types to exclude from the backup annotation addition. If persistentVolumeClaim is present in this list then all claims will be excluded regardless of the underlying volume type, otherwise the underlying volume type will be checked against the list.
veleroVolumeCfg.excludeJobsThe comma-separated list of job names to exclude from the backup annotation addition (support basic string globs).
veleroVolumeCfg.includeStorageClassesThe comma-separated list of storage classes to include in the backup annotation addition.
veleroVolumeCfg.excludeStorageClassesThe comma-separated list of storage classes to exclude from the backup annotation addition. This allows you to exclude storage classes that support snapshot feature since they could choose to be handled by issuing a snapshot creation rather than go through restic.

Roadmap

velero-volume-controller will follow upstream vmware-tanzu/velero support for Restic Integration.

Refs

# Packages

No description provided by the author
No description provided by the author