From 047aeb5c299c686ec8d46dcd8824f595243e354a Mon Sep 17 00:00:00 2001 From: Alex Kursell Date: Thu, 28 Feb 2019 10:54:43 -0500 Subject: [PATCH] Prevent e2e-tests from running on non-local clusters --- Makefile | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Makefile b/Makefile index 2337af28d..eefe7742a 100644 --- a/Makefile +++ b/Makefile @@ -45,6 +45,7 @@ PKG = k8s.io/ingress-nginx ARCH ?= $(shell go env GOARCH) GOARCH = ${ARCH} DUMB_ARCH = ${ARCH} +KUBECTL_CONTEXT = $(shell kubectl config current-context) GOBUILD_FLAGS := @@ -182,6 +183,14 @@ lua-test: .PHONY: e2e-test e2e-test: + if [ "$(KUBECTL_CONTEXT)" != "minikube" ] && \ + [ "$(KUBECTL_CONTEXT)" != "kind" ] && \ + [ "$(KUBECTL_CONTEXT)" != "dind" ] && \ + [ "$(KUBECTL_CONTEXT)" != "docker-for-desktop" ]; then \ + echo "kubectl context is "$(KUBECTL_CONTEXT)", but must be one of [minikube, kind, dind, docker-for-deskop]"; \ + exit 1; \ + fi + echo "Granting permissions to ingress-nginx e2e service account..." kubectl create serviceaccount ingress-nginx-e2e || true kubectl create clusterrolebinding permissive-binding \