Skip to content

Commit 02311fd

Browse files
authored
ci: Add k8s network conformance tests to makefile (#2086)
* Add k8s Network Conformance tests command to makefile * Add lines to README * Allow numbers to show in make help call * Addressing Comments
1 parent b45c2c7 commit 02311fd

File tree

4 files changed

+96
-18
lines changed

4 files changed

+96
-18
lines changed

Makefile

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ azure-ipam: azure-ipam-binary azure-ipam-archive
142142

143143
revision: ## print the current git revision
144144
@echo $(REVISION)
145-
145+
146146
version: ## prints the root version
147147
@echo $(ACN_VERSION)
148148

@@ -161,15 +161,15 @@ cni-dropgz-test-version: ## prints the cni-dropgz version
161161
@echo $(CNI_DROPGZ_TEST_VERSION)
162162

163163
cns-version:
164-
@echo $(CNS_VERSION)
164+
@echo $(CNS_VERSION)
165165

166166
npm-version:
167-
@echo $(NPM_VERSION)
167+
@echo $(NPM_VERSION)
168168

169169
zapai-version: ## prints the zapai version
170170
@echo $(ZAPAI_VERSION)
171171

172-
##@ Binaries
172+
##@ Binaries
173173

174174
# Build the delegated IPAM plugin binary.
175175
azure-ipam-binary:
@@ -509,8 +509,8 @@ manifest-build: # util target to compose multiarch container manifests from plat
509509
$(MAKE) manifest-add PLATFORM=$(PLATFORM);\
510510
)\
511511
)\
512-
513-
512+
513+
514514

515515
manifest-push: # util target to push multiarch container manifest.
516516
$(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
534534
acncli-skopeo-archive: ## export tar archive of acncli multiplat container manifest.
535535
$(MAKE) manifest-skopeo-archive \
536536
IMAGE=$(ACNCLI_IMAGE) \
537-
TAG=$(ACN_VERSION)
537+
TAG=$(ACN_VERSION)
538538

539539
cni-dropgz-manifest-build: ## build cni-dropgz multiplat container manifest.
540540
$(MAKE) manifest-build \
@@ -692,7 +692,7 @@ ifeq ($(GOOS),linux)
692692
endif
693693

694694

695-
##@ Utils
695+
##@ Utils
696696

697697
clean: ## Clean build artifacts.
698698
$(RMDIR) $(OUTPUT_DIR)
@@ -723,7 +723,7 @@ workspace: ## Set up the Go workspace.
723723
go work use ./dropgz
724724
go work use ./zapai
725725

726-
##@ Test
726+
##@ Test
727727

728728
COVER_PKG ?= .
729729
#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
762762
kind:
763763
kind create cluster --config ./test/kind/kind.yaml
764764

765+
test-k8se2e: test-k8se2e-build test-k8se2e-only ## Alias to run build and test
766+
767+
test-k8se2e-build: ## Build k8s e2e test suite
768+
cd hack/scripts && bash ./k8se2e.sh $(GROUP) $(CLUSTER)
769+
cd ../..
770+
771+
test-k8se2e-only: ## Run k8s network conformance test, use TYPE=basic for only datapath tests
772+
cd hack/scripts && bash ./k8se2e-tests.sh $(OS) $(TYPE)
773+
cd ../..
765774

766775
##@ Utilities
767776

@@ -781,7 +790,7 @@ gitconfig: ## configure the local git repository
781790
setup: tools install-hooks gitconfig ## performs common required repo setup
782791

783792

784-
##@ Tools
793+
##@ Tools
785794

786795
$(TOOLS_DIR)/go.mod:
787796
cd $(TOOLS_DIR); go mod init && go mod tidy
@@ -791,7 +800,7 @@ $(CONTROLLER_GEN): $(TOOLS_DIR)/go.mod
791800

792801
controller-gen: $(CONTROLLER_GEN) ## Build controller-gen
793802

794-
protoc:
803+
protoc:
795804
source ${REPO_ROOT}/scripts/install-protoc.sh
796805

797806
$(GOCOV): $(TOOLS_DIR)/go.mod
@@ -824,13 +833,13 @@ $(MOCKGEN): $(TOOLS_DIR)/go.mod
824833

825834
mockgen: $(MOCKGEN) ## Build mockgen
826835

827-
clean-tools:
836+
clean-tools:
828837
rm -r build/tools/bin
829838

830839
tools: acncli gocov gocov-xml go-junit-report golangci-lint gofumpt protoc ## Build bins for build tools
831840

832841

833-
##@ Help
842+
##@ Help
834843

835844
help: ## Display this help
836-
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\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)
845+
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\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)

hack/aks/Makefile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,16 @@ VNET ?= $(CLUSTER)
2525
##@ Help
2626

2727
help: ## Display this help
28-
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\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)
28+
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\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)
2929

3030

3131
##@ Utilities
3232

33-
azlogin:
33+
azlogin: ## Login and set account to $SUB
3434
@$(AZCLI) login
3535
@$(AZCLI) account set -s $(SUB)
3636

37-
azcfg:
37+
azcfg: ## Set the $AZCLI to use aks-preview
3838
@$(AZCLI) extension add --name aks-preview --yes
3939
@$(AZCLI) extension update --name aks-preview
4040

@@ -214,7 +214,7 @@ windows-cniv1-up: rg-up overlay-net-up ## Bring up a Windows CNIv1 cluster
214214

215215
@$(MAKE) set-kubeconf
216216

217-
linux-cniv1-up: rg-up overlay-net-up
217+
linux-cniv1-up: rg-up overlay-net-up ## Bring up a Linux CNIv1 cluster
218218
$(AZCLI) aks create -n $(CLUSTER) -g $(GROUP) -l $(REGION) \
219219
--node-count $(NODE_COUNT) \
220220
--node-vm-size $(VM_SIZE) \

hack/scripts/k8se2e-tests.sh

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# Taint Linux nodes so that windows tests do not run on them and ensure no LinuxOnly tests run on windows nodes
2+
if [[ 'windows' == $OS ]]
3+
then
4+
SKIP="|LinuxOnly"
5+
kubectl taint nodes -l kubernetes.azure.com/mode=system node-role.kubernetes.io/control-plane:NoSchedule
6+
fi
7+
8+
9+
10+
if [[ 'basic' == $TYPE ]]
11+
then
12+
echo "Testing Datapath"
13+
echo "./ginkgo --nodes=4 \
14+
./e2e.test -- \
15+
--num-nodes=2 \
16+
--provider=skeleton \
17+
--ginkgo.focus='(.*).Networking.should|(.*).Networking.Granular|(.*)kubernetes.api' \
18+
--ginkgo.skip='SCTP|Disruptive|Slow|hostNetwork|kube-proxy|IPv6' \
19+
--ginkgo.flakeAttempts=3 \
20+
--ginkgo.v \
21+
--node-os-distro=$OS \
22+
--kubeconfig=$HOME/.kube/config"
23+
./ginkgo --nodes=4 \
24+
./e2e.test -- \
25+
--num-nodes=2 \
26+
--provider=skeleton \
27+
--ginkgo.focus='(.*).Networking.should|(.*).Networking.Granular|(.*)kubernetes.api' \
28+
--ginkgo.skip='SCTP|Disruptive|Slow|hostNetwork|kube-proxy|IPv6' \
29+
--ginkgo.flakeAttempts=3 \
30+
--ginkgo.v \
31+
--node-os-distro=$OS \
32+
--kubeconfig=$HOME/.kube/config
33+
else
34+
echo "Testing Datapath, DNS, PortForward, Service, and Hostport"
35+
echo "./ginkgo --nodes=4 \
36+
./e2e.test -- \
37+
--num-nodes=2 \
38+
--provider=skeleton \
39+
--ginkgo.focus='(.*).Networking.should|(.*).Networking.Granular|(.*)kubernetes.api|\[sig-network\].DNS.should|\[sig-cli\].Kubectl.Port|Services.*\[Conformance\].*|\[sig-network\](.*)HostPort|\[sig-scheduling\](.*)hostPort' \
40+
--ginkgo.skip='SCTP|Disruptive|Slow|hostNetwork|kube-proxy|IPv6|resolv|exists conflict$SKIP' \
41+
--ginkgo.flakeAttempts=3 \
42+
--ginkgo.v \
43+
--node-os-distro=$OS \
44+
--kubeconfig=$HOME/.kube/config"
45+
./ginkgo --nodes=4 \
46+
./e2e.test -- \
47+
--num-nodes=2 \
48+
--provider=skeleton \
49+
--ginkgo.focus='(.*).Networking.should|(.*).Networking.Granular|(.*)kubernetes.api|\[sig-network\].DNS.should|\[sig-cli\].Kubectl.Port|Services.*\[Conformance\].*|\[sig-network\](.*)HostPort|\[sig-scheduling\](.*)hostPort' \
50+
--ginkgo.skip="SCTP|Disruptive|Slow|hostNetwork|kube-proxy|IPv6|resolv|exists conflict$SKIP" \
51+
--ginkgo.flakeAttempts=3 \
52+
--ginkgo.v \
53+
--node-os-distro=$OS \
54+
--kubeconfig=$HOME/.kube/config
55+
fi
56+
57+
# Untaint Linux nodes once testing is complete
58+
if [[ 'windows' == $OS ]]
59+
then
60+
kubectl taint nodes -l kubernetes.azure.com/mode=system node-role.kubernetes.io/control-plane:NoSchedule-
61+
fi

hack/scripts/k8se2e.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
echo "Cluster -g $GROUP -n $CLUSTER"
2+
3+
eval k8sVersion="v"$( az aks show -g $GROUP -n $CLUSTER --query "currentKubernetesVersion")
4+
echo $k8sVersion "e2e Test Suite"
5+
6+
curl -L https://dl.k8s.io/$k8sVersion/kubernetes-test-linux-amd64.tar.gz -o ./kubernetes-test-linux-amd64.tar.gz
7+
8+
tar -xvzf kubernetes-test-linux-amd64.tar.gz --strip-components=3 kubernetes/test/bin/ginkgo kubernetes/test/bin/e2e.test

0 commit comments

Comments
 (0)