Add helm provisioners (downloading and setting up with OOM plugins) 20/99420/3
authorPawel Wieczorek <p.wieczorek2@samsung.com>
Thu, 5 Dec 2019 12:45:45 +0000 (13:45 +0100)
committerMorgan Richomme <morgan.richomme@orange.com>
Wed, 18 Dec 2019 07:31:11 +0000 (07:31 +0000)
Issue-ID: ONAPARC-537
Change-Id: I3b3d731ae016c78b3e00841157c69aded14635e2
Signed-off-by: Pawel Wieczorek <p.wieczorek2@samsung.com>
bootstrap/vagrant-minimal-onap/Vagrantfile
bootstrap/vagrant-minimal-onap/tools/get_helm.sh [new file with mode: 0644]

index 53d78b5..0f26ec8 100644 (file)
@@ -106,6 +106,13 @@ SCRIPT
 $rke_up = "rke up"
 $rke_down = "rke remove --force"
 
+$get_oom = <<-SCRIPT
+  BRANCH="${1:-5.0.1-ONAP}"
+  git clone -b "$BRANCH" https://git.onap.org/oom --recurse-submodules
+SCRIPT
+
+$get_helm_plugins = "cp -R ${HOME}/oom/kubernetes/helm/plugins/ ${HOME}/.helm"
+
 Vagrant.configure('2') do |config|
   all.each do |machine|
     config.vm.define machine[:name] do |config|
@@ -192,6 +199,9 @@ Vagrant.configure('2') do |config|
           s.privileged = false
           s.path = "tools/setup_kubectl.sh"
         end
+        config.vm.provision "get_helm", type: :shell, path: "tools/get_helm.sh"
+        config.vm.provision "get_oom", type: :shell, privileged: false, inline: $get_oom
+        config.vm.provision "get_helm_plugins", type: :shell, privileged: false, inline: $get_helm_plugins
       end
     end
   end
diff --git a/bootstrap/vagrant-minimal-onap/tools/get_helm.sh b/bootstrap/vagrant-minimal-onap/tools/get_helm.sh
new file mode 100644 (file)
index 0000000..ad678e9
--- /dev/null
@@ -0,0 +1,48 @@
+#!/usr/bin/env bash
+
+#
+# @file        test/security/k8s/tools/dublin/get_helm.sh
+# @author      Pawel Wieczorek <p.wieczorek2@samsung.com>
+# @brief       Utility for obtaining helm tool
+#
+
+# Dependencies:
+#     wget
+#     tar
+#     coreutils
+#
+# Privileges:
+# Script expects to be run with administrative privileges for accessing /usr/local/bin
+#
+# Usage:
+# # ./get_helm.sh [VERSION [ARCH [SYSTEM]]]
+#
+
+# Constants
+BINARY='helm'
+INSTALL_DIR='/usr/local/bin/'
+
+DEFAULT_VERSION='v2.14.2'
+DEFAULT_ARCH='amd64'
+DEFAULT_SYSTEM='linux'
+
+# Variables
+VERSION="${1:-$DEFAULT_VERSION}"
+ARCH="${2:-$DEFAULT_ARCH}"
+SYSTEM="${3:-$DEFAULT_SYSTEM}"
+
+URL="https://storage.googleapis.com/kubernetes-helm/${BINARY}-${VERSION}-${SYSTEM}-${ARCH}.tar.gz"
+ARCHIVE="${URL##*/}"
+DIR="${SYSTEM}-${ARCH}"
+
+
+# Prerequistes
+wget "$URL"
+tar xf "$ARCHIVE"
+
+# Installation
+mv "${DIR}/${BINARY}" "$INSTALL_DIR"
+
+# Cleanup
+rm "$ARCHIVE"
+rm -r "$DIR"