From 06db2e37272bb3a030c2b5f2e255ec6a61f17472 Mon Sep 17 00:00:00 2001 From: Ace Lee Date: Tue, 9 Jan 2018 03:19:09 +0000 Subject: Moon testcase bug fix JIRA: BOTTLENECK-220 The JIRA ticket is to suit moon version 4.3. There are some bugs to fix. Change-Id: Idf8b9a2b4dea6508738283e76457b8d1d25ceae9 Signed-off-by: Ace Lee --- utils/env_prepare/moon_prepare.bash | 35 +++++++++++++++++++++++++++++++++++ utils/env_prepare/moon_prepare.py | 25 +++++++++++++++++++++++++ 2 files changed, 60 insertions(+) create mode 100644 utils/env_prepare/moon_prepare.bash create mode 100644 utils/env_prepare/moon_prepare.py (limited to 'utils') diff --git a/utils/env_prepare/moon_prepare.bash b/utils/env_prepare/moon_prepare.bash new file mode 100644 index 00000000..7625418c --- /dev/null +++ b/utils/env_prepare/moon_prepare.bash @@ -0,0 +1,35 @@ +#!/bin/bash +############################################################################## +# 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 +############################################################################## +if grep -q "cadvisor" /etc/systemd/system/kubelet.service.d/10-kubeadm.conf +then + sed -e "/cadvisor-port=0/d" -i /etc/systemd/system/kubelet.service.d/10-kubeadm.conf + systemctl daemon-reload + systemctl restart kubelet + +fi +if kubectl get po -n monitoring |grep prometheus-k8s |grep -q Running +then + echo "monitoring k8s deployment has been done" +else + git clone https://github.com/coreos/prometheus-operator.git + cd prometheus-operator + kubectl apply -n kube-system -f bundle.yaml + cd contrib/kube-prometheus + sleep 10 + hack/cluster-monitoring/deploy +fi + +while ! $(kubectl get po -n monitoring |grep prometheus-k8s |grep -q Running);do + echo "waiting for monitoring deployment finish!" + sleep 10 +done + +echo "waiting for monitoring tool works" +sleep 60 diff --git a/utils/env_prepare/moon_prepare.py b/utils/env_prepare/moon_prepare.py new file mode 100644 index 00000000..41739454 --- /dev/null +++ b/utils/env_prepare/moon_prepare.py @@ -0,0 +1,25 @@ +#!/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 utils.infra_setup.passwordless_SSH.ssh as localssh + + +def moon_envprepare(host_info): + if ("password") in host_info: + client = localssh.SSH(user=host_info["user"], + host=host_info["ip"], + password=host_info["password"]) + else: + client = localssh.SSH(user=host_info["user"], + host=host_info["ip"], + key_filename=host_info["keyfile"]) + with open("/home/opnfv/bottlenecks/utils/env_prepare/moon_prepare.bash", + "rb") as stdin_file: + client.run("cat > ~/bottlenecks_envprepare.bash", stdin=stdin_file) + client.execute("sudo bash ~/bottlenecks_envprepare.bash") -- cgit 1.2.3-korg