summaryrefslogtreecommitdiffstats
path: root/kubernetes/helm/plugins/undeploy
diff options
context:
space:
mode:
authorMike Elliott <mike.elliott@amdocs.com>2018-09-17 14:41:40 -0400
committerMike Elliott <mike.elliott@amdocs.com>2018-09-17 15:06:15 -0400
commit0dfcc9f8a1a57eecc67b9388aa3da7c6f1263f3d (patch)
tree795b521c2f2ada8fca6c15aeaf4b58a2c0ce4511 /kubernetes/helm/plugins/undeploy
parentbc7c2b8308105985d2807a1ddd94537b5b6bbbd3 (diff)
Add helm plugins to (un)deploy onap
In the Casablanca release, ONAP has become very large. Every Helm chart contains some amount of external configuration. And unfortunately, there is a limit to the amount of configuration that can exist in a Helm chart. When ONAP is installed as a unbrella chart containing many subcharts (each with configuration), the amount of configuration that resides in configmaps in K8s causes the installation to fail. To work around this issue, it was necessary to introiduce a Helm plugin that will install/upgrade onap by deploying the parent chart and each subchart within its own Helm "release". This is the initial version of the plugins, which has been verified to work and unblock integration in the deployment of all of ONAP. Improvements will be made post M4 to further harden and enhance the plugins. Specifically, the plugins are not currently resilent to network issues which can cause some of the subcharts to fail to deploy. To work around this, the plugins should be run from within the same network as the k8s cluster you are deploying to. To install, copy plugins directory into your local ~/.helm/ folder. After which you should see 'deploy' and 'undeploy' if you do a 'helm' with no arguments. Change-Id: I7c586f1c75f7249d2d7c38b4088129162c96401d Issue-ID: OOM-1344 Signed-off-by: Mike Elliott <mike.elliott@amdocs.com>
Diffstat (limited to 'kubernetes/helm/plugins/undeploy')
-rw-r--r--kubernetes/helm/plugins/undeploy/plugin.yaml7
-rwxr-xr-xkubernetes/helm/plugins/undeploy/undeploy.sh52
2 files changed, 59 insertions, 0 deletions
diff --git a/kubernetes/helm/plugins/undeploy/plugin.yaml b/kubernetes/helm/plugins/undeploy/plugin.yaml
new file mode 100644
index 0000000000..02999fd04c
--- /dev/null
+++ b/kubernetes/helm/plugins/undeploy/plugin.yaml
@@ -0,0 +1,7 @@
+name: "undeploy"
+version: "1.0.0"
+usage: "delete parent chart and subcharts that were deployed as separate
+releases"
+description: "delete parent chart and subcharts that were deployed as separate
+releases"
+command: "$HELM_PLUGIN_DIR/undeploy.sh" \ No newline at end of file
diff --git a/kubernetes/helm/plugins/undeploy/undeploy.sh b/kubernetes/helm/plugins/undeploy/undeploy.sh
new file mode 100755
index 0000000000..02b5d34c65
--- /dev/null
+++ b/kubernetes/helm/plugins/undeploy/undeploy.sh
@@ -0,0 +1,52 @@
+#!/bin/bash
+
+usage() {
+cat << EOF
+Delete an umbrella Helm Chart, and its subcharts, that was previously deployed using 'Helm deploy'.
+
+Example of deleting all Releases that have the prefix 'demo'.
+ $ helm undeploy demo
+
+ $ helm undeploy demo --purge
+
+Usage:
+ helm undeploy [RELEASE] [flags]
+
+Flags:
+ --purge remove the releases from the store and make its name free for later use
+EOF
+}
+
+undeploy() {
+ RELEASE=$1
+ FLAGS=$2
+
+ array=($(helm ls -q | grep $RELEASE))
+ n=${#array[*]}
+ for (( i = n-1; i >= 0; i-- ))
+ do
+ helm del "${array[i]}" $FLAGS
+ done
+}
+
+if [[ $# < 1 ]]; then
+ echo "Error: command 'undeploy' requires a release name"
+ exit 0
+fi
+
+case "${1:-"help"}" in
+ "help")
+ usage
+ ;;
+ "--help")
+ usage
+ ;;
+ "-h")
+ usage
+ ;;
+ *)
+ undeploy $1 ${@:2}
+ ;;
+esac
+
+exit 0 \ No newline at end of file