blob: 23e9adbe33095749aefa295d589b5e8ab0f662fe [file] [log] [blame]
Gilles Depatie84cb1e72018-10-26 12:41:33 -04001#!/bin/bash +x
2# Copyright 2017-present Open Networking Foundation
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15
16SRC_DIR="$( cd -P "$( dirname "${BASH_SOURCE[0]}" )" && pwd)"
17BUILD_DIR="$SRC_DIR/../build"
18
19cd $BUILD_DIR
20
21if [ $# -ne 1 ]
22 then
23 echo "No arguments supplied"
24 exit 1
25fi
26if [ -z "$1" ]
27 then
28 echo "Empty argument supplied"
29 exit 1
30fi
31if [ $1 == "clear" ]
32 then
33 sudo make reset-kubeadm
34elif [ $1 == "start" ]
35 then
Gilles Depatie1be639b2018-12-06 10:51:08 -050036 sudo service docker restart
Gilles Depatie84cb1e72018-10-26 12:41:33 -040037 sudo make -f Makefile
38elif [ $1 == "stop" ]
39 then
40 pods=$( /usr/bin/kubectl get pods --all-namespaces 2>&1 | grep -c -e refused -e resource )
41 if [ $pods -eq 0 ]
42 then
43 sudo make teardown-charts
44 fi
45fi
46exit 0