Giter Club home page Giter Club logo

smoothify / velero-volume-controller Goto Github PK

View Code? Open in Web Editor NEW

This project forked from duyanghao/velero-volume-controller

0.0 1.0 0.0 335 KB

Kubernetes controller for velero that detects and adds relevant backup annotation to pods with volumes

Home Page: https://github.com/vmware-tanzu/velero/blob/master/site/docs/master/restic.md#add-backup-annotation

License: Apache License 2.0

Makefile 5.06% Go 88.12% Dockerfile 0.98% Shell 1.40% Mustache 4.43%

velero-volume-controller's Introduction

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.

Parameter Description Default
ClusterServerCfg
clusterServerCfg.masterURL The address of the Kubernetes API server. Overrides any value in kubeconfig. Only required if out-of-cluster.
clusterServerCfg.kubeConfig Path to a kubeconfig. Only required if out-of-cluster.
clusterServerCfg.leaseLockNamespace The Namespace of LeaseLock object for controller Leader Election. velero
clusterServerCfg.leaseLockName The Name of LeaseLock object for controller Leader Election. velero-volume-controller
veleroVolumeCfg
veleroVolumeCfg.includeNamespaces The comma-separated list of namespaces to include in the backup annotation addition (default: all namespaces).
veleroVolumeCfg.excludeNamespaces The comma-separated list of namespaces to exclude from the backup annotation addition.
veleroVolumeCfg.includeVolumeTypes The 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.excludeVolumeTypes The 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.excludeJobs The comma-separated list of job names to exclude from the backup annotation addition (support basic string globs).
veleroVolumeCfg.includeStorageClasses The comma-separated list of storage classes to include in the backup annotation addition.
veleroVolumeCfg.excludeStorageClasses The 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

velero-volume-controller's People

Contributors

benosman avatar duyanghao avatar fredgate avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.