Skip to content

Commit c663321

Browse files
committed
fix vcluster checks for check-k8s tool
1 parent 0674a91 commit c663321

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

tools/scripts/check-k8s.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ checkClusterResources() {
1111

1212
#--- Check nodes
1313
result="$(kubectl get nodes -A --context ${context} --request-timeout=1s --no-headers=true 2>&1)"
14-
flagTimeout="$(echo "${result}" | grep "Unable to connect to the server")"
14+
flagTimeout="$(echo "${result}" | grep -E "Unable to connect to the server|E0214")"
1515
if [ "${flagTimeout}" != "" ] ; then
16-
printf "\n%bCluster \"${context}\" not available...%b\n" "${RED}" "${STD}"
16+
printf "\n%bCluster \"${context}\" not available or needs credentials to be accessed...%b\n" "${RED}" "${STD}"
1717
else
1818
result="$(echo "${result}" | grep -v " Ready " | awk '{printf "%-27s %s\n", $2, $1}' | sort)"
1919
if [ "${result}" != "" ] ; then
@@ -82,7 +82,7 @@ checkClusterResources() {
8282
fi
8383

8484
#--- Check pods
85-
result="$(kubectl get pods -A --context ${context} --no-headers=true | grep -vE "Running|Completed|ContainerCreating|Terminating" | awk '{printf "%-32s %-6s %s\n", $4, $3, $1"/"$2}' | sort)"
85+
result="$(kubectl get pods -A -l 'vcluster.loft.sh/managed-by notin (vcluster)' --context ${context} --no-headers=true | grep -vE "Running|Completed|ContainerCreating|Terminating" | awk '{printf "%-32s %-6s %s\n", $4, $3, $1"/"$2}' | sort)"
8686
if [ "${result}" != "" ] ; then
8787
printf "\n%bSTATUS READY POD%b\n${result}\n" "${GREEN}" "${STD}"
8888
fi

0 commit comments

Comments
 (0)