From a3bba13b616950b997ea9ab909a1229a3b7b2beb Mon Sep 17 00:00:00 2001 From: "weizhou.lan@daocloud.io" Date: Sun, 5 Jun 2022 17:14:58 +0800 Subject: [PATCH] e2e support ipv4, ipv6 and dual-stack Signed-off-by: weizhou.lan@daocloud.io --- .github/.spelling | 4 +- .github/workflows/auto-nightly-ci.yaml | 190 ++++++++++++++++-- README.md | 10 +- docs/develop/test.md | 22 +- test/Makefile | 39 ++-- test/Makefile.defs | 2 +- test/e2e/ippool/statefulset_test.go | 2 +- test/scripts/install-multus.sh | 18 +- test/scripts/installTestPod.sh | 2 +- test/yamls/kind-config.tmpl | 1 + test/yamls/multus-daemonset-thick-plugin.tmpl | 1 + 11 files changed, 246 insertions(+), 45 deletions(-) diff --git a/.github/.spelling b/.github/.spelling index 32f7b82808..f921faa2a9 100644 --- a/.github/.spelling +++ b/.github/.spelling @@ -143,4 +143,6 @@ excludeIPs replicaset namesapceSelector coreDns -keypair \ No newline at end of file +keypair +amd64 +arm64 \ No newline at end of file diff --git a/.github/workflows/auto-nightly-ci.yaml b/.github/workflows/auto-nightly-ci.yaml index c3a09be669..39ecda8fdd 100644 --- a/.github/workflows/auto-nightly-ci.yaml +++ b/.github/workflows/auto-nightly-ci.yaml @@ -30,6 +30,16 @@ on: description: 'e2e labels(if not set, ginkgo will run all test, multi labels separated by commas)' required: false type: string + ipfamily: + description: 'IP family for the e2e test' + required: true + type: choice + default: 'dual' + options: + - ipv4 + - ipv6 + - dual + - all jobs: get_ref: @@ -39,6 +49,9 @@ jobs: e2e_labels: ${{ steps.get_ref.outputs.e2e_labels }} unitest_enabled: ${{ steps.get_ref.outputs.unitest_enabled }} e2e_enabled: ${{ steps.get_ref.outputs.e2e_enabled }} + ipfamily_ipv4only_e2e: ${{ steps.get_ref.outputs.ipfamily_ipv4only_e2e }} + ipfamily_ipv6only_e2e: ${{ steps.get_ref.outputs.ipfamily_ipv6only_e2e }} + ipfamily_dual_e2e: ${{ steps.get_ref.outputs.ipfamily_dual_e2e }} steps: - name: Check Code Changes uses: dorny/paths-filter@v2.10.2 @@ -69,6 +82,26 @@ jobs: echo ::set-output name=e2e_labels::${{ github.event.inputs.e2e_labels }} echo ::set-output name=e2e_enabled::true echo ::set-output name=unitest_enabled::true + if ${{ github.event.inputs.ipfamily == 'ipv4' }}; then + echo ::set-output name=ipfamily_ipv4only_e2e::true + echo ::set-output name=ipfamily_ipv6only_e2e::false + echo ::set-output name=ipfamily_dual_e2e::false + elif ${{ github.event.inputs.ipfamily == 'ipv6' }}; then + echo ::set-output name=ipfamily_ipv4only_e2e::false + echo ::set-output name=ipfamily_ipv6only_e2e::true + echo ::set-output name=ipfamily_dual_e2e::false + elif ${{ github.event.inputs.ipfamily == 'dual' }}; then + echo ::set-output name=ipfamily_ipv4only_e2e::false + echo ::set-output name=ipfamily_ipv6only_e2e::false + echo ::set-output name=ipfamily_dual_e2e::true + elif ${{ github.event.inputs.ipfamily == 'all' }}; then + echo ::set-output name=ipfamily_ipv4only_e2e::true + echo ::set-output name=ipfamily_ipv6only_e2e::true + echo ::set-output name=ipfamily_dual_e2e::true + else + echo "error, unknown input ipfamily: ${{ github.event.inputs.ipfamily }} " + exit 1 + fi elif ${{ github.event_name == 'push' }} ; then echo "trigger by push" echo ::set-output name=tag::${{ github.sha }} @@ -77,6 +110,9 @@ jobs: echo ::set-output name=e2e_enabled::true # do it in another workflow echo ::set-output name=unitest_enabled::false + echo ::set-output name=ipfamily_ipv4only_e2e::false + echo ::set-output name=ipfamily_ipv6only_e2e::false + echo ::set-output name=ipfamily_dual_e2e::true elif ${{ github.event_name == 'pull_request_target' }} ; then echo "trigger by pull_request_target" echo ::set-output name=tag::${{ github.event.pull_request.head.sha }} @@ -84,13 +120,20 @@ jobs: if ${{ steps.filter_pr.outputs.all_e2e == 'true' }} ; then # run all e2e echo ::set-output name=e2e_labels:: + echo ::set-output name=ipfamily_ipv4only_e2e::true + echo ::set-output name=ipfamily_ipv6only_e2e::true + echo ::set-output name=ipfamily_dual_e2e::true else echo ::set-output name=e2e_labels::smoke + echo ::set-output name=ipfamily_ipv4only_e2e::false + echo ::set-output name=ipfamily_ipv6only_e2e::false + echo ::set-output name=ipfamily_dual_e2e::true fi echo ::set-output name=e2e_enabled::${{ steps.filter_pr.outputs.run_e2e }} # do it in another workflow echo ::set-output name=unitest_enabled::false else + # schedule event # use main sha for ci image tag echo "trigger by schedule" echo ::set-output name=tag::main @@ -99,6 +142,9 @@ jobs: echo ::set-output name=e2e_labels:: echo ::set-output name=e2e_enabled::true echo ::set-output name=unitest_enabled::true + echo ::set-output name=ipfamily_ipv4only_e2e::true + echo ::set-output name=ipfamily_ipv6only_e2e::true + echo ::set-output name=ipfamily_dual_e2e::true fi # some event, the tag is not sha, so checkout it and get sha @@ -161,6 +207,9 @@ jobs: run: | echo "ref: ${{ needs.get_ref.outputs.ref }} " echo "e2e_labels: ${{ needs.get_ref.outputs.e2e_labels }}" + echo "ipfamily_ipv4only_e2e: ${{ needs.get_ref.outputs.ipfamily_ipv4only_e2e }}" + echo "ipfamily_ipv6only_e2e: ${{ needs.get_ref.outputs.ipfamily_ipv6only_e2e }}" + echo "ipfamily_dual_e2e: ${{ needs.get_ref.outputs.ipfamily_dual_e2e }}" echo "===== image " echo "ci image tag: ghcr.io/${{ github.repository }}/spiderpool-controller-ci:${{ needs.call_build_ci_image.outputs.imageTag }}" echo "ci race image tag: ghcr.io/${{ github.repository }}/spiderpool-controller-ci:${{ needs.call_build_ci_image.outputs.imageTag }}-race" @@ -210,8 +259,10 @@ jobs: cat test/.download/${ITEM} | docker import - ${IMAGE_NAME}:${{ needs.call_build_ci_image.outputs.imageTag }} done + # ------------- by default , dual stack # test against commit version - - name: Setup Kind Cluster + - name: Setup Kind Cluster For Dual-stack + if: ${{ needs.get_ref.outputs.ipfamily_dual_e2e == 'true' }} uses: nick-invision/retry@v2 with: timeout_minutes: 10 @@ -221,16 +272,19 @@ jobs: make e2e_init -e E2E_CLUSTER_NAME=${{ steps.prepare.outputs.clusterName }} \ -e TEST_IMAGE_TAG=${{ needs.call_build_ci_image.outputs.imageTag }} \ -e SPIDERPOOL_AGENT_IMAGE_NAME=spiderpool-agent-race \ - -e SPIDERPOOL_CONTROLLER_IMAGE_NAME=spiderpool-controller-race + -e SPIDERPOOL_CONTROLLER_IMAGE_NAME=spiderpool-controller-race \ + -e E2E_IP_FAMILY=dual - - name: Run e2e Test - id: e2e + - name: Run e2e Test For Dual-stack + id: dualstack_e2e + if: ${{ needs.get_ref.outputs.ipfamily_dual_e2e == 'true' }} continue-on-error: true run: | echo ${{ github.event.inputs.labels }} make e2e_test -e E2E_CLUSTER_NAME=${{ steps.prepare.outputs.clusterName }} \ -e E2E_GINKGO_LABELS=${{ needs.get_ref.outputs.e2e_labels }} \ - -e E2E_TIMEOUT=${{ env.E2E_TIME_OUT }} + -e E2E_TIMEOUT=${{ env.E2E_TIME_OUT }} \ + -e E2E_IP_FAMILY=dual if (($?==0)) ; then echo ::set-output name=pass::true else @@ -243,25 +297,27 @@ jobs: echo ::set-output name=upload::false fi - - name: Upload e2e report - if: ${{ steps.e2e.outputs.upload == 'true' }} + - name: Upload e2e report For Dual-stack + if: ${{ steps.dualstack_e2e.outputs.upload == 'true' && needs.get_ref.outputs.ipfamily_dual_e2e == 'true' }} uses: actions/upload-artifact@v3.1.0 with: - name: e2ereport.json + name: dualstack-e2ereport.json path: e2ereport.json retention-days: 1 - - name: Show e2e Result + - name: Show e2e Result For Dual-stack + if: ${{ needs.get_ref.outputs.ipfamily_dual_e2e == 'true' }} run: | - if ${{ steps.e2e.outputs.pass == 'true' }} ;then + if ${{ steps.dualstack_e2e.outputs.pass == 'true' }} ;then exit 0 else exit 1 fi - - name: Get the E2E Performance Result + - name: Get the E2E Performance Result For Dual-stack # run all e2e cases id: get_performance + if: ${{ needs.get_ref.outputs.ipfamily_dual_e2e == 'true' }} shell: bash run: | # sudo apt-get install -y jq @@ -270,8 +326,8 @@ jobs: # echo "PERFORMANCE=${TODO_STATUS}" >> $GITHUB_ENV echo ::set-output name=result::${TODO_STATUS} - - name: Update Badge - if: ${{ steps.get_performance.outputs.result != '' }} + - name: Update Badge For Dual-stack + if: ${{ steps.get_performance.outputs.result != '' && needs.get_ref.outputs.ipfamily_dual_e2e == 'true' }} uses: schneegans/dynamic-badges-action@v1.4.0 with: auth: ${{ secrets.WELAN_PAT }} @@ -280,3 +336,111 @@ jobs: label: performance message: ${{ steps.get_performance.outputs.result }} color: lightgrey + + # ------------------ ipv4-only + # test against commit version + - name: Setup Kind Cluster For ipv4-only + if: ${{ needs.get_ref.outputs.ipfamily_ipv4only_e2e == 'true' }} + uses: nick-invision/retry@v2 + with: + timeout_minutes: 10 + max_attempts: 3 + shell: bash + command: | + make e2e_init -e E2E_CLUSTER_NAME=${{ steps.prepare.outputs.clusterName }} \ + -e TEST_IMAGE_TAG=${{ needs.call_build_ci_image.outputs.imageTag }} \ + -e SPIDERPOOL_AGENT_IMAGE_NAME=spiderpool-agent-race \ + -e SPIDERPOOL_CONTROLLER_IMAGE_NAME=spiderpool-controller-race \ + -e E2E_IP_FAMILY=ipv4 + + - name: Run e2e Test For ipv4-only + id: ipv4only_e2e + if: ${{ needs.get_ref.outputs.ipfamily_ipv4only_e2e == 'true' }} + continue-on-error: true + run: | + echo ${{ github.event.inputs.labels }} + make e2e_test -e E2E_CLUSTER_NAME=${{ steps.prepare.outputs.clusterName }} \ + -e E2E_GINKGO_LABELS=${{ needs.get_ref.outputs.e2e_labels }} \ + -e E2E_TIMEOUT=${{ env.E2E_TIME_OUT }} \ + -e E2E_IP_FAMILY=ipv4 + if (($?==0)) ; then + echo ::set-output name=pass::true + else + echo ::set-output name=pass::false + fi + if [ -f "./e2ereport.json" ] ; then + echo "error, did not find e2e report" + echo ::set-output name=upload::true + else + echo ::set-output name=upload::false + fi + + - name: Upload e2e report For ipv4-only + if: ${{ steps.ipv4only_e2e.outputs.upload == 'true' && needs.get_ref.outputs.ipfamily_ipv4only_e2e == 'true' }} + uses: actions/upload-artifact@v3.1.0 + with: + name: ipv4Only-e2ereport.json + path: e2ereport.json + retention-days: 1 + + - name: Show e2e Result For ipv4-only + run: | + if ${{ steps.ipv4only_e2e.outputs.pass == 'true' }} ;then + exit 0 + else + exit 1 + fi + + # ------------------ ipv6-only + # test against commit version + - name: Setup Kind Cluster For ipv6-only + if: ${{ needs.get_ref.outputs.ipfamily_ipv6only_e2e == 'true' }} + uses: nick-invision/retry@v2 + with: + timeout_minutes: 10 + max_attempts: 3 + shell: bash + command: | + make e2e_init -e E2E_CLUSTER_NAME=${{ steps.prepare.outputs.clusterName }} \ + -e TEST_IMAGE_TAG=${{ needs.call_build_ci_image.outputs.imageTag }} \ + -e SPIDERPOOL_AGENT_IMAGE_NAME=spiderpool-agent-race \ + -e SPIDERPOOL_CONTROLLER_IMAGE_NAME=spiderpool-controller-race \ + -e E2E_IP_FAMILY=ipv6 + + - name: Run e2e Test For ipv6-only + id: ipv6only_e2e + if: ${{ needs.get_ref.outputs.ipfamily_ipv6only_e2e == 'true' }} + continue-on-error: true + run: | + echo ${{ github.event.inputs.labels }} + make e2e_test -e E2E_CLUSTER_NAME=${{ steps.prepare.outputs.clusterName }} \ + -e E2E_GINKGO_LABELS=${{ needs.get_ref.outputs.e2e_labels }} \ + -e E2E_TIMEOUT=${{ env.E2E_TIME_OUT }} \ + -e E2E_IP_FAMILY=ipv6 + if (($?==0)) ; then + echo ::set-output name=pass::true + else + echo ::set-output name=pass::false + fi + if [ -f "./e2ereport.json" ] ; then + echo "error, did not find e2e report" + echo ::set-output name=upload::true + else + echo ::set-output name=upload::false + fi + + - name: Upload e2e report For ipv6-only + if: ${{ steps.ipv6only_e2e.outputs.upload == 'true' && needs.get_ref.outputs.ipfamily_ipv6only_e2e == 'true' }} + uses: actions/upload-artifact@v3.1.0 + with: + name: ipv6Only-e2ereport.json + path: e2ereport.json + retention-days: 1 + + - name: Show e2e Result For ipv6-only + run: | + if ${{ steps.ipv6only_e2e.outputs.pass == 'true' }} ;then + exit 0 + else + exit 1 + fi diff --git a/README.md b/README.md index f417ccab60..6a95934192 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,10 @@ ![badge](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/weizhoublue/cd9ef69f5ba8724cb4ff896dca953ef4/raw/spiderpooltodo.json) ![badge](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/weizhoublue/38d00a872e830eedb46870c886549561/raw/spiderpoolperformance.json) +## Status + +Currently, the spiderpool is under beta stage, not ready for production environment + ## Introduction The Spiderpool is an IP Address Management (IPAM) CNI plugin that assigns IP addresses for kubernetes cluster. @@ -43,7 +47,9 @@ But the spiderpool provides lots of different features, you could refer Feature * Based on CRD storage. All operation could be done with kubernetes API-server -* Support assigning IP for IPv4-only, IPv6-only and dual-stack case +* Support assigning IP Address of IPv4-only, IPv6-only and dual-stack + +* Support working on the cluster of IPv4-only, IPv6-only and dual-stack * Support creating multiple ippool. Different namespace and application could monopolize or share an ippool @@ -74,6 +80,8 @@ But the spiderpool provides lots of different features, you could refer Feature * reach metrics for look into IP usage and issue +* support amd64 and arm64 + ## Components refer to [architecture](docs/concepts/arch.md) for components diff --git a/docs/develop/test.md b/docs/develop/test.md index be898c7fa1..d8bc59309e 100644 --- a/docs/develop/test.md +++ b/docs/develop/test.md @@ -29,6 +29,8 @@ you could follow the below steps to test: 3. you could do it step by step with the follow + build the image + # do some coding $ git add . @@ -37,7 +39,9 @@ you could follow the below steps to test: # !!! images is built by commit sha, so make sure the commit is submit locally $ make build_image - # setup the kind cluster + setup the cluster + + # setup the kind cluster of dual-stack # !!! images is tested by commit sha, so make sure the commit is submit locally $ make e2e_init ....... @@ -48,9 +52,23 @@ you could follow the below steps to test: kubectl get nodes ----------------------------------------------------------------------------------------------------- - # run all e2e test + # setup the kind cluster of ipv4-only + $ make e2e_init -e E2E_IP_FAMILY=ipv4 + + # setup the kind cluster of ipv6-only + $ make e2e_init -e E2E_IP_FAMILY=ipv6 + + run the e2e test + + # run all e2e test on dual-stack cluster $ make e2e_test + # run all e2e test on ipv4-only cluster + $ make e2e_test -e E2E_IP_FAMILY=ipv4 + + # run all e2e test on ipv6-only cluster + $ make e2e_test -e E2E_IP_FAMILY=ipv6 + # run smoke test $ make e2e_test -e GINKGO_OPTION="--label-filter=smoke" diff --git a/test/Makefile b/test/Makefile index 55b4eeddcd..b2bf08f063 100644 --- a/test/Makefile +++ b/test/Makefile @@ -14,17 +14,7 @@ e2e: kind-init e2e-test .PHONY: kind-init kind-init: check_env prepare @echo -e "\033[35m [Step 3] Init kind for the cluster: $(E2E_CLUSTER_NAME) \033[0m" - -@ kind delete cluster --name $(E2E_CLUSTER_NAME) &>/dev/null - -@ rm -rf $(CLUSTER_DIR)/$(E2E_CLUSTER_NAME) - $(QUIET) mkdir -p -v $(CLUSTER_DIR)/$(E2E_CLUSTER_NAME) - $(QUIET) kube_proxy_mode=$(E2E_KUBE_PROXY_MODE) ip_family=$(E2E_IP_FAMILY) \ - standard_cluster=$(E2E_STANDARD_CLUSTER) kind_image_tag=$(E2E_KIND_IMAGE_TAG) \ - disable_default_cni=$(E2E_DISABLE_DEFAULT_CNI) \ - p2ctl -t $(ROOT_DIR)/test/yamls/kind-config.tmpl > $(CLUSTER_DIR)/$(E2E_CLUSTER_NAME)/kind-config.yaml - $(QUIET) cat $(CLUSTER_DIR)/$(E2E_CLUSTER_NAME)/kind-config.yaml - $(QUIET) kind create cluster \ - --config $(CLUSTER_DIR)/$(E2E_CLUSTER_NAME)/kind-config.yaml \ - --name $(E2E_CLUSTER_NAME) --kubeconfig $(E2E_KUBECONFIG) + @ make setup_kind @echo -e "\033[35m [Step 4] Install The CNI-Plugins: $(CNI_PACKAGE_VERSION) \033[0m" $(QUIET) bash scripts/cni-install.sh $(E2E_CLUSTER_NAME) $(DOWNLOAD_DIR) ifeq ($(INSTALL_SPIDER),true) @@ -41,15 +31,16 @@ ifeq ($(INSTALL_MULTUS),true) INSTALL_SPIDER=$(INSTALL_SPIDER) \ TEST_IMAGE=$(TEST_IMAGE_NAME) \ E2E_IP_FAMILY=$(E2E_IP_FAMILY) \ - CNI_NAMESPACE=$(CNI_NAMESPACE) \ + MULTUS_CNI_NAMESPACE=$(MULTUS_CNI_NAMESPACE) \ MULTUS_ADDITIONAL_CNI_NAME=$(MULTUS_ADDITIONAL_CNI_NAME) \ MULTUS_DEFAULT_CNI_NAME=$(MULTUS_DEFAULT_CNI_NAME) \ CLUSTER_PATH=$(CLUSTER_DIR)/$(E2E_CLUSTER_NAME) \ scripts/install-multus.sh $(E2E_CLUSTER_NAME) $(E2E_KUBECONFIG) endif -$(QUIET) kubectl --kubeconfig $(E2E_KUBECONFIG) delete namespace local-path-storage &>/dev/null - @ echo "wait for the cluster ready" && TEST_IMAGE=$(TEST_IMAGE_NAME) \ - CNI_NAMESPACE=$(CNI_NAMESPACE) \ + @ echo "wait for the cluster ready" ; \ + TEST_IMAGE=$(TEST_IMAGE_NAME) \ + MULTUS_CNI_NAMESPACE=$(MULTUS_CNI_NAMESPACE) \ MULTUS_ADDITIONAL_CNI_NAME=$(MULTUS_ADDITIONAL_CNI_NAME) \ MULTUS_DEFAULT_CNI_NAME=$(MULTUS_DEFAULT_CNI_NAME) \ scripts/installTestPod.sh $(E2E_KUBECONFIG) @@ -57,8 +48,8 @@ endif @echo "-----------------------------------------------------------------------------------------------------" @echo " ip family: $(E2E_IP_FAMILY)" @echo " install spiderpool: $(INSTALL_SPIDER)" - @echo " multus default CNI: $(CNI_NAMESPACE)/$(MULTUS_DEFAULT_CNI_NAME) " - @echo " multus addon CNI: $(CNI_NAMESPACE)/$(MULTUS_ADDITIONAL_CNI_NAME) " + @echo " multus default CNI: $(MULTUS_CNI_NAMESPACE)/$(MULTUS_DEFAULT_CNI_NAME) " + @echo " multus addon CNI: $(MULTUS_CNI_NAMESPACE)/$(MULTUS_ADDITIONAL_CNI_NAME) " @echo "" @echo -e " succeeded to setup cluster $(E2E_CLUSTER_NAME) " @echo -e " you could use following command to access the cluster " @@ -70,6 +61,22 @@ endif @echo "" +.PHONY: setup_kind +setup_kind: + @ if [ "$(E2E_IP_FAMILY)" != "ipv4" ] ; then sysctl -w net.ipv6.conf.all.disable_ipv6=0 ; fi + -@ kind delete cluster --name $(E2E_CLUSTER_NAME) &>/dev/null + -@ rm -rf $(CLUSTER_DIR)/$(E2E_CLUSTER_NAME) + $(QUIET) mkdir -p -v $(CLUSTER_DIR)/$(E2E_CLUSTER_NAME) + $(QUIET) kube_proxy_mode=$(E2E_KUBE_PROXY_MODE) ip_family=$(E2E_IP_FAMILY) \ + standard_cluster=$(E2E_STANDARD_CLUSTER) kind_image_tag=$(E2E_KIND_IMAGE_TAG) \ + disable_default_cni=$(E2E_DISABLE_DEFAULT_CNI) \ + p2ctl -t $(ROOT_DIR)/test/yamls/kind-config.tmpl > $(CLUSTER_DIR)/$(E2E_CLUSTER_NAME)/kind-config.yaml + $(QUIET) cat $(CLUSTER_DIR)/$(E2E_CLUSTER_NAME)/kind-config.yaml + $(QUIET) kind create cluster \ + --config $(CLUSTER_DIR)/$(E2E_CLUSTER_NAME)/kind-config.yaml \ + --name $(E2E_CLUSTER_NAME) --kubeconfig $(E2E_KUBECONFIG) + + .PHONY: setup_spiderpool setup_spiderpool: @ echo "Load Image $(TEST_IMAGE_TAG) to kind..." ; \ diff --git a/test/Makefile.defs b/test/Makefile.defs index 4cdb3df5c9..1464101b1a 100644 --- a/test/Makefile.defs +++ b/test/Makefile.defs @@ -51,7 +51,7 @@ IMAGE_CERT_MANAGER_NAME := $(IMAGE_CERT_MANAGER_REPO)/cert-manager-cainjector:$( CERT_MANAGER_ISSUER_NAME := selfsigned #================= multus -CNI_NAMESPACE := kube-system +MULTUS_CNI_NAMESPACE := kube-system MULTUS_DEFAULT_CNI_NAME := macvlan-cni-default MULTUS_ADDITIONAL_CNI_NAME := macvlan-cni2 diff --git a/test/e2e/ippool/statefulset_test.go b/test/e2e/ippool/statefulset_test.go index 1e24aff824..60c035f39a 100644 --- a/test/e2e/ippool/statefulset_test.go +++ b/test/e2e/ippool/statefulset_test.go @@ -12,7 +12,7 @@ import ( "github.com/spidernet-io/spiderpool/test/e2e/common" ) -var _ = Describe("test ip with statefulset case", Label("statefulSet"), func() { +var _ = Describe("test ip with statefulset", Label("statefulSet"), func() { var stsName, nsName string var err error diff --git a/test/scripts/install-multus.sh b/test/scripts/install-multus.sh index 85933c4b70..3f581b5bdc 100755 --- a/test/scripts/install-multus.sh +++ b/test/scripts/install-multus.sh @@ -38,7 +38,7 @@ echo "$CURRENT_FILENAME : E2E_IP_FAMILY $E2E_IP_FAMILY " MULTUS_DEFAULT_CNI_NAME=${MULTUS_DEFAULT_CNI_NAME:-"macvlan-cni-default"} MULTUS_ADDITIONAL_CNI_NAME=${MULTUS_ADDITIONAL_CNI_NAME:-"macvlan-cni2"} -CNI_NAMESPACE=${CNI_NAMESPACE:-"kube-system"} +MULTUS_CNI_NAMESPACE=${MULTUS_CNI_NAMESPACE:-"kube-system"} #============== @@ -57,7 +57,7 @@ apiVersion: "k8s.cni.cncf.io/v1" kind: NetworkAttachmentDefinition metadata: name: ${MULTUS_DEFAULT_CNI_NAME} - namespace: ${CNI_NAMESPACE} + namespace: ${MULTUS_CNI_NAMESPACE} spec: config: '{ "cniVersion": "0.3.1", @@ -81,7 +81,7 @@ apiVersion: "k8s.cni.cncf.io/v1" kind: NetworkAttachmentDefinition metadata: name: ${MULTUS_ADDITIONAL_CNI_NAME} - namespace: ${CNI_NAMESPACE} + namespace: ${MULTUS_CNI_NAMESPACE} spec: config: '{ "cniVersion": "0.3.1", @@ -108,13 +108,11 @@ InstallCNI::Whereabout(){ echo "install $MULTUS_DEFAULT_CNI_NAME cni : macvlan + whereabout" if [ "${E2E_IP_FAMILY}" == "ipv4" ] ; then - DEFAULT_CNI_CONF='\ - "range": "172.19.1.10-172.19.1.254/16", + DEFAULT_CNI_CONF='"range": "172.19.1.10-172.19.1.254/16", "gateway": "172.19.0.1", "routes": [ { "dst": "0.0.0.0/0" }],' - ADD_CNI_CONF='\ - "range": "172.20.1.10-172.20.1.254/16", + ADD_CNI_CONF='"range": "172.20.1.10-172.20.1.254/16", "gateway": "172.20.0.1", "routes": [ { "dst": "0.0.0.0/0" }],' @@ -153,7 +151,7 @@ apiVersion: "k8s.cni.cncf.io/v1" kind: NetworkAttachmentDefinition metadata: name: ${MULTUS_DEFAULT_CNI_NAME} - namespace: ${CNI_NAMESPACE} + namespace: ${MULTUS_CNI_NAMESPACE} spec: config: '{ "cniVersion": "0.3.1", @@ -175,7 +173,7 @@ apiVersion: "k8s.cni.cncf.io/v1" kind: NetworkAttachmentDefinition metadata: name: ${MULTUS_ADDITIONAL_CNI_NAME} - namespace: ${CNI_NAMESPACE} + namespace: ${MULTUS_CNI_NAMESPACE} spec: config: '{ "cniVersion": "0.3.1", @@ -200,6 +198,8 @@ EOF # tmplate sed 's?<>?'"${IMAGE_MULTUS}"'?' ${CURRENT_DIR_PATH}/../yamls/multus-daemonset-thick-plugin.tmpl > ${CLUSTER_PATH}/multus-daemonset-thick-plugin.yml sed -i 's?<>?'"${MULTUS_DEFAULT_CNI_NAME}"'?' ${CLUSTER_PATH}/multus-daemonset-thick-plugin.yml +sed -i 's?<>?'"${MULTUS_CNI_NAMESPACE}"'?' ${CLUSTER_PATH}/multus-daemonset-thick-plugin.yml + kubectl apply -f ${CLUSTER_PATH}/multus-daemonset-thick-plugin.yml --kubeconfig ${E2E_KUBECONFIG} # for CRD is applied diff --git a/test/scripts/installTestPod.sh b/test/scripts/installTestPod.sh index 00aba67dd6..6feafbd617 100755 --- a/test/scripts/installTestPod.sh +++ b/test/scripts/installTestPod.sh @@ -27,7 +27,7 @@ spec: template: metadata: annotations: - k8s.v1.cni.cncf.io/networks: ${CNI_NAMESPACE}/${MULTUS_ADDITIONAL_CNI_NAME} + k8s.v1.cni.cncf.io/networks: ${MULTUS_CNI_NAMESPACE}/${MULTUS_ADDITIONAL_CNI_NAME} name: $NAME labels: app: $NAME diff --git a/test/yamls/kind-config.tmpl b/test/yamls/kind-config.tmpl index 4e3f3bca76..f31007a5ec 100644 --- a/test/yamls/kind-config.tmpl +++ b/test/yamls/kind-config.tmpl @@ -4,6 +4,7 @@ networking: kubeProxyMode: {{ kube_proxy_mode }} disableDefaultCNI: {{ disable_default_cni }} ipFamily: {{ ip_family }} + # If you are using Docker on Windows or Mac, you will need to use an IPv4 port forward for the API Server from the host because IPv6 port forwards don't work on these platforms apiServerAddress: 127.0.0.1 {%- if ip_family == "ipv4" %} podSubnet: "172.20.0.0/16" diff --git a/test/yamls/multus-daemonset-thick-plugin.tmpl b/test/yamls/multus-daemonset-thick-plugin.tmpl index bf878db9da..3ab80a053e 100644 --- a/test/yamls/multus-daemonset-thick-plugin.tmpl +++ b/test/yamls/multus-daemonset-thick-plugin.tmpl @@ -122,6 +122,7 @@ data: }, "namespaceIsolation": false, "clusterNetwork": "<>", + "multusNamespace": "<>", "kubeconfig": "/etc/cni/net.d/multus.d/multus.kubeconfig" } ---