k8up icon indicating copy to clipboard operation
k8up copied to clipboard

Add Support for BackupCommand Templates

Open tobru opened this issue 3 years ago • 0 comments

Summary

As K8up user I want to choose from a pre-defined list of backupcommands So that I don't have to copy/paste a lot of the same backupcommands and can leverage a list of pre-engineered and well-known backupcommands

Context

The backupcommand Pod annotation can become quite large and complex to make it as robust as possible. For many well known applications like MariaDB, Postgres and others it's usually always the same command to run. Providing a pre-defined (configurable) list helps to have the well-known backup commands at hand.

Out of Scope

  • Engineer the backupcommand templates

Further links

Acceptance criteria

Given the annotation k8up.syn.tools/backuptemplate=mysqldump on a Pod When a backup runs Then the backupcommand is looked up in the template registry and executes the command it finds.

Implementation Ideas

The idea is to have a ConfigMap where commonly used backup commands can be specified. Those templates can then be used via an annotation (i.e. k8up.syn.tools/backuptemplate=mysqldump).

Example config:

[common_commands]
mysqldump = /bin/bash -c "mysqldump --all-databases -h $MARIADB_HOST -u $MARIADB_USERNAME -p$MARIADB_PASSWORD"
mongodump = ...
postgresdump = ...

The K8up Helm Chart could deliver a ConfigMap with some well-known prebackupcommands.

tobru avatar Jan 21 '21 16:01 tobru