From b89887f59079ea4543a8387ba1862777c8270d23 Mon Sep 17 00:00:00 2001 From: Sehyo Chang Date: Sun, 8 Aug 2021 20:38:51 +0000 Subject: [PATCH] disable k8 if build image_version is supplied (#1400) This is for #1363. Disable building image if image version is supplied. This is useful in the Mac where building image might not work. In this case, we use image supplied built using Linux. Also, by default use proxy for accessing Minikube cluster since Docker for Mac doesn't map ports from Minikube to host automatically. --- Makefile | 9 ++++++--- k8-util/cluster/reset-minikube.sh | 11 +++++++++-- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 727615d7da0..15c88b2075e 100644 --- a/Makefile +++ b/Makefile @@ -5,9 +5,9 @@ GIT_COMMIT=$(shell git rev-parse HEAD) DOCKER_TAG=$(VERSION)-$(GIT_COMMIT) DOCKER_REGISTRY=infinyon K8_CLUSTER?=$(shell ./k8-util/cluster/cluster-type.sh) -DOCKER_IMAGE=$(DOCKER_REGISTRY)/fluvio TARGET_MUSL=x86_64-unknown-linux-musl TARGET?= +IMAGE_VERSION?= # If set, this indicates that the image is pre-built and should not be built BUILD_PROFILE=$(if $(RELEASE),release,debug) CARGO_BUILDER=$(if $(findstring arm,$(TARGET)),cross,cargo) # If TARGET contains the substring "arm" FLUVIO_BIN=$(if $(TARGET),./target/$(TARGET)/$(BUILD_PROFILE)/fluvio,./target/$(BUILD_PROFILE)/fluvio) @@ -33,7 +33,7 @@ TEST_ENV_FLV_SPU_DELAY= TEST_ARG_SPU=--spu ${DEFAULT_SPU} TEST_ARG_LOG=--client-log ${CLIENT_LOG} --server-log ${SERVER_LOG} TEST_ARG_REPLICATION=-r ${REPL} -TEST_ARG_DEVELOP=--develop +TEST_ARG_DEVELOP=$(if $(IMAGE_VERSION),--image-version ${IMAGE_VERSION}, --develop) TEST_ARG_SKIP_CHECKS= TEST_ARG_EXTRA= TEST_ARG_CONSUMER_WAIT= @@ -54,6 +54,7 @@ helm_pkg: build-cli: install_rustup_target $(CARGO_BUILDER) build --bin fluvio $(RELEASE_FLAG) $(TARGET_FLAG) $(VERBOSE_FLAG) + build-cli-minimal: install_rustup_target # https://github.com/infinyon/fluvio/issues/1255 cargo build --bin fluvio $(RELEASE_FLAG) $(TARGET_FLAG) $(VERBOSE_FLAG) --no-default-features --features consumer --manifest-path ./src/cli/Cargo.toml @@ -125,7 +126,7 @@ k8-setup: # Kubernetes Tests smoke-test-k8: TEST_ARG_EXTRA=$(EXTRA_ARG) -smoke-test-k8: build_k8_image smoke-test +smoke-test-k8: smoke-test build_k8_image smoke-test-k8-tls: TEST_ARG_EXTRA=--tls $(EXTRA_ARG) smoke-test-k8-tls: build_k8_image smoke-test @@ -230,6 +231,8 @@ run-client-doc-test: install_rustup_target # In CI mode, do not build k8 image ifeq (${CI},true) build_k8_image: +else ifeq (${IMAGE_VERSION},true) +build_k8_image: else # When not in CI (i.e. development), build image before testing build_k8_image: fluvio_image diff --git a/k8-util/cluster/reset-minikube.sh b/k8-util/cluster/reset-minikube.sh index 9b445482acb..aeb954e4a98 100755 --- a/k8-util/cluster/reset-minikube.sh +++ b/k8-util/cluster/reset-minikube.sh @@ -1,9 +1,16 @@ #!/bin/bash # delete and re-install minikube ready for fluvio -# this defaults to docker and assume you have have sudo access +# it uses docker as default driver set -e +set -x ARG1=${1:-docker} K8_VERSION=${2:-1.21.2} + +if [ "$(uname)" == "Darwin" ]; then +EXTRA_CONFIG=--extra-config=apiserver.service-node-port-range=32700-32800 --ports=127.0.0.1:32700-32800:32700-32800 +fi + + minikube delete -minikube start --driver $ARG1 --kubernetes-version=$K8_VERSION +minikube start --driver $ARG1 --kubernetes-version=$K8_VERSION $EXTRA_CONFIG # minikube start --extra-config=apiserver.v=10 \ No newline at end of file