forked from inspektor-gadget/inspektor-gadget
-
Notifications
You must be signed in to change notification settings - Fork 0
/
minikube.mk
52 lines (39 loc) · 1.58 KB
/
minikube.mk
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
MINIKUBE_VERSION ?= v1.33.1
KUBERNETES_VERSION ?= v1.30.0
MINIKUBE_DRIVER ?= docker
PROJECT_DIR := $(shell dirname $(abspath $(lastword $(MAKEFILE_LIST))))
MINIKUBE_DIR ?= $(PROJECT_DIR)/bin/minikube
CONTAINER_RUNTIME ?= docker
# make does not allow implicit rules (with '%') to be phony so let's use
# the 'phony_explicit' dependency to make implicit rules inherit the phony
# attribute
.PHONY: phony_explicit
phony_explicit:
# minikube
MINIKUBE = $(MINIKUBE_DIR)/minikube-$(MINIKUBE_VERSION)
.PHONY: minikube-install
minikube-install:
mkdir -p $(MINIKUBE_DIR)
test -e $(MINIKUBE_DIR)/minikube-$(MINIKUBE_VERSION) || \
(cd $(MINIKUBE_DIR) && curl -Lo ./minikube-$(MINIKUBE_VERSION) https://github.com/kubernetes/minikube/releases/download/$(MINIKUBE_VERSION)/minikube-linux-$(shell go env GOHOSTARCH))
chmod +x $(MINIKUBE_DIR)/minikube-$(MINIKUBE_VERSION)
# clean
.PHONY: minikube-clean
minikube-clean:
$(MINIKUBE) delete -p minikube-docker
$(MINIKUBE) delete -p minikube-containerd
$(MINIKUBE) delete -p minikube-cri-o
rm -rf $(MINIKUBE_DIR)
# start
MINIKUBE_START_TARGETS = \
minikube-start-docker \
minikube-start-containerd \
minikube-start-cri-o
.PHONY: minikube-start-all
minikube-start-all: $(MINIKUBE_START_TARGETS)
minikube-start: minikube-start-$(CONTAINER_RUNTIME)
.PHONY: phony_explicit
minikube-start-%: minikube-install
$(MINIKUBE) status -p minikube-$* -f {{.APIServer}} >/dev/null || \
$(MINIKUBE) start -p minikube-$* --driver=$(MINIKUBE_DRIVER) --kubernetes-version=$(KUBERNETES_VERSION) --container-runtime=$* --wait=all $${MINIKUBE_PARAMS}
$(MINIKUBE) profile minikube-$*