agones.dev/agones@v1.54.0/build/includes/minikube.mk (about) 1 # Copyright 2019 Google LLC All Rights Reserved. 2 # 3 # Licensed under the Apache License, Version 2.0 (the "License"); 4 # you may not use this file except in compliance with the License. 5 # You may obtain a copy of the License at 6 # 7 # http://www.apache.org/licenses/LICENSE-2.0 8 # 9 # Unless required by applicable law or agreed to in writing, software 10 # distributed under the License is distributed on an "AS IS" BASIS, 11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 # See the License for the specific language governing permissions and 13 # limitations under the License. 14 15 MINIKUBE_DRIVER ?= docker 16 MINIKUBE_NODES ?= 1 17 18 # minikube shell mount for certificates 19 minikube_cert_mount := ~/.minikube:$(HOME)/.minikube 20 21 # __ __ _ _ _ _ 22 # | \/ (_)_ __ (_) | ___ _| |__ ___ 23 # | |\/| | | '_ \| | |/ / | | | '_ \ / _ \ 24 # | | | | | | | | | <| |_| | |_) | __/ 25 # |_| |_|_|_| |_|_|_|\_\\__,_|_.__/ \___| 26 # 27 28 # Switches to an "agones" profile, and starts a kubernetes cluster 29 # of the right version. 30 minikube-test-cluster: DOCKER_RUN_ARGS+=--network=host -v $(minikube_cert_mount) 31 minikube-test-cluster: $(ensure-build-image) 32 $(MINIKUBE) start --kubernetes-version v1.33.5 -p $(MINIKUBE_PROFILE) --driver $(MINIKUBE_DRIVER) --nodes $(MINIKUBE_NODES) 33 $(MAKE) minikube-metallb-helm-install 34 $(MAKE) minikube-metallb-configure 35 36 # minikube-metallb-helm-install installs metallb via helm 37 minikube-metallb-helm-install: 38 helm repo add metallb https://metallb.github.io/metallb 39 helm repo update 40 helm upgrade metallb metallb/metallb --install --namespace metallb-system --create-namespace --version 0.15.2 --wait --timeout 5m 41 42 # minikube-metallb-configure configures metallb with an ip address range based on the minikube ip 43 minikube-metallb-configure: 44 MINIKUBE_IP=$$($(MINIKUBE) ip -p $(MINIKUBE_PROFILE)); \ 45 NETWORK_PREFIX=$$(echo "$$MINIKUBE_IP" | cut -d '.' -f 1-3); \ 46 METALLB_IP_RANGE="$$NETWORK_PREFIX.50-$$NETWORK_PREFIX.250"; \ 47 sed "s|__RANGE__|$${METALLB_IP_RANGE}|g" $(build_path)/metallb-config.yaml.tpl | kubectl apply -f - 48 49 # Connecting to minikube requires so enhanced permissions, so use this target 50 # instead of `make shell` to start an interactive shell for development on minikube. 51 minikube-shell: $(ensure-build-image) 52 $(MAKE) shell DOCKER_RUN_ARGS="--network=host -v $(minikube_cert_mount) $(DOCKER_RUN_ARGS)" 53 54 # Push the local Agones Docker images that have already been built 55 # via `make build` or `make build-images` into the "agones" minikube instance. 56 minikube-push: 57 $(MINIKUBE) image load $(sidecar_linux_amd64_tag) -p $(MINIKUBE_PROFILE) 58 $(MINIKUBE) image load $(controller_amd64_tag) -p $(MINIKUBE_PROFILE) 59 $(MINIKUBE) image load $(ping_amd64_tag) -p $(MINIKUBE_PROFILE) 60 $(MINIKUBE) image load $(allocator_amd64_tag) -p $(MINIKUBE_PROFILE) 61 $(MINIKUBE) image load $(extensions_amd64_tag) -p $(MINIKUBE_PROFILE) 62 $(MINIKUBE) image load $(processor_amd64_tag) -p $(MINIKUBE_PROFILE) 63 64 $(MINIKUBE) image tag $(sidecar_linux_amd64_tag) $(sidecar_tag) -p $(MINIKUBE_PROFILE) 65 $(MINIKUBE) image tag $(controller_amd64_tag) $(controller_tag) -p $(MINIKUBE_PROFILE) 66 $(MINIKUBE) image tag $(ping_amd64_tag) $(ping_tag) -p $(MINIKUBE_PROFILE) 67 $(MINIKUBE) image tag $(allocator_amd64_tag) $(allocator_tag) -p $(MINIKUBE_PROFILE) 68 $(MINIKUBE) image tag $(extensions_amd64_tag) $(extensions_tag) -p $(MINIKUBE_PROFILE) 69 $(MINIKUBE) image tag $(processor_amd64_tag) $(processor_tag) -p $(MINIKUBE_PROFILE) 70 71 # Installs the current development version of Agones into the Kubernetes cluster. 72 # Use this instead of `make install`, as it disables PullAlways on the install.yaml 73 minikube-install: PING_SERVICE_TYPE := LoadBalancer 74 minikube-install: ALLOCATOR_SERVICE_TYPE := LoadBalancer 75 minikube-install: 76 $(MAKE) install DOCKER_RUN_ARGS="--network=host -v $(minikube_cert_mount)" ALWAYS_PULL_SIDECAR=false \ 77 IMAGE_PULL_POLICY=IfNotPresent PING_SERVICE_TYPE=$(PING_SERVICE_TYPE) \ 78 ALLOCATOR_SERVICE_TYPE=$(ALLOCATOR_SERVICE_TYPE) 79 80 minikube-uninstall: $(ensure-build-image) 81 $(MAKE) uninstall DOCKER_RUN_ARGS="--network=host -v $(minikube_cert_mount)" 82 83 # Runs e2e tests against our minikube 84 minikube-test-e2e: DOCKER_RUN_ARGS=--network=host -v $(minikube_cert_mount) 85 minikube-test-e2e: test-e2e 86 87 # Runs stress tests against our minikube 88 minikube-stress-test-e2e: DOCKER_RUN_ARGS=--network=host -v $(minikube_cert_mount) 89 minikube-stress-test-e2e: stress-test-e2e 90 91 # prometheus on minkube 92 # we have to disable PVC as it's not supported on minkube. 93 minikube-setup-prometheus: 94 $(MAKE) setup-prometheus \ 95 DOCKER_RUN_ARGS="--network=host -v $(minikube_cert_mount)" \ 96 PVC=false HELM_ARGS="--set server.resources.requests.cpu=0,server.resources.requests.memory=0" 97 98 # grafana on minkube with dashboards and prometheus datasource installed. 99 # we have to disable PVC as it's not supported on minkube. 100 minikube-setup-grafana: 101 $(MAKE) setup-grafana \ 102 DOCKER_RUN_ARGS="--network=host -v $(minikube_cert_mount)" 103 104 # prometheus-stack on minkube 105 # we have to disable PVC as it's not supported on minkube. 106 minikube-setup-prometheus-stack: 107 $(MAKE) setup-prometheus-stack \ 108 DOCKER_RUN_ARGS="--network=host -v $(minikube_cert_mount)" \ 109 PVC=false HELM_ARGS="--set prometheus.server.resources.requests.cpu=0,prometheus.server.resources.requests.memory=0" 110 111 # minikube port forwarding 112 minikube-controller-portforward: 113 $(MAKE) controller-portforward DOCKER_RUN_ARGS="--network=host -v $(minikube_cert_mount)" 114 115 # minikube port forwarding grafana 116 minikube-grafana-portforward: 117 $(MAKE) grafana-portforward \ 118 DOCKER_RUN_ARGS="--network=host -v $(minikube_cert_mount)" 119 120 # minikube port forwarding for prometheus web ui 121 minikube-prometheus-portforward: 122 $(MAKE) prometheus-portforward \ 123 DOCKER_RUN_ARGS="--network=host -v $(minikube_cert_mount)"