aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbeili.zhou <beili.zhou@amdocs.com>2017-12-07 12:05:06 -0500
committerAlexis de Talhouƫt <alexis.de_talhouet@bell.ca>2018-01-10 17:45:08 +0000
commitab1c1ab48b4a0daee88670479d1c57fcf58ae1cd (patch)
tree7a734932b8378d2ce3f6621723b4d4a9d91409e0
parent817e80be6b109f224b509efc5b38442ea05c5671 (diff)
ONAP config operation in oneclick/tools
Add scripts in oneclick/tools to support one click operation - create ONAP config in one click - clean ONAP deployment/config in one click Issue-ID: OOM-494 Change-Id: Ieaf0cb25575fa5136a1ad14dc2b10ad8a85a6994 Signed-off-by: beili.zhou <beili.zhou@amdocs.com>
-rw-r--r--kubernetes/oneclick/tools/autoCleanConfig.bash54
-rw-r--r--kubernetes/oneclick/tools/autoCreateConfig.bash65
2 files changed, 119 insertions, 0 deletions
diff --git a/kubernetes/oneclick/tools/autoCleanConfig.bash b/kubernetes/oneclick/tools/autoCleanConfig.bash
new file mode 100644
index 0000000000..e274e0d0c5
--- /dev/null
+++ b/kubernetes/oneclick/tools/autoCleanConfig.bash
@@ -0,0 +1,54 @@
+########################################################################################
+# This script wraps {$OOM}/kubernetes/oneclick/deleteAll.sh script along with #
+# the following steps to clean up ONAP configure for specified namespace: #
+# - remove namespace #
+# - remove release #
+# - remove shared directory #
+# #
+# To run it, just enter the following command: #
+# ./autoCleanConfig.bash <namespace, default is "onap"> #
+########################################################################################
+#!/bin/bash
+
+
+NS=$1
+if [[ -z $NS ]]
+then
+ echo "Namespace is not specified, use onap namespace."
+ NS="onap"
+fi
+
+echo "Clean up $NS configuration"
+cd ..
+./deleteAll.bash -n $NS -y
+cd -
+
+echo "----------------------------------------------
+Force remove namespace..."
+kubectl delete namespace $NS
+echo "...done : kubectl get namespace
+-----------------------------------------------
+>>>>>>>>>>>>>> k8s namespace"
+kubectl get namespace
+while [[ ! -z `kubectl get namespace|grep $NS` ]]
+do
+ echo "Wait for namespace $NS to be deleted
+-----------------------------------------------
+>>>>>>>>>>>>>> k8s namespace"
+ kubectl get namespace
+ sleep 2
+done
+
+echo "Force delete helm process ..."
+helm delete $NS-config --purge --debug
+echo "...done : helm ls --all
+ -----------------------------------------------
+>>>>>>>>>>>>>> helm"
+helm ls --all
+
+echo "Remove $NS dockerdata..."
+sudo rm -rf /dockerdata-nfs/onap
+echo "...done : ls -altr /dockerdata-nfs
+ -----------------------------------------------
+>>>>>>>>>>>>>> /dockerdata-nfs directory"
+ls -altr /dockerdata-nfs
diff --git a/kubernetes/oneclick/tools/autoCreateConfig.bash b/kubernetes/oneclick/tools/autoCreateConfig.bash
new file mode 100644
index 0000000000..99ea03e1bb
--- /dev/null
+++ b/kubernetes/oneclick/tools/autoCreateConfig.bash
@@ -0,0 +1,65 @@
+########################################################################################
+# This script wraps {$OOM}/kubernetes/config/createConfig.sh script #
+# and will only terminated when the configuration is Completed or failed #
+# #
+# To run it, just enter the following command: #
+# ./autoCreateConfig.bash <namespace, default is "onap"> #
+########################################################################################
+#!/bin/bash
+
+
+NS=$1
+if [[ -z $NS ]]
+then
+ echo "Namespace is not specified, use onap namespace."
+ NS="onap"
+fi
+
+echo "Create $NS config under config directory..."
+cd ../../config
+./createConfig.sh -n $NS
+cd -
+
+
+echo "...done : kubectl get namespace
+-----------------------------------------------
+>>>>>>>>>>>>>> k8s namespace"
+kubectl get namespace
+
+
+echo "
+-----------------------------------------------
+>>>>>>>>>>>>>> helm : helm ls --all"
+helm ls --all
+
+
+echo "
+-----------------------------------------------
+>>>>>>>>>>>>>> pod : kubectl get pods -n $NS -a"
+kubectl get pods -n $NS -a
+
+
+while true
+do
+ echo "wait for $NS config pod reach to Completed STATUS"
+ sleep 5
+ echo "-----------------------------------------------"
+ kubectl get pods -n $NS -a
+
+ status=`kubectl get pods -n $NS -a |grep config |xargs echo | cut -d' ' -f3`
+
+ if [ "$status" = "Completed" ]
+ then
+ echo "$NS config is Completed!!!"
+ break
+ fi
+
+ if [ "$status" = "Error" ]
+ then
+ echo "
+$NS config is failed with Error!!!
+Logs are:"
+ kubectl logs config -n $NS -f
+ break
+ fi
+done