Moon testcase bug fix
[bottlenecks.git] / utils / env_prepare / moon_prepare.bash
1 #!/bin/bash
2 ##############################################################################
3 # Copyright (c) 2018 Huawei Technologies Co.,Ltd and others.
4 #
5 # All rights reserved. This program and the accompanying materials
6 # are made available under the terms of the Apache License, Version 2.0
7 # which accompanies this distribution, and is available at
8 # http://www.apache.org/licenses/LICENSE-2.0
9 ##############################################################################
10 if grep -q "cadvisor" /etc/systemd/system/kubelet.service.d/10-kubeadm.conf
11 then
12     sed -e "/cadvisor-port=0/d" -i /etc/systemd/system/kubelet.service.d/10-kubeadm.conf
13     systemctl daemon-reload
14     systemctl restart kubelet
15
16 fi
17 if kubectl get po -n monitoring |grep prometheus-k8s |grep -q Running
18 then
19     echo "monitoring k8s deployment has been done"
20 else
21     git clone https://github.com/coreos/prometheus-operator.git
22     cd prometheus-operator
23     kubectl apply -n kube-system -f bundle.yaml
24     cd contrib/kube-prometheus
25     sleep 10
26     hack/cluster-monitoring/deploy
27 fi
28
29 while ! $(kubectl get po -n monitoring |grep prometheus-k8s |grep -q Running);do
30     echo "waiting for monitoring deployment finish!"
31     sleep 10
32 done
33
34 echo "waiting for monitoring tool works"
35 sleep 60