Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

csi-debug: command to check network conn b/w csi #73

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions kubectl-rook-ceph.sh
Original file line number Diff line number Diff line change
Expand Up @@ -564,6 +564,42 @@ function run_dr_health() {
set -e
}

function run_csi_command() {
[[ -z "${1:-""}" ]] && fail_error "Missing csi-debug subcommand"
subcommand="$1"
shift # remove the subcommand from the front of the arg list

case $subcommand in
health)
run_csi_health "$@"
;;
*)
fail_error "'csi-debug' subcommand '$subcommand' does not exit"
;;
esac
}

function run_csi_health() {
end_of_command_parsing "$@" # end of command tree

info_msg "checking 'csi-cephfsplugin-provisioner' network connection"
cephfs_out="$(KUBECTL_NS_CLUSTER exec deploy/csi-cephfsplugin-provisioner -c csi-cephfsplugin -- curl "$(kubectl -n rook-ceph get svc -l app=rook-ceph-mon -o jsonpath='{.items[0].spec.clusterIP}')":3300 2>/dev/null | tr '\0' '\n')"
if [[ "$cephfs_out" =~ "ceph v2" ]]; then
info_msg "Network connection between cluster and csi-cephfs is: Connected"
else
error_msg "Network connection between cluster and csi-cephfs is: Not Connected"
fi
echo

info_msg "checking 'csi-rbdplugin-provisioner' network connection"
cephrbd_out="$(KUBECTL_NS_CLUSTER exec deploy/csi-rbdplugin-provisioner -c csi-rbdplugin -- curl "$(KUBECTL_NS_CLUSTER get svc -l app=rook-ceph-mon -o jsonpath='{.items[0].spec.clusterIP}')":3300 2>/dev/null | tr '\0' '\n')"
if [[ "$cephrbd_out" =~ "ceph v2" ]]; then
info_msg "Network connection between cluster and csi-rbd is: Connected"
else
error_msg "Network connection between cluster and csi-rbd is: Not Connected"
fi
}

####################################################################################################
# 'kubectl rook-ceph status' command
####################################################################################################
Expand Down Expand Up @@ -631,6 +667,9 @@ function run_main_command() {
dr)
run_dr_subcommands "$@"
;;
csi)
run_csi_command "$@"
;;
# status)
# run_status_command "$@"
# ;;
Expand Down