longhorn/scripts/migrate-for-pre-070-volumes.sh
Sheng Yang 85ab7c8d9d Sync with manager
commit 91bb47d8095238efc1249153341f8a57a4fd8f92
Author: Sheng Yang <sheng.yang@rancher.com>
Date:   Fri Apr 24 13:35:53 2020 -0700

    Longhorn v0.8.1-rc3 release

Signed-off-by: Sheng Yang <sheng.yang@rancher.com>
2020-04-24 15:07:05 -07:00

36 lines
843 B
Bash
Executable File

#!/usr/bin/env bash
NS="longhorn-system"
print_usage() {
echo "Usage: ${0} [ |-h|--help] [volume_name|--all]"
echo ""
echo "Examples:"
echo " ${0} test-vol"
echo " ${0} --all"
echo ""
echo "Note: Must have Longhorn installed in "longhorn-system" namespace"
echo ""
exit 0
}
exec_command() {
COMMAND_ARG="${@}"
LONGHORN_MANAGER=$(kubectl -n ${NS} get po -l "app=longhorn-manager" | tr '\000' '\n' | sed -n '2p' | awk '{print $1}')
kubectl -n ${NS} exec -it ${LONGHORN_MANAGER} -- bash -c "longhorn-manager migrate-for-pre-070-volumes ${COMMAND_ARG}"
}
ARG=$1
case $ARG in
"" | "-h" | "--help")
print_usage
;;
*)
if [[ $# -ne 1 ]]; then
echo "Command args number shouldn't be greater than 1"
fi
exec_command ${@}
;;
esac