From 2bfc3c2bee94b81c7f67818cb480468380fe6508 Mon Sep 17 00:00:00 2001 From: Or Shoval Date: Tue, 3 Sep 2024 12:38:20 +0300 Subject: [PATCH] Allow setting custom KUBECONFIG In order to allow cluster-sync providers that were not created by the default scripts in this repo, allow setting custom KUBECONFIG which is all needed for cluster-sync and test-e2e targets. Signed-off-by: Or Shoval --- Makefile | 4 +++- hack/cluster.sh | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index f0c95663..6a60e676 100644 --- a/Makefile +++ b/Makefile @@ -3,6 +3,8 @@ IMG ?= kubevirt-ipam-controller:latest PASST_IMG ?= kubevirt/passt-binding-cni:latest +export KUBECONFIG ?= $(shell pwd)/.output/kubeconfig + # ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary. ENVTEST_K8S_VERSION = 1.29.0 @@ -72,7 +74,7 @@ test: manifests generate fmt vet envtest ## Run tests. # Utilize Kind or modify the e2e tests to load the image locally, enabling compatibility with other vendors. .PHONY: test-e2e # Run the e2e tests against a Kind k8s instance that is spun up. test-e2e: - export KUBECONFIG=$$(pwd)/.output/kubeconfig && \ + export KUBECONFIG=${KUBECONFIG} && \ export PATH=$$(pwd)/.output/ovn-kubernetes/bin:$${PATH} && \ export REPORT_PATH=$$(pwd)/.output/ && \ cd test/e2e && \ diff --git a/hack/cluster.sh b/hack/cluster.sh index 0f73c27b..0c897376 100755 --- a/hack/cluster.sh +++ b/hack/cluster.sh @@ -14,7 +14,7 @@ OVN_KUBERNETES_DIR=${OUTPUT_DIR}/ovn-kubernetes # from https://github.com/kubernetes-sigs/kind/releases KIND_BIN=${OUTPUT_DIR}/kind -export KUBECONFIG=${OUTPUT_DIR}/kubeconfig +export KUBECONFIG=${KUBECONFIG:-${OUTPUT_DIR}/kubeconfig} cluster_name=virt-ipam op=$1