Gilles Depatie | 84cb1e7 | 2018-10-26 12:41:33 -0400 | [diff] [blame] | 1 | #!/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 | |
| 16 | SRC_DIR="$( cd -P "$( dirname "${BASH_SOURCE[0]}" )" && pwd)" |
| 17 | BUILD_DIR="$SRC_DIR/../build" |
| 18 | |
Gilles Depatie | ea42371 | 2019-04-12 16:39:12 -0400 | [diff] [blame^] | 19 | cd ${BUILD_DIR} |
| 20 | if [[ $# -ne 2 ]] |
Gilles Depatie | 84cb1e7 | 2018-10-26 12:41:33 -0400 | [diff] [blame] | 21 | then |
Gilles Depatie | ea42371 | 2019-04-12 16:39:12 -0400 | [diff] [blame^] | 22 | echo "Wrong number of arguments supplied" |
Gilles Depatie | 84cb1e7 | 2018-10-26 12:41:33 -0400 | [diff] [blame] | 23 | exit 1 |
| 24 | fi |
Gilles Depatie | ea42371 | 2019-04-12 16:39:12 -0400 | [diff] [blame^] | 25 | if [[ -z "${1}" || -z "${2}" ]] |
Gilles Depatie | 84cb1e7 | 2018-10-26 12:41:33 -0400 | [diff] [blame] | 26 | then |
| 27 | echo "Empty argument supplied" |
| 28 | exit 1 |
| 29 | fi |
Gilles Depatie | ea42371 | 2019-04-12 16:39:12 -0400 | [diff] [blame^] | 30 | if [[ "${1}" == "clear" ]] |
Gilles Depatie | 84cb1e7 | 2018-10-26 12:41:33 -0400 | [diff] [blame] | 31 | then |
| 32 | sudo make reset-kubeadm |
Gilles Depatie | ea42371 | 2019-04-12 16:39:12 -0400 | [diff] [blame^] | 33 | elif [[ "${1}" == "start" ]] |
Gilles Depatie | 84cb1e7 | 2018-10-26 12:41:33 -0400 | [diff] [blame] | 34 | then |
Gilles Depatie | 1be639b | 2018-12-06 10:51:08 -0500 | [diff] [blame] | 35 | sudo service docker restart |
Gilles Depatie | ea42371 | 2019-04-12 16:39:12 -0400 | [diff] [blame^] | 36 | sudo make -f Makefile ${2} |
| 37 | elif [[ "${1}" == "stop" ]] |
Gilles Depatie | 84cb1e7 | 2018-10-26 12:41:33 -0400 | [diff] [blame] | 38 | then |
| 39 | pods=$( /usr/bin/kubectl get pods --all-namespaces 2>&1 | grep -c -e refused -e resource ) |
Gilles Depatie | ea42371 | 2019-04-12 16:39:12 -0400 | [diff] [blame^] | 40 | if [[ ${pods} -eq 0 ]] |
Gilles Depatie | 84cb1e7 | 2018-10-26 12:41:33 -0400 | [diff] [blame] | 41 | then |
| 42 | sudo make teardown-charts |
| 43 | fi |
| 44 | fi |
| 45 | exit 0 |