-
Notifications
You must be signed in to change notification settings - Fork 1
/
minikube.sh
executable file
·98 lines (86 loc) · 2.49 KB
/
minikube.sh
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
#!/usr/bin/env bash
set -o verbose
export GKE_DOCKER_REGISTRY=gcr.io
export GKE_PROJECT_ID=light-reality-205619
function minikube::start {
echo "Starting minikube..."
minikube config set WantUpdateNotification false
minikube start \
--install-addons=true \
--addons=registry \
--wait=all \
--wait-timeout=5m
kubectl config use-context minikube
kubectl get nodes -o name | xargs -I {} kubectl label {} --overwrite \
platform.neuromation.io/nodepool=minikube
}
function minikube::load_images {
echo "Loading images to minikube..."
make docker_pull_test_images
}
function minikube::apply_all_configurations {
echo "Applying configurations..."
kubectl config use-context minikube
kubectl apply -f tests/k8s/rbac.yml
kubectl apply -f tests/k8s/logging.yml
kubectl apply -f tests/k8s/platformauth.yml
kubectl apply -f tests/k8s/platformconfig.yml
kubectl apply -f tests/k8s/platformadmin.yml
kubectl apply -f tests/k8s/platformapi.yml
kubectl apply -f tests/k8s/platformnotifications.yml
kubectl apply -f tests/k8s/platformcontainerruntime.yml
}
function minikube::clean {
echo "Cleaning up..."
kubectl config use-context minikube
kubectl delete -f tests/k8s/rbac.yml
kubectl delete -f tests/k8s/logging.yml
kubectl delete -f tests/k8s/platformconfig.yml
kubectl delete -f tests/k8s/platformapi.yml
kubectl delete -f tests/k8s/platformnotifications.yml
kubectl delete -f tests/k8s/platformcontainerruntime.yml
}
function minikube::stop {
echo "Stopping minikube..."
kubectl config use-context minikube
minikube::clean
minikube stop
}
function check_service() { # attempt, max_attempt, service
local attempt=1
local max_attempts=$1
local service=$2
echo "Checking service $service..."
until minikube service $service --url; do
if [ $attempt == $max_attempts ]; then
echo "Can't connect to the container"
exit 1
fi
sleep 1
((attempt++))
done
}
function minikube::apply {
minikube status
minikube::apply_all_configurations
max_attempts=30
check_service $max_attempts platformapi
check_service $max_attempts platformauthapi
}
case "${1:-}" in
start)
minikube::start
;;
load-images)
minikube::load_images
;;
apply)
minikube::apply
;;
clean)
minikube::clean
;;
stop)
minikube::stop
;;
esac