From 7199e2a79996a9d84158cd1e8a16003f1c3d67d3 Mon Sep 17 00:00:00 2001 From: Mohammed Abdi Date: Tue, 13 Feb 2024 15:46:13 -0500 Subject: [PATCH] adding cluster connection check Signed-off-by: Mohammed Abdi --- deployment/deploy.sh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/deployment/deploy.sh b/deployment/deploy.sh index d1291f9..125d26a 100644 --- a/deployment/deploy.sh +++ b/deployment/deploy.sh @@ -4,6 +4,22 @@ # Deploy SusQL controller using helm charts # +# Check if kubectl is installed +if ! command -v kubectl &> /dev/null; then + echo "Error: kubectl is not installed. Please install kubectl to interact with Kubernetes clusters." + exit 1 +fi + +# Check if there is a current context +current_context=$(kubectl config current-context) +if [[ -z $current_context ]]; then # exit + echo "Error: You are not currently signed into any Kubernetes cluster." + exit 1 +else # continue + echo "You are currently signed into the following Kubernetes cluster:" + echo "$current_context" +fi + export SUSQL_NAMESPACE="openshift-kepler-operator" if [[ -z ${PROMETHEUS_PROTOCOL} ]]; then