diff options
Diffstat (limited to 'security/scripts/check_unlimitted_pods.sh')
-rw-r--r-- | security/scripts/check_unlimitted_pods.sh | 28 |
1 files changed, 28 insertions, 0 deletions
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 |