Fix some cases with e2e targets

The e2e targets were not setup correctly preventing some variables from
being set.
This commit is contained in:
Brian Goff
2019-04-03 22:55:33 -07:00
parent 9dc78bd4d3
commit af06b005b2
2 changed files with 48 additions and 43 deletions

47
Makefile.e2e Normal file
View File

@@ -0,0 +1,47 @@
.PHONY: skaffold.validate
skaffold.validate: kubectl_context := $(shell kubectl config current-context)
skaffold.validate:
if [[ ! "minikube,docker-for-desktop,docker-desktop" =~ .*"$(kubectl_context)".* ]]; then \
echo current-context is [$(kubectl_context)]. Must be one of [minikube,docker-for-desktop,docker-desktop]; \
false; \
fi
# skaffold deploys the virtual-kubelet to the Kubernetes cluster targeted by the current kubeconfig using skaffold.
# The current context (as indicated by "kubectl config current-context") must be one of "minikube" or "docker-for-desktop".
# MODE must be set to one of "dev" (default), "delete" or "run", and is used as the skaffold command to be run.
.PHONY: skaffold
skaffold: MODE ?= dev
skaffold: skaffold/$(MODE)
.PHONY: skaffold/%
skaffold/%: PROFILE := local
skaffold/%: skaffold.validate
skaffold $(*) \
-f $(PWD)/hack/skaffold/virtual-kubelet/skaffold.yml \
-p $(PROFILE)
# e2e runs the end-to-end test suite against the Kubernetes cluster targeted by the current kubeconfig.
# It automatically deploys the virtual-kubelet with the mock provider by running "make skaffold MODE=run".
# It is the caller's responsibility to cleanup the deployment after running this target (e.g. by running "make skaffold MODE=delete").
.PHONY: e2e
e2e: KUBECONFIG ?= $(HOME)/.kube/config
e2e: NAMESPACE := default
e2e: NODE_NAME := vkubelet-mock-0
e2e: TAINT_KEY := virtual-kubelet.io/provider
e2e: TAINT_VALUE := mock
e2e: TAINT_EFFECT := NoSchedule
e2e: tags_with_mock := $(VK_BUILD_TAGS) mock
e2e: e2e.clean
GOOS=linux GOARCH=amd64 $(MAKE) VK_BUILD_TAGS="$(tags_with_mock)" build; \
$(MAKE) skaffold/run; \
cd $(PWD)/test/e2e && go test -v -tags e2e ./... \
-kubeconfig=$(KUBECONFIG) \
-namespace=$(NAMESPACE) \
-node-name=$(NODE_NAME) \
-taint-key=$(TAINT_KEY) \
-taint-value=$(TAINT_VALUE) \
-taint-effect=$(TAINT_EFFECT)
.PHONY: e2e.clean
e2e.clean: #skaffold/delete
kubectl delete --ignore-not-found node $(NODE_NAME)