diff --git a/charts/etcdctl-utility/templates/bin/utility/_etcd_ondemand_job.sh.tpl b/charts/etcdctl-utility/templates/bin/utility/_etcd_ondemand_job.sh.tpl new file mode 100644 index 00000000..fac5c187 --- /dev/null +++ b/charts/etcdctl-utility/templates/bin/utility/_etcd_ondemand_job.sh.tpl @@ -0,0 +1,177 @@ +#!/bin/bash + +{{- $envAll := . }} + +export ETCD_POD_NAMESPACE=$1 +if [[ $ETCD_POD_NAMESPACE == "" ]]; then + echo "No namespace given - cannot spawn ondemand job." + exit 1 +fi + +export ETCD_RGW_SECRET={{ $envAll.Values.conf.etcd_backup_restore.secrets.kube_system.rgw_secret }} +export ETCD_CONF_SECRET={{ $envAll.Values.conf.etcd_backup_restore.secrets.kube_system.conf_secret }} +export ETCD_IMAGE_NAME=$(kubectl get cronjob -n ${ETCD_POD_NAMESPACE} kubernetes-etcd-backup -o yaml -o jsonpath="{range .spec.jobTemplate.spec.template.spec.containers[*]}{.image}{'\n'}{end}" | grep etcdctl-utility) +export ETCD_BACKUP_BASE_PATH=$(kubectl get secret -o yaml -n ${ETCD_POD_NAMESPACE} ${ETCD_CONF_SECRET} | grep BACKUP_BASE_PATH | awk '{print $2}' | base64 -d) + +if [[ $NODE == "" ]];then + echo "Cannot find node to run ondemand job from." + exit 1 +fi + +if [[ $ETCD_IMAGE_NAME == "" ]]; then + echo "Cannot find the utility image for populating ETCD_IMAGE_NAME variable." + exit 1 +fi + +cat <