aboutsummaryrefslogtreecommitdiffstats
path: root/test/security/k8s/tools/dublin
diff options
context:
space:
mode:
Diffstat (limited to 'test/security/k8s/tools/dublin')
-rwxr-xr-xtest/security/k8s/tools/dublin/get_kubectl.sh41
-rwxr-xr-xtest/security/k8s/tools/dublin/get_rke.sh4
-rwxr-xr-xtest/security/k8s/tools/dublin/setup_kubectl.sh41
3 files changed, 84 insertions, 2 deletions
diff --git a/test/security/k8s/tools/dublin/get_kubectl.sh b/test/security/k8s/tools/dublin/get_kubectl.sh
new file mode 100755
index 000000000..752c286c2
--- /dev/null
+++ b/test/security/k8s/tools/dublin/get_kubectl.sh
@@ -0,0 +1,41 @@
+#!/usr/bin/env bash
+
+#
+# @file test/security/k8s/tools/dublin/get_kubectl.sh
+# @author Pawel Wieczorek <p.wieczorek2@samsung.com>
+# @brief Utility for obtaining kubectl tool
+#
+
+# Dependencies:
+# wget
+# coreutils
+#
+# Privileges:
+# Script expects to be run with administrative privileges for accessing /usr/local/bin
+#
+# Usage:
+# # ./get_kubectl.sh [VERSION [ARCH [SYSTEM]]]
+#
+
+# Constants
+BINARY='kubectl'
+INSTALL_DIR='/usr/local/bin/'
+
+DEFAULT_VERSION='v1.13.5'
+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-release/release/${VERSION}/bin/${SYSTEM}/${ARCH}/${BINARY}"
+
+
+# Prerequistes
+wget "$URL"
+chmod +x "$BINARY"
+
+# Installation
+mv "$BINARY" "$INSTALL_DIR"
diff --git a/test/security/k8s/tools/dublin/get_rke.sh b/test/security/k8s/tools/dublin/get_rke.sh
index 63ef8c77e..01dd20a96 100755
--- a/test/security/k8s/tools/dublin/get_rke.sh
+++ b/test/security/k8s/tools/dublin/get_rke.sh
@@ -33,7 +33,7 @@ URL="https://github.com/rancher/rke/releases/download/${VERSION}/${BINARY}"
# Prerequistes
wget "$URL"
-chmod +x "${BINARY}"
+chmod +x "$BINARY"
# Installation
-mv "${BINARY}" "/usr/local/bin/${BINARY%%_*}" # this also renames binary to "rke"
+mv "$BINARY" "/usr/local/bin/${BINARY%%_*}" # this also renames binary to "rke"
diff --git a/test/security/k8s/tools/dublin/setup_kubectl.sh b/test/security/k8s/tools/dublin/setup_kubectl.sh
new file mode 100755
index 000000000..a50c23656
--- /dev/null
+++ b/test/security/k8s/tools/dublin/setup_kubectl.sh
@@ -0,0 +1,41 @@
+#!/usr/bin/env bash
+
+#
+# @file test/security/k8s/tools/dublin/setup_kubectl.sh
+# @author Pawel Wieczorek <p.wieczorek2@samsung.com>
+# @brief Utility for setting up kubectl tool for Dublin cluster
+#
+
+# Dependencies:
+# coreutils
+#
+# Privileges:
+# Script expects to be run with administrative privileges for accessing /usr/local/bin
+#
+# Usage:
+# # ./setup_kubectl.sh [RKE_CONFIG [KUBE_DIR [KUBE_CONFIG [KUBE_CONTEXT]]]]
+#
+
+# Constants
+BASH_ALIASES='.bash_aliases'
+
+DEFAULT_RKE_CONFIG='kube_config_cluster.yml'
+DEFAULT_KUBE_DIR='.kube'
+DEFAULT_KUBE_CONFIG='config.onap'
+DEFAULT_KUBE_CONTEXT='onap'
+
+# Variables
+RKE_CONFIG="${1:-$DEFAULT_RKE_CONFIG}"
+KUBE_DIR="${2:-${HOME}/${DEFAULT_KUBE_DIR}}"
+KUBE_CONFIG="${3:-$DEFAULT_KUBE_CONFIG}"
+KUBE_CONTEXT="${4:-$DEFAULT_KUBE_CONTEXT}"
+
+USE_ONAP="f() { export KUBECONFIG=${KUBE_DIR}/${KUBE_CONFIG}; kubectl config use-context ${KUBE_CONTEXT}; }; f"
+
+
+# Prerequistes
+mkdir -p "$KUBE_DIR"
+echo "alias useonap='${USE_ONAP}'" >> "${HOME}/${BASH_ALIASES}"
+
+# Setup
+cp "$RKE_CONFIG" "${KUBE_DIR}/${KUBE_CONFIG}"