Update multiplane.sh
This commit is contained in:
@@ -193,12 +193,70 @@ upgrades_everyone_upgrades() {
|
||||
exit 0
|
||||
}
|
||||
|
||||
backup_k0s() {
|
||||
|
||||
if ! mkdir -p /opt/k0s/backups 2>/dev/null; then
|
||||
fatal "Error: Failed to create directory /opt/k0s/backups"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
gum spin --spinner dot --spinner.foreground 220 --title "Waiting..." -- k0sctl backup --save-path=/opt/k0s/backups && info "Backup success!" || fatal "Backup of k0s failed!"
|
||||
|
||||
}
|
||||
|
||||
restore_k0s() {
|
||||
|
||||
gum spin --spinner dot --spinner.foreground 220 --title "Waiting..." -- k0sctl apply --restore-from $1 && info "Restore success!" || fatal "Restore of k0s failed!"
|
||||
|
||||
}
|
||||
|
||||
your_good_your_good_your_good_and_stop() {
|
||||
exit 0
|
||||
|
||||
gum pager <<EOF
|
||||
Parts NOT covered by the k0s backup utility:
|
||||
|
||||
- PersistentVolumes of any running application
|
||||
- data store, in case something else than etcd or Kine/SQLite is used
|
||||
- any configuration to the cluster introduced by manual changes (e.g. changes that weren't saved under the <data-dir>/manifests)
|
||||
|
||||
The backups created by k0s backup command have following pieces of your cluster:
|
||||
|
||||
- certificates (the content of the <data-dir>/pki directory)
|
||||
- etcd snapshot, if the etcd data store is used
|
||||
- Kine/SQLite snapshot, if the Kine/SQLite data store is used
|
||||
- k0s.yaml
|
||||
- any custom defined manifests under the <data-dir>/manifests
|
||||
- any image bundles located under the <data-dir>/images
|
||||
- any helm configuration
|
||||
EOF
|
||||
|
||||
gum confirm "Start Backup Task?" && backup_k0s || clear; echo "Exiting..."; exit 0
|
||||
|
||||
}
|
||||
|
||||
thatll_buff_right_out_captin() {
|
||||
exit 0
|
||||
|
||||
if [ ! -d "/opt/k0s/backups" ]; then
|
||||
fatal "Error: directory /opt/k0s/backups does exist"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check if directory is empty
|
||||
if [ -z "$(ls -A "/opt/k0s/backups" 2>/dev/null)" ]; then
|
||||
fatal "Directory /opt/k0s/backups is empty. Exiting..."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
clear;
|
||||
|
||||
file=$(find /opt/k0s/backups -maxdepth 1 -type f -printf "%f\n" | gum filter --limit 1 --placeholder "Select a backup file...")
|
||||
|
||||
if [ -n "$file" ]; then
|
||||
full_path="/opt/k0s/backups/$file"
|
||||
fi
|
||||
|
||||
clear; gum confirm "Start Backup Task?" && restore_k0s $full_path || clear; echo "Exiting..."; exit 0
|
||||
|
||||
}
|
||||
|
||||
main() {
|
||||
|
||||
Reference in New Issue
Block a user