forked from longhorn/longhorn
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
commit 2ed3c8c76053c8df3fd418f6076c80c1ca49bf5b Author: Sheng Yang <sheng.yang@rancher.com> Date: Mon Sep 16 18:47:54 2019 -0700 Longhorn v0.6.0-rc1 release Signed-off-by: Sheng Yang <sheng.yang@rancher.com>
- v1.4.0
- v1.4.0-rc3
- v1.4.0-rc2
- v1.4.0-rc1
- v1.3.2
- v1.3.2-rc2
- v1.3.2-rc1
- v1.3.1
- v1.3.1-rc2
- v1.3.1-rc1
- v1.3.0
- v1.3.0-rc3
- v1.3.0-rc2
- v1.3.0-rc1
- v1.3.0-preview1
- v1.2.6
- v1.2.6-rc1
- v1.2.5
- v1.2.5-rc2
- v1.2.5-rc1
- v1.2.4
- v1.2.4-rc1
- v1.2.3
- v1.2.3-rc2
- v1.2.3-rc1
- v1.2.2
- v1.2.1
- v1.2.1-rc2
- v1.2.1-rc1
- v1.2.0
- v1.2.0-rc2
- v1.2.0-rc1
- v1.2.0-preview1
- v1.1.3
- v1.1.3-rc3
- v1.1.3-rc2
- v1.1.3-rc1
- v1.1.2
- v1.1.2-rc1
- v1.1.1
- v1.1.1-rc2
- v1.1.1-rc1
- v1.1.1-preview1
- v1.1.0
- v1.1.0-rc3
- v1.1.0-rc2
- v1.1.0-rc1
- v1.0.2
- v1.0.2-rc2
- v1.0.2-rc1
- v1.0.1
- v1.0.1-rc3
- v1.0.1-rc2
- v1.0.1-rc1
- v1.0.0
- v1.0.0-rc3
- v1.0.0-rc2
- v1.0.0-rc1
- v0.8.1
- v0.8.1-rc3
- v0.8.1-rc2
- v0.8.1-rc1
- v0.8.0
- v0.8.0-rc3
- v0.8.0-rc2
- v0.8.0-rc1
- v0.7.0
- v0.7.0-rc2
- v0.7.0-rc1
- v0.6.2
- v0.6.2-rc1
- v0.6.1
- v0.6.0
- v0.6.0-rc2
- v0.6.0-rc1
Showing
6 changed files
with
135 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
#!/usr/bin/env bash | ||
|
||
NS="longhorn-system" | ||
|
||
print_usage() { | ||
echo "Usage: ${0} [|-h|--help] volume_name longhorn_commands_arguments" | ||
echo "" | ||
echo "Examples:" | ||
echo " ${0} test-vol snapshot ls" | ||
echo " ${0} test-vol info" | ||
echo "" | ||
echo "Note: Must have Longhorn installed in "longhorn-system" namespace and have access to "kubectl" and the namespace" | ||
echo "" | ||
exit 0 | ||
} | ||
|
||
check_volume_exist(){ | ||
VOLUME_NAME=${1} | ||
kubectl -n ${NS} get lhv ${VOLUME_NAME} > /dev/null 2>&1 | ||
if [[ ${?} -ne 0 ]]; then | ||
echo "Err: Volume ${VOLUME_NAME} not found" | ||
exit 1 | ||
fi | ||
} | ||
|
||
check_engine_state(){ | ||
VOLUME_NAME=${1} | ||
LHE_STATE_FILTER="{.items[?(@.spec.volumeName==\"${VOLUME_NAME}\")].status.currentState}" | ||
LHE_STATE=`kubectl -n ${NS} get lhe --output=jsonpath="${LHE_STATE_FILTER}"` | ||
|
||
if [[ ${LHE_STATE} != "running" ]]; then | ||
echo "Err: Longhorn engine for volume ${VOLUME_NAME} is not running" | ||
exit 1 | ||
fi | ||
|
||
} | ||
|
||
exec_command() { | ||
VOLUME_NAME=${1} | ||
COMMAND_ARGS="${@:2}" | ||
|
||
INSTANCE_MANAGER_NAME_FILTER="{.items[?(@.spec.volumeName==\"${VOLUME_NAME}\")].status.instanceManagerName}" | ||
INSTANCE_MANAGER_NAME=`kubectl -n ${NS} get lhe --output=jsonpath="${INSTANCE_MANAGER_NAME_FILTER}"` | ||
|
||
ENGINE_PORT_FILTER="{.items[?(@.spec.volumeName==\"${VOLUME_NAME}\")].status.port}" | ||
ENGINE_PORT=`kubectl -n ${NS} get lhe --output=jsonpath="${ENGINE_PORT_FILTER}"` | ||
|
||
kubectl -n ${NS} exec -it ${INSTANCE_MANAGER_NAME} -- bash -c "longhorn --url localhost:${ENGINE_PORT} ${COMMAND_ARGS}" | ||
|
||
} | ||
|
||
|
||
ARG=$1 | ||
case $ARG in | ||
"" | "-h" | "--help") | ||
print_usage | ||
;; | ||
*) | ||
VOLUME_NAME=${ARG} | ||
shift | ||
COMMAND_ARGS="${@}" | ||
if [[ ${COMMAND_ARGS} == "" ]]; then | ||
COMMAND_ARGS="help" | ||
fi | ||
check_volume_exist ${VOLUME_NAME} | ||
check_engine_state ${VOLUME_NAME} | ||
exec_command ${VOLUME_NAME} ${COMMAND_ARGS} | ||
;; | ||
esac |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters