diff --git a/Makefile b/Makefile index f8b155324d..316523d6c0 100644 --- a/Makefile +++ b/Makefile @@ -142,7 +142,7 @@ azure-ipam: azure-ipam-binary azure-ipam-archive revision: ## print the current git revision @echo $(REVISION) - + version: ## prints the root version @echo $(ACN_VERSION) @@ -161,15 +161,15 @@ cni-dropgz-test-version: ## prints the cni-dropgz version @echo $(CNI_DROPGZ_TEST_VERSION) cns-version: - @echo $(CNS_VERSION) + @echo $(CNS_VERSION) npm-version: - @echo $(NPM_VERSION) + @echo $(NPM_VERSION) zapai-version: ## prints the zapai version @echo $(ZAPAI_VERSION) -##@ Binaries +##@ Binaries # Build the delegated IPAM plugin binary. azure-ipam-binary: @@ -509,8 +509,8 @@ manifest-build: # util target to compose multiarch container manifests from plat $(MAKE) manifest-add PLATFORM=$(PLATFORM);\ )\ )\ - - + + manifest-push: # util target to push multiarch container manifest. $(CONTAINER_BUILDER) manifest push --all $(IMAGE_REGISTRY)/$(IMAGE):$(TAG) docker://$(IMAGE_REGISTRY)/$(IMAGE):$(TAG) @@ -534,7 +534,7 @@ acncli-manifest-push: ## push acncli multiplat container manifest acncli-skopeo-archive: ## export tar archive of acncli multiplat container manifest. $(MAKE) manifest-skopeo-archive \ IMAGE=$(ACNCLI_IMAGE) \ - TAG=$(ACN_VERSION) + TAG=$(ACN_VERSION) cni-dropgz-manifest-build: ## build cni-dropgz multiplat container manifest. $(MAKE) manifest-build \ @@ -692,7 +692,7 @@ ifeq ($(GOOS),linux) endif -##@ Utils +##@ Utils clean: ## Clean build artifacts. $(RMDIR) $(OUTPUT_DIR) @@ -723,7 +723,7 @@ workspace: ## Set up the Go workspace. go work use ./dropgz go work use ./zapai -##@ Test +##@ Test COVER_PKG ?= . #Restart case is used for cni load test pipeline for restarting the nodes cluster. @@ -762,6 +762,15 @@ test-azure-ipam: ## run the unit test for azure-ipam kind: kind create cluster --config ./test/kind/kind.yaml +test-k8se2e: test-k8se2e-build test-k8se2e-only ## Alias to run build and test + +test-k8se2e-build: ## Build k8s e2e test suite + cd hack/scripts && bash ./k8se2e.sh $(GROUP) $(CLUSTER) + cd ../.. + +test-k8se2e-only: ## Run k8s network conformance test, use TYPE=basic for only datapath tests + cd hack/scripts && bash ./k8se2e-tests.sh $(OS) $(TYPE) + cd ../.. ##@ Utilities @@ -781,7 +790,7 @@ gitconfig: ## configure the local git repository setup: tools install-hooks gitconfig ## performs common required repo setup -##@ Tools +##@ Tools $(TOOLS_DIR)/go.mod: cd $(TOOLS_DIR); go mod init && go mod tidy @@ -791,7 +800,7 @@ $(CONTROLLER_GEN): $(TOOLS_DIR)/go.mod controller-gen: $(CONTROLLER_GEN) ## Build controller-gen -protoc: +protoc: source ${REPO_ROOT}/scripts/install-protoc.sh $(GOCOV): $(TOOLS_DIR)/go.mod @@ -824,13 +833,13 @@ $(MOCKGEN): $(TOOLS_DIR)/go.mod mockgen: $(MOCKGEN) ## Build mockgen -clean-tools: +clean-tools: rm -r build/tools/bin tools: acncli gocov gocov-xml go-junit-report golangci-lint gofumpt protoc ## Build bins for build tools -##@ Help +##@ Help help: ## Display this help - @awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m\033[0m\n"} /^[a-zA-Z_-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST) + @awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m\033[0m\n"} /^[0-9a-zA-Z_-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST) diff --git a/hack/aks/Makefile b/hack/aks/Makefile index 14e2f1e0f7..6091dc88a1 100644 --- a/hack/aks/Makefile +++ b/hack/aks/Makefile @@ -25,16 +25,16 @@ VNET ?= $(CLUSTER) ##@ Help help: ## Display this help - @awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m\033[0m\n"} /^[a-zA-Z_-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST) + @awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m\033[0m\n"} /^[0-9a-zA-Z_-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST) ##@ Utilities -azlogin: +azlogin: ## Login and set account to $SUB @$(AZCLI) login @$(AZCLI) account set -s $(SUB) -azcfg: +azcfg: ## Set the $AZCLI to use aks-preview @$(AZCLI) extension add --name aks-preview --yes @$(AZCLI) extension update --name aks-preview @@ -214,7 +214,7 @@ windows-cniv1-up: rg-up overlay-net-up ## Bring up a Windows CNIv1 cluster @$(MAKE) set-kubeconf -linux-cniv1-up: rg-up overlay-net-up +linux-cniv1-up: rg-up overlay-net-up ## Bring up a Linux CNIv1 cluster $(AZCLI) aks create -n $(CLUSTER) -g $(GROUP) -l $(REGION) \ --node-count $(NODE_COUNT) \ --node-vm-size $(VM_SIZE) \ diff --git a/hack/scripts/k8se2e-tests.sh b/hack/scripts/k8se2e-tests.sh new file mode 100644 index 0000000000..5fa60b09cc --- /dev/null +++ b/hack/scripts/k8se2e-tests.sh @@ -0,0 +1,61 @@ +# Taint Linux nodes so that windows tests do not run on them and ensure no LinuxOnly tests run on windows nodes +if [[ 'windows' == $OS ]] +then +SKIP="|LinuxOnly" +kubectl taint nodes -l kubernetes.azure.com/mode=system node-role.kubernetes.io/control-plane:NoSchedule +fi + + + +if [[ 'basic' == $TYPE ]] +then +echo "Testing Datapath" +echo "./ginkgo --nodes=4 \ +./e2e.test -- \ +--num-nodes=2 \ +--provider=skeleton \ +--ginkgo.focus='(.*).Networking.should|(.*).Networking.Granular|(.*)kubernetes.api' \ +--ginkgo.skip='SCTP|Disruptive|Slow|hostNetwork|kube-proxy|IPv6' \ +--ginkgo.flakeAttempts=3 \ +--ginkgo.v \ +--node-os-distro=$OS \ +--kubeconfig=$HOME/.kube/config" +./ginkgo --nodes=4 \ +./e2e.test -- \ +--num-nodes=2 \ +--provider=skeleton \ +--ginkgo.focus='(.*).Networking.should|(.*).Networking.Granular|(.*)kubernetes.api' \ +--ginkgo.skip='SCTP|Disruptive|Slow|hostNetwork|kube-proxy|IPv6' \ +--ginkgo.flakeAttempts=3 \ +--ginkgo.v \ +--node-os-distro=$OS \ +--kubeconfig=$HOME/.kube/config +else +echo "Testing Datapath, DNS, PortForward, Service, and Hostport" +echo "./ginkgo --nodes=4 \ +./e2e.test -- \ +--num-nodes=2 \ +--provider=skeleton \ +--ginkgo.focus='(.*).Networking.should|(.*).Networking.Granular|(.*)kubernetes.api|\[sig-network\].DNS.should|\[sig-cli\].Kubectl.Port|Services.*\[Conformance\].*|\[sig-network\](.*)HostPort|\[sig-scheduling\](.*)hostPort' \ +--ginkgo.skip='SCTP|Disruptive|Slow|hostNetwork|kube-proxy|IPv6|resolv|exists conflict$SKIP' \ +--ginkgo.flakeAttempts=3 \ +--ginkgo.v \ +--node-os-distro=$OS \ +--kubeconfig=$HOME/.kube/config" +./ginkgo --nodes=4 \ +./e2e.test -- \ +--num-nodes=2 \ +--provider=skeleton \ +--ginkgo.focus='(.*).Networking.should|(.*).Networking.Granular|(.*)kubernetes.api|\[sig-network\].DNS.should|\[sig-cli\].Kubectl.Port|Services.*\[Conformance\].*|\[sig-network\](.*)HostPort|\[sig-scheduling\](.*)hostPort' \ +--ginkgo.skip="SCTP|Disruptive|Slow|hostNetwork|kube-proxy|IPv6|resolv|exists conflict$SKIP" \ +--ginkgo.flakeAttempts=3 \ +--ginkgo.v \ +--node-os-distro=$OS \ +--kubeconfig=$HOME/.kube/config +fi + +# Untaint Linux nodes once testing is complete +if [[ 'windows' == $OS ]] +then +kubectl taint nodes -l kubernetes.azure.com/mode=system node-role.kubernetes.io/control-plane:NoSchedule- +fi diff --git a/hack/scripts/k8se2e.sh b/hack/scripts/k8se2e.sh new file mode 100644 index 0000000000..aac14c1fc8 --- /dev/null +++ b/hack/scripts/k8se2e.sh @@ -0,0 +1,8 @@ +echo "Cluster -g $GROUP -n $CLUSTER" + +eval k8sVersion="v"$( az aks show -g $GROUP -n $CLUSTER --query "currentKubernetesVersion") +echo $k8sVersion "e2e Test Suite" + +curl -L https://dl.k8s.io/$k8sVersion/kubernetes-test-linux-amd64.tar.gz -o ./kubernetes-test-linux-amd64.tar.gz + +tar -xvzf kubernetes-test-linux-amd64.tar.gz --strip-components=3 kubernetes/test/bin/ginkgo kubernetes/test/bin/e2e.test