Skip to content
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

test: Pass k8s version as variable to e2e scripts #440

Merged
merged 1 commit into from
Feb 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 17 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ OUTPUT_TYPE ?= type=docker
BUILDPLATFORM ?= linux/amd64
IMG_TAG ?= $(subst v,,$(VERSION))
INIT_IMG_TAG ?= 0.1.0
K8S_VERSION ?= 1.23.12


## --------------------------------------
Expand Down Expand Up @@ -92,15 +93,28 @@ clean:
.PHONY: test
test:
@echo running tests
LOCATION=$(LOCATION) AZURE_AUTH_LOCATION=$(TEST_CREDENTIALS_JSON) LOG_ANALYTICS_AUTH_LOCATION=$(TEST_LOGANALYTICS_JSON) go test -v $(shell go list ./... | grep -v /e2e) -race -coverprofile=coverage.out -covermode=atomic
LOCATION=$(LOCATION) AZURE_AUTH_LOCATION=$(TEST_CREDENTIALS_JSON) \
LOG_ANALYTICS_AUTH_LOCATION=$(TEST_LOGANALYTICS_JSON) \
go test -v $(shell go list ./... | grep -v /e2e) -race -coverprofile=coverage.out -covermode=atomic

.PHONY: e2e-test
e2e-test:
PR_RAND=$(PR_COMMIT_SHA) E2E_TARGET=$(E2E_TARGET) IMG_URL=$(REGISTRY) IMG_REPO=$(IMG_NAME) IMG_TAG=$(IMG_TAG) LOCATION=$(LOCATION) RESOURCE_GROUP=$(E2E_CLUSTER_NAME) $(AKS_E2E_SCRIPT) go test -timeout 30m -v ./e2e
PR_RAND=$(PR_COMMIT_SHA) E2E_TARGET=$(E2E_TARGET) \
IMG_URL=$(REGISTRY) IMG_REPO=$(IMG_NAME) IMG_TAG=$(IMG_TAG) \
INIT_IMG_REPO=$(INIT_IMG_REPO) INIT_IMG_TAG=$(INIT_IMG_TAG) \
LOCATION=$(LOCATION) RESOURCE_GROUP=$(E2E_CLUSTER_NAME) \
K8S_VERSION=$(K8S_VERSION) \
$(AKS_E2E_SCRIPT) go test -timeout 30m -v ./e2e

.PHONY: aks-addon-e2e-test
aks-addon-e2e-test:
PR_RAND=$(PR_COMMIT_SHA) E2E_TARGET=$(E2E_TARGET) IMG_URL=$(REGISTRY) IMG_REPO=$(IMG_NAME) IMG_TAG=$(IMG_TAG) LOCATION=$(LOCATION) RESOURCE_GROUP=$(E2E_CLUSTER_NAME) $(AKS_ADDON_E2E_SCRIPT) go test -timeout 30m -v ./e2e
PR_RAND=$(PR_COMMIT_SHA) E2E_TARGET=$(E2E_TARGET) \
IMG_URL=$(REGISTRY) IMG_REPO=$(IMG_NAME) IMG_TAG=$(IMG_TAG) \
INIT_IMG_REPO=$(INIT_IMG_REPO) INIT_IMG_TAG=$(INIT_IMG_TAG) \
LOCATION=$(LOCATION) RESOURCE_GROUP=$(E2E_CLUSTER_NAME) \
K8S_VERSION=$(K8S_VERSION) \
$(AKS_ADDON_E2E_SCRIPT) go test -timeout 30m -v ./e2e

.PHONY: vet
vet:
@go vet ./... #$(packages)
Expand Down
5 changes: 3 additions & 2 deletions hack/e2e/aks-addon.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ fi
: "${ACR_NAME=aksaddonacr$RANDOM_NUM}"
: "${CSI_DRIVER_STORAGE_ACCOUNT_NAME=aksaddonvk$RANDOM_NUM}"
: "${CSI_DRIVER_SHARE_NAME=vncsidriversharename}"
: "${K8S_VERSION:=1.23.12}"

error() {
echo "$@" >&2
Expand Down Expand Up @@ -112,7 +113,7 @@ cluster_subnet_id="$(az network vnet subnet show \
if [ "$E2E_TARGET" = "pr" ]; then
az aks create \
-g "$RESOURCE_GROUP" \
--kubernetes-version "1.23.12" \
--kubernetes-version "$K8S_VERSION" \
-l "$LOCATION" \
-c "$NODE_COUNT" \
--node-vm-size standard_d8_v3 \
Expand All @@ -127,7 +128,7 @@ else

az aks create \
-g "$RESOURCE_GROUP" \
--kubernetes-version "1.23.12" \
--kubernetes-version "$K8S_VERSION" \
-l "$LOCATION" \
-c "$NODE_COUNT" \
--node-vm-size standard_d8_v3 \
Expand Down
5 changes: 3 additions & 2 deletions hack/e2e/aks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ fi
: "${ACR_NAME=vkacr$RANDOM_NUM}"
: "${CSI_DRIVER_STORAGE_ACCOUNT_NAME=vkcsidrivers$RANDOM_NUM}"
: "${CSI_DRIVER_SHARE_NAME=vncsidriversharename}"
: "${K8S_VERSION:=1.23.12}"

error() {
echo "$@" >&2
Expand Down Expand Up @@ -119,7 +120,7 @@ node_identity_client_id="$(az identity create --name "${RESOURCE_GROUP}-aks-iden
if [ "$E2E_TARGET" = "pr" ]; then
az aks create \
-g "$RESOURCE_GROUP" \
--kubernetes-version "1.23.12" \
--kubernetes-version "$K8S_VERSION" \
-l "$LOCATION" \
-c "$NODE_COUNT" \
--node-vm-size standard_d8_v3 \
Expand All @@ -136,7 +137,7 @@ else

az aks create \
-g "$RESOURCE_GROUP" \
--kubernetes-version "1.23.12" \
--kubernetes-version "$K8S_VERSION" \
-l "$LOCATION" \
-c "$NODE_COUNT" \
--node-vm-size standard_d8_v3 \
Expand Down