X-Git-Url: https://gerrit.akraino.org/r/gitweb?a=blobdiff_plain;f=ci%2Fdaily%20build%2Fcsit%2FverifyCluster.sh;fp=ci%2Fdaily%20build%2Fcsit%2FverifyPods.sh;h=f276e5d9405355b121052e6d0004845244c162f6;hb=65a13f210e491b623d2a0c8ed9f374f4d81976d0;hp=788e729288b249c08f3bc42eb36a2251fc21316a;hpb=6ce510fccce9b5481e88d10c3ffa73ed0284b517;p=ealt-edge.git diff --git a/ci/daily build/csit/verifyPods.sh b/ci/daily build/csit/verifyCluster.sh old mode 100644 new mode 100755 similarity index 55% rename from ci/daily build/csit/verifyPods.sh rename to ci/daily build/csit/verifyCluster.sh index 788e729..f276e5d --- a/ci/daily build/csit/verifyPods.sh +++ b/ci/daily build/csit/verifyCluster.sh @@ -1,6 +1,6 @@ #!/bin/bash -ex ############################################################################## -# Copyright (c) 2019 Huawei Tech and others. +# Copyright (c) 2020 Huawei Tech and others. # # All rights reserved. This program and the accompanying materials # are made available under the terms of the Apache License, Version 2.0 @@ -36,18 +36,35 @@ spec: hostPort: 80 EOF -#check if kubernetes is already running -if ! kubectl cluster-info ; then - kubectl create -f ~/testk8s-kubernetes.yaml +CLUSTER_INFO=$(kubectl cluster-info) +RUNNING_PODS_COUNT=$(kubectl get pods | grep -c -e STATUS -e Running) + +if [[ $CLUSTER_INFO != "" ]]; then + kubectl create -f ~/testk8s-kubernetes.yaml +else + echo "No kubernetes cluster present" fi -#To check the pods which is not running -if kubectl get pods | grep -c -e STATUS -e Running > 0; then -PODS_NOT_RUNNING=$(kubectl get pods --field-selector=status.phase!=Running) +sleep 60 + +echo "Kubectl deployments........................................." +kubectl get deployments + +echo "Kubectl pods in default namespace............................" +kubectl get pods + +echo "-------------------------------------------------------------------" +echo "-------------------------------------------------------------------" + +sleep 60 + +echo "Checking for Pods not in running status in default namespace" + +if [[ $RUNNING_PODS_COUNT > 0 ]]; then + kubectl get pods --field-selector=status.phase!=Running +else + echo "No Pods are presently running" fi echo "-------------------------------------------------------------------" -echo -echo $PODS_NOT_RUNNING > /dev/null 2>&1 -echo echo "-------------------------------------------------------------------"