From 5de622a8247c4cf4fc2bd4e5f8a947e60a8c4bfb Mon Sep 17 00:00:00 2001 From: mrichomme Date: Mon, 20 Apr 2020 14:50:27 +0200 Subject: Resync integration/xtesting repo Issue-ID: INT-1366 Signed-off-by: mrichomme Change-Id: I3af9c4697f0e67d3ce5b6d2fceeb978aeb20a0ff --- security/scripts/check_unlimitted_pods.sh | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 security/scripts/check_unlimitted_pods.sh (limited to 'security/scripts/check_unlimitted_pods.sh') diff --git a/security/scripts/check_unlimitted_pods.sh b/security/scripts/check_unlimitted_pods.sh new file mode 100644 index 0000000..fdef6f3 --- /dev/null +++ b/security/scripts/check_unlimitted_pods.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +echo "------------------------------------------------------------------------" +echo "-------------------- ONAP Security tests ----------------------------" +echo "-------------------- Test pods without limit ------------------------" +echo "------------------------------------------------------------------------" + +code=0 + +# get the pod list +for pod in `kubectl get pod -n onap|grep -v "NAME"|grep "Running\|Completed" |grep -v functest |grep -v integration | awk '{print $1}'`;do + kubectl describe pod $pod -n onap|grep "Limits"; + if [ $? == 1 ] ; then + echo $pod ; + fi; +done | grep -v Limits > NoLimitContainer.txt + +if [ -s NoLimitContainer.txt ] +then + code=1 + nb_errors=`cat NoLimitContainer.txt | wc -l` + echo "Test FAIL: $nb_errors pod(s) launched without limit" + cat NoLimitContainer.txt +else + echo "Test PASS: No pod launched without limit" +fi + +exit $code -- cgit 1.2.3-korg