aboutsummaryrefslogtreecommitdiffstats
path: root/security/scripts/check_unlimitted_pods.sh
diff options
context:
space:
mode:
authormrichomme <morgan.richomme@orange.com>2020-04-20 14:50:27 +0200
committermrichomme <morgan.richomme@orange.com>2020-04-20 14:50:27 +0200
commit5de622a8247c4cf4fc2bd4e5f8a947e60a8c4bfb (patch)
tree2038bfaa94413367fd46e8bcd38600f2e49dac05 /security/scripts/check_unlimitted_pods.sh
parent3c64be99c3c24930674e9fa657993d95cbd2fe6d (diff)
Resync integration/xtesting repo
Issue-ID: INT-1366 Signed-off-by: mrichomme <morgan.richomme@orange.com> Change-Id: I3af9c4697f0e67d3ce5b6d2fceeb978aeb20a0ff
Diffstat (limited to 'security/scripts/check_unlimitted_pods.sh')
-rw-r--r--security/scripts/check_unlimitted_pods.sh28
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