-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbootstrap.sh
More file actions
executable file
·67 lines (55 loc) · 1.33 KB
/
bootstrap.sh
File metadata and controls
executable file
·67 lines (55 loc) · 1.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/bin/bash
set -Eeuo pipefail
function check_binaries() {
local missing_binaries=()
local bold=$(tput bold)
check_binary() {
if ! command -v "$1" &>/dev/null; then
missing_binaries+=("$1")
fi
}
check_binary minikube
check_binary helm
check_binary kubectl
if [[ ${#missing_binaries[@]} -gt 0 ]]; then
echo "The following binaries are not installed: ${bold}${missing_binaries[*]}. Please make sure you install \
them before running the script."
exit 1
fi
}
function start_minikube()
{
if minikube status | grep -q Running; then
echo "Minikube is already running..."
else
echo "Starting minikube..."
minikube start
until minikube status | grep -q Running; do
sleep 1
done
fi
}
function check_namespace() {
local namespace="logfilter-demo"
if kubectl get namespace $namespace &>/dev/null; then
echo "Namespace $namespace already exists. Skipping..."
else
echo "Creating namespace $namespace..."
kubectl create namespace $namespace
fi
}
function install_chart(){
echo "Installing OurApp Helm chart..."
helm upgrade -i our-app charts/logfilter -f charts/logfilter/values.yaml -n logfilter-demo || {
echo "Error installing OurApp Helm chart"
exit 1
}
}
main()
{
check_binaries
start_minikube
check_namespace
install_chart
}
main "$@"