summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--requirements/requirements.txt1
-rw-r--r--utils/k8s_setup/__init__.py (renamed from utils/kube_setup/__init__.py)0
-rw-r--r--utils/k8s_setup/golang_install.sh (renamed from utils/kube_setup/install_golang.sh)0
-rw-r--r--utils/k8s_setup/k8s_config_pre.sh66
-rw-r--r--utils/k8s_setup/k8s_env.sh (renamed from utils/kube_setup/kube_env.sh)0
-rw-r--r--utils/k8s_setup/k8s_utils.py28
-rw-r--r--utils/k8s_setup/kubectl_install.sh (renamed from utils/kube_setup/install_kubectl.sh)0
7 files changed, 95 insertions, 0 deletions
diff --git a/requirements/requirements.txt b/requirements/requirements.txt
index dacffcea..381cb5cd 100644
--- a/requirements/requirements.txt
+++ b/requirements/requirements.txt
@@ -18,3 +18,4 @@ nose==1.3.7
pyroute2==0.4.10
elasticsearch==5.0.1
docker==2.0.2
+kubernetes==6.0.0
diff --git a/utils/kube_setup/__init__.py b/utils/k8s_setup/__init__.py
index e69de29b..e69de29b 100644
--- a/utils/kube_setup/__init__.py
+++ b/utils/k8s_setup/__init__.py
diff --git a/utils/kube_setup/install_golang.sh b/utils/k8s_setup/golang_install.sh
index 06c54cee..06c54cee 100644
--- a/utils/kube_setup/install_golang.sh
+++ b/utils/k8s_setup/golang_install.sh
diff --git a/utils/k8s_setup/k8s_config_pre.sh b/utils/k8s_setup/k8s_config_pre.sh
new file mode 100644
index 00000000..f41ba78d
--- /dev/null
+++ b/utils/k8s_setup/k8s_config_pre.sh
@@ -0,0 +1,66 @@
+#!/bin/bash
+##############################################################################
+# Copyright (c) 2018 Huawei Tech and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+K8S_CONFIG="/tmp/k8s_conig"
+
+usage="Script to prepare kubenetes test configurations.
+
+usage:
+ bash $(basename "$0") [-h|--help] [-i|--installer <installer typer>] [-c|--config <k8s config>]
+
+where:
+ -h|--help show the help text
+ -i|--installer specify the installer for the system to be monitored
+ <installer type>
+ one of the following:
+ (compass)
+examples:
+ $(basename "$0") -i compass"
+
+
+info () {
+ logger -s -t "BOTTLENECKS INFO" "$*"
+}
+
+error () {
+ logger -s -t "BOTTLENECKS ERROR" "$*"
+ exit 1
+}
+
+# Process input variables
+while [[ $# > 0 ]]
+ do
+ key="$1"
+ case $key in
+ -h|--help)
+ echo "$usage"
+ exit 0
+ shift
+ ;;
+ -i|--installer)
+ INSTALLER_TYPE="$2"
+ shift
+ ;;
+ -c|--config)
+ K8S_CONFIG="$2"
+ shift
+ ;;
+ *)
+ error "unkown input options $1 $2"
+ exit 1
+ ;;
+ esac
+ shift
+done
+
+if [[ ${INSTALLER_TYPE} == 'compass' ]]; then
+ sshpass -p root scp root@192.16.1.222:~/.kube/config ${K8S_CONFIG}
+else
+ echo "BOTTLENECKS EROOR: unrecognized installer"
+fi
diff --git a/utils/kube_setup/kube_env.sh b/utils/k8s_setup/k8s_env.sh
index 855dea2f..855dea2f 100644
--- a/utils/kube_setup/kube_env.sh
+++ b/utils/k8s_setup/k8s_env.sh
diff --git a/utils/k8s_setup/k8s_utils.py b/utils/k8s_setup/k8s_utils.py
new file mode 100644
index 00000000..afcdb307
--- /dev/null
+++ b/utils/k8s_setup/k8s_utils.py
@@ -0,0 +1,28 @@
+#!/usr/bin/env python
+##############################################################################
+# Copyright (c) 2018 Huawei Technologies Co.,Ltd and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+
+import os
+import utils.logger as log
+
+LOG = log.Logger(__name__).getLogger()
+INSTALLER_TYPE = os.getenv("INSTALLER_TYPE")
+
+
+def get_config_path(INSTALLER_TYPE=None, CONFIG_PATH="/tmp/k8s_config"):
+ if INSTALLER_TYPE:
+ CMD = "bash k8s_config_pre.sh -i " + INSTALLER_TYPE + \
+ " -c " + CONFIG_PATH
+ LOG.info("Executing command: " + CMD)
+ CONFIG_PATH = os.popen(CMD)
+ else:
+ if not os.path.exists(CONFIG_PATH):
+ raise Exception("Must at least specify the path \
+of k8s config!")
+ return CONFIG_PATH
diff --git a/utils/kube_setup/install_kubectl.sh b/utils/k8s_setup/kubectl_install.sh
index 14f97f2b..14f97f2b 100644
--- a/utils/kube_setup/install_kubectl.sh
+++ b/utils/k8s_setup/kubectl_install.sh