-
Notifications
You must be signed in to change notification settings - Fork 817
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update minikube dev tooling #1906
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,13 +31,6 @@ sha_dir = $(shell sha256sum $(1) | cut -d' ' -f1 | sha256sum | head -c 10 ) | |
|
||
# Minikube executable | ||
MINIKUBE ?= minikube | ||
# Default minikube driver | ||
MINIKUBE_DRIVER ?= virtualbox | ||
# set docker env for minikube | ||
MINIKUBE_DOCKER_ENV ?= eval $$($(MINIKUBE) docker-env) | ||
|
||
# minikube shell mount for certificates | ||
minikube_cert_mount := ~/.minikube:$(HOME)/.minikube | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This one also might be needed and be different for different OSs. WDYT? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For OSX and Linux it's the same. It may be the same for minikube under WSL, but it requires testing. But I figure we can revisit if we decide it's possible to support windows without hackery. |
||
|
||
# _____ _ | ||
# |_ _|_ _ _ __ __ _ ___| |_ ___ | ||
|
@@ -46,11 +39,6 @@ minikube_cert_mount := ~/.minikube:$(HOME)/.minikube | |
# |_|\__,_|_| \__, |\___|\__|___/ | ||
# |___/ | ||
|
||
# Does not do anything | ||
minikube-post-start: | ||
# kubectl > 1.11 may have --address flag, but for the time being, | ||
# we will use --network=host, as port-forward binds to localhost | ||
|
||
# port forward the agones controller. | ||
# useful for pprof and stats viewing, etc | ||
controller-portforward: PORT ?= 8080 | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,10 @@ | |
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
MINIKUBE_DRIVER ?= docker | ||
|
||
# minikube shell mount for certificates | ||
minikube_cert_mount := ~/.minikube:$(HOME)/.minikube | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It seems that Windows would not have this folder. Am I missing something? I can test on my other PC. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is why I changed the README to:
I expect it will all fall apart. Last time I looked at this (many years ago now), kubectl on WSL wouldn't work with minikube because the minikube config referenced certs hosted at I expect the entire Windows dev environment setup would need a review anyway. (do we even have anyone developing on windows?) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Got an idea. That would be a leftover from this PR. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since we have the git history to go back and look at if we need it, I'm not convinced it's necessary to leave this in, given that we don't actually know what the correct path is for windows+minikube dev (or if we even want to support it). This feels to me like leaving in commented out code in the current source repo. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. +1 to not leaving stuff in that is "dead code" in the hope that we will fix it later. It's better to clean it up and we can always look at repo history if necessary to pull it back in. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In which case, I will merge this, and we can revisit Windows at a later date 👍 |
||
|
||
# __ __ _ _ _ _ | ||
# | \/ (_)_ __ (_) | ___ _| |__ ___ | ||
|
@@ -22,58 +26,39 @@ | |
|
||
# Switches to an "agones" profile, and starts a kubernetes cluster | ||
# of the right version. | ||
# | ||
# Use MINIKUBE_DRIVER variable to change the VM driver | ||
# (defaults virtualbox for Linux and macOS, hyperv for windows) if you so desire. | ||
minikube-test-cluster: DOCKER_RUN_ARGS+=--network=host -v $(minikube_cert_mount) | ||
minikube-test-cluster: $(ensure-build-image) minikube-agones-profile | ||
$(MINIKUBE) start --kubernetes-version v1.16.13 --vm-driver $(MINIKUBE_DRIVER) | ||
# wait until the master is up | ||
until docker run --rm $(common_mounts) $(DOCKER_RUN_ARGS) $(build_tag) kubectl cluster-info; \ | ||
do \ | ||
echo "Waiting for cluster to start..."; \ | ||
sleep 1; \ | ||
done | ||
$(MAKE) minikube-post-start | ||
|
||
# switch to the agones cluster | ||
minikube-agones-profile: | ||
$(MINIKUBE) profile $(MINIKUBE_PROFILE) | ||
minikube-test-cluster: $(ensure-build-image) | ||
$(MINIKUBE) start --kubernetes-version v1.17.13 -p $(MINIKUBE_PROFILE) --vm-driver $(MINIKUBE_DRIVER) | ||
|
||
# Connecting to minikube requires so enhanced permissions, so use this target | ||
# instead of `make shell` to start an interactive shell for development on minikube. | ||
minikube-shell: $(ensure-build-image) minikube-agones-profile | ||
minikube-shell: $(ensure-build-image) | ||
$(MAKE) shell DOCKER_RUN_ARGS="--network=host -v $(minikube_cert_mount) $(DOCKER_RUN_ARGS)" | ||
|
||
# Push the local Agones Docker images that have already been built | ||
# via `make build` or `make build-images` into the "agones" minikube instance. | ||
minikube-push: minikube-agones-profile | ||
$(MAKE) minikube-transfer-image TAG=$(sidecar_tag) | ||
$(MAKE) minikube-transfer-image TAG=$(controller_tag) | ||
$(MAKE) minikube-transfer-image TAG=$(ping_tag) | ||
$(MAKE) minikube-transfer-image TAG=$(allocator_tag) | ||
minikube-push: | ||
$(MINIKUBE) cache add $(sidecar_tag) | ||
$(MINIKUBE) cache add $(controller_tag) | ||
$(MINIKUBE) cache add $(ping_tag) | ||
$(MINIKUBE) cache add $(allocator_tag) | ||
|
||
# Installs the current development version of Agones into the Kubernetes cluster. | ||
# Use this instead of `make install`, as it disables PullAlways on the install.yaml | ||
minikube-install: minikube-agones-profile | ||
minikube-install: | ||
$(MAKE) install DOCKER_RUN_ARGS="--network=host -v $(minikube_cert_mount)" ALWAYS_PULL_SIDECAR=false \ | ||
IMAGE_PULL_POLICY=IfNotPresent PING_SERVICE_TYPE=NodePort ALLOCATOR_SERVICE_TYPE=NodePort | ||
|
||
minikube-uninstall: $(ensure-build-image) minikube-agones-profile | ||
minikube-uninstall: $(ensure-build-image) | ||
$(MAKE) uninstall DOCKER_RUN_ARGS="--network=host -v $(minikube_cert_mount)" | ||
|
||
# Convenience target for transferring images into minikube. | ||
# Use TAG to specify the image to transfer into minikube | ||
minikube-transfer-image: | ||
docker save $(TAG) | ($(MINIKUBE_DOCKER_ENV) && docker load) | ||
|
||
# Runs e2e tests against our minikube | ||
minikube-test-e2e: DOCKER_RUN_ARGS=--network=host -v $(minikube_cert_mount) | ||
minikube-test-e2e: minikube-agones-profile test-e2e | ||
minikube-test-e2e: test-e2e | ||
|
||
# Runs stress tests against our minikube | ||
minikube-stress-test-e2e: DOCKER_RUN_ARGS=--network=host -v $(minikube_cert_mount) | ||
minikube-stress-test-e2e: minikube-agones-profile stress-test-e2e | ||
minikube-stress-test-e2e: stress-test-e2e | ||
|
||
# prometheus on minkube | ||
# we have to disable PVC as it's not supported on minkube. | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,20 +31,6 @@ sha_dir = $(shell sha256sum $(1) | cut -d' ' -f1 | sha256sum | head -c 10 ) | |
|
||
# Minikube executable | ||
MINIKUBE ?= minikube.exe | ||
# Default minikube driver | ||
MINIKUBE_DRIVER ?= hyperv | ||
# set docker env for minikube | ||
MINIKUBE_DOCKER_ENV ?= eval $$($(MINIKUBE) docker-env --shell=bash) && \ | ||
export DOCKER_CERT_PATH=$$(echo $$DOCKER_CERT_PATH | $(win_to_wsl_path)) | ||
|
||
# minikube shell mount for certificates | ||
minikube_cert_mount = $(cert_path):$(cert_path) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this one should stay there There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So the previous Windows support was super hacky, brittle and I expect it doesn't work anymore. We were rewriting windows path to linux paths in make files. If we decide to continue supporting it, it needs a whole new rewrite. So I've removed it for now. If we need to add new os specific tooling, then lets revisit then. Right now, between OSX and Linux, it's all the same. |
||
|
||
# transform the path from windows to WSL | ||
win_to_wsl_path := sed -e 's|\([A-Z]\):|/\L\1|' -e 's|\\|/|g' | ||
|
||
# find the cert path | ||
cert_path = $(realpath $(shell $(MINIKUBE) docker-env --shell bash | grep DOCKER_CERT_PATH | awk -F "=" '{ print $$2 }' | sed 's/"//g' | $(win_to_wsl_path))/..) | ||
|
||
# _____ _ | ||
# |_ _|_ _ _ __ __ _ ___| |_ ___ | ||
|
@@ -53,18 +39,6 @@ cert_path = $(realpath $(shell $(MINIKUBE) docker-env --shell bash | grep DOCKER | |
# |_|\__,_|_| \__, |\___|\__|___/ | ||
# |___/ | ||
|
||
# Sets minikube credentials | ||
minikube-post-start: | ||
echo "Creating minikube credentials" | ||
export CERT_PATH=$(cert_path) && \ | ||
docker run --rm $(common_mounts) $(DOCKER_RUN_ARGS) $(build_tag) kubectl config set-cluster $(MINIKUBE_PROFILE) \ | ||
--certificate-authority=$$CERT_PATH/ca.crt --server=https://$$($(MINIKUBE) ip):8443 && \ | ||
docker run --rm $(common_mounts) $(DOCKER_RUN_ARGS) $(build_tag) kubectl config set-credentials $(MINIKUBE_PROFILE) \ | ||
--client-certificate=$$CERT_PATH/client.crt --client-key=$$CERT_PATH/client.key | ||
docker run --rm $(common_mounts) $(DOCKER_RUN_ARGS) $(build_tag) kubectl config set-context $(MINIKUBE_PROFILE) \ | ||
--cluster=$(MINIKUBE_PROFILE) --user=$(MINIKUBE_PROFILE) | ||
docker run --rm $(common_mounts) $(DOCKER_RUN_ARGS) $(build_tag) kubectl config use-context $(MINIKUBE_PROFILE) | ||
|
||
# port forward the agones controller. | ||
# useful for pprof and stats viewing, etc | ||
controller-portforward: PORT ?= 8080 | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see that additional command which changes profile was removed. Was it redundant?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is now powered by the
-p
argument inminikube start
- which also creates the profile.minikube profile foo
will not create the profile if it doesn't exist.https://minikube.sigs.k8s.io/docs/commands/start/