From 33a32cb28e4db6a142d25f81095b47c0862a52cf Mon Sep 17 00:00:00 2001 From: KMAnju-2021 Date: Wed, 18 Oct 2023 11:36:20 +0530 Subject: [PATCH] NetworkPolicy, conformance and e2e tests in kind-(ds or ipv6) cluster Signed-off-by: KMAnju-2021 --- .github/workflows/kind.yml | 2 +- ci/cloud-coredns-configmap.yaml | 30 +++++ ci/coredns-configmap.yaml | 31 +++++ ci/jenkins/jobs/macros.yaml | 39 +++++- ci/jenkins/jobs/projects-cloud.yaml | 194 +++++++++++++++++++++++++++ ci/jenkins/jobs/projects-lab.yaml | 200 ++++++++++++++++++++++++++++ ci/jenkins/test.sh | 36 ++++- ci/kind/kind-setup.sh | 6 +- ci/kind/test-e2e-kind.sh | 8 +- 9 files changed, 530 insertions(+), 16 deletions(-) create mode 100644 ci/cloud-coredns-configmap.yaml create mode 100644 ci/coredns-configmap.yaml diff --git a/.github/workflows/kind.yml b/.github/workflows/kind.yml index c967fd2ca90..d3afd665cc0 100644 --- a/.github/workflows/kind.yml +++ b/.github/workflows/kind.yml @@ -436,7 +436,7 @@ jobs: run: | mkdir log mkdir test-e2e-fa-coverage - ANTREA_LOG_DIR=$PWD/log ANTREA_COV_DIR=$PWD/test-e2e-fa-coverage ./ci/kind/test-e2e-kind.sh --encap-mode encap --coverage --flow-visibility --ip-family dual + ANTREA_LOG_DIR=$PWD/log ANTREA_COV_DIR=$PWD/test-e2e-fa-coverage ./ci/kind/test-e2e-kind.sh --encap-mode encap --coverage --flow-visibility --ip-family ds - name: Tar coverage files run: tar -czf test-e2e-fa-coverage.tar.gz test-e2e-fa-coverage - name: Upload coverage for test-e2e-fa-coverage diff --git a/ci/cloud-coredns-configmap.yaml b/ci/cloud-coredns-configmap.yaml new file mode 100644 index 00000000000..f26e86791fe --- /dev/null +++ b/ci/cloud-coredns-configmap.yaml @@ -0,0 +1,30 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + namespace: kube-system + name: coredns +data: + Corefile: | + .:53 { + errors + health { + lameduck 5s + } + ready + kubernetes cluster.local in-addr.arpa ip6.arpa { + pods insecure + ttl 30 + } + prometheus :9153 + forward . /etc/resolv.conf { + max_concurrent 1000 + } + cache 30 + reload + loadbalance + } + compute.internal:53 { + template ANY ANY { + rcode NXDOMAIN + } + } diff --git a/ci/coredns-configmap.yaml b/ci/coredns-configmap.yaml new file mode 100644 index 00000000000..bc1104e722d --- /dev/null +++ b/ci/coredns-configmap.yaml @@ -0,0 +1,31 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + namespace: kube-system + name: coredns +data: + Corefile: | + .:53 { + errors + health { + lameduck 5s + } + ready + kubernetes cluster.local in-addr.arpa ip6.arpa { + pods insecure + ttl 30 + } + prometheus :9153 + forward . /etc/resolv.conf { + max_concurrent 1000 + } + cache 30 + reload + loadbalance + } + vmware.com:53 { + template ANY ANY { + rcode NXDOMAIN + } + } + diff --git a/ci/jenkins/jobs/macros.yaml b/ci/jenkins/jobs/macros.yaml index 86d3afb75d2..c8fbd18d6dd 100644 --- a/ci/jenkins/jobs/macros.yaml +++ b/ci/jenkins/jobs/macros.yaml @@ -217,20 +217,45 @@ #!/bin/bash set -ex DOCKER_REGISTRY="$(head -n1 ci/docker-registry)" - # Delete all kind clusters created more than 135 mins ago. 135 minutes is the timeout + KIND_TIMEOUT=135 + FULL_CLUSTER_NAME='{kind_cluster_name}'-"${{BUILD_NUMBER}}" + # Delete all Kind clusters created more than 135 mins ago. 135 minutes is the timeout # we have configured for running conformance and NetworkPolicy tests on Kind, # so clusters older than that can de deleted safely. - ./ci/kind/kind-setup.sh destroy --all --until 135 + ./ci/kind/kind-setup.sh destroy --all --until ${{KIND_TIMEOUT}} ./ci/kind/kind-install.sh - ./ci/kind/kind-setup.sh --antrea-cni create "${{JOB_NAME}}-${{BUILD_NUMBER}}" - kind export kubeconfig -n "${{JOB_NAME}}-${{BUILD_NUMBER}}" --kubeconfig ${{PWD}}/.kube/config - set +ex - ./ci/jenkins/test.sh --testcase '{conformance_type}' --registry ${{DOCKER_REGISTRY}} --kubeconfig ${{PWD}}/.kube/config --testbed-type "kind" --kind-cluster-name "${{JOB_NAME}}-${{BUILD_NUMBER}}" + ./ci/kind/kind-setup.sh --antrea-cni create "${{FULL_CLUSTER_NAME}}" --ip-family '{ip_version}' + kind export kubeconfig -n "${{FULL_CLUSTER_NAME}}" --kubeconfig ${{PWD}}/.kube/config + set +e + ./ci/jenkins/test.sh --testcase '{conformance_type}' --registry ${{DOCKER_REGISTRY}} --kubeconfig ${{PWD}}/.kube/config --testbed-type "kind" --kind-cluster-name "${{FULL_CLUSTER_NAME}}" --jenkins-location '{jenkins_location}' --ip-mode '{ip_version}' return_code=$? set -ex - ./ci/kind/kind-setup.sh destroy "${{JOB_NAME}}-${{BUILD_NUMBER}}" + ./ci/kind/kind-setup.sh destroy "${{FULL_CLUSTER_NAME}}" exit $return_code +- builder: + name: builder-e2e-kind + builders: + - shell: |- + #!/bin/bash + set -ex + DOCKER_REGISTRY="$(head -n1 ci/docker-registry)" + KIND_TIMEOUT=135 + FULL_CLUSTER_NAME='{kind_cluster_name}'-"${{BUILD_NUMBER}}" + # Delete all Kind clusters created more than 135 mins ago. 135 minutes is the timeout + # we have configured for running conformance, NetworkPolicy and e2e tests on Kind, + # so clusters older than that can de deleted safely. + ./ci/kind/kind-setup.sh destroy --all --until ${{KIND_TIMEOUT}} + ./ci/kind/kind-install.sh + ./ci/kind/kind-setup.sh --antrea-cni create "${{FULL_CLUSTER_NAME}}" --ip-family '{ip_version}' + kind export kubeconfig -n "${{FULL_CLUSTER_NAME}}" --kubeconfig ${{PWD}}/.kube/config + set +e + ./ci/jenkins/test.sh --testcase e2e --registry ${{DOCKER_REGISTRY}} --kubeconfig ${{PWD}}/.kube/config --testbed-type "kind" --kind-cluster-name "${{FULL_CLUSTER_NAME}}" + return_code=$? + set -ex + ./ci/kind/kind-setup.sh destroy "${{FULL_CLUSTER_NAME}}" + exit $return_code + - builder: name: builder-rancher-e2e builders: diff --git a/ci/jenkins/jobs/projects-cloud.yaml b/ci/jenkins/jobs/projects-cloud.yaml index 0d8ed4056d9..1c713f5f746 100644 --- a/ci/jenkins/jobs/projects-cloud.yaml +++ b/ci/jenkins/jobs/projects-cloud.yaml @@ -1077,3 +1077,197 @@ default-excludes: true fingerprint: false only-if-success: false + - '{name}-{test_name}-for-pull-request': + test_name: kind-aws-ipv6-only-networkpolicy + node: 'antrea-kind-test' + description: 'This is the {test_name} test for {name}.' + branches: + - ${{sha1}} + builders: + - builder-conformance-kind: + conformance_type: 'networkpolicy' + ip_version: 'ipv6' + jenkins_location: 'cloud' + kind_cluster_name: '{test_name}' + trigger_phrase: ^(?!Thanks for your PR).*/test-kind-aws-ipv6-only-(networkpolicy|all).* + white_list_target_branches: [] + allow_whitelist_orgs_as_admins: true + admin_list: '{antrea_admin_list}' + org_list: '{antrea_org_list}' + white_list: '{antrea_white_list}' + only_trigger_phrase: true + trigger_permit_all: true + status_context: jenkins-kind-ipv6-only-networkpolicy + status_url: --none-- + success_status: Build finished. + failure_status: Failed. Add comment /test-kind-aws-ipv6-only-networkpolicy to re-trigger. + error_status: Failed. Add comment /test-kind-aws-ipv6-only-networkpolicy to re-trigger. + triggered_status: null + started_status: null + wrappers: + - timeout: + fail: true + timeout: 135 + type: absolute + publishers: [] + - '{name}-{test_name}-for-pull-request': + test_name: kind-aws-ipv6-only-conformance + node: 'antrea-kind-test' + description: 'This is the {test_name} test for {name}.' + branches: + - ${{sha1}} + builders: + - builder-conformance-kind: + conformance_type: 'conformance' + ip_version: 'ipv6' + jenkins_location: 'cloud' + kind_cluster_name: '{test_name}' + trigger_phrase: ^(?!Thanks for your PR).*/test-kind-aws-ipv6-only-(conformance|all).* + white_list_target_branches: [] + allow_whitelist_orgs_as_admins: true + admin_list: '{antrea_admin_list}' + org_list: '{antrea_org_list}' + white_list: '{antrea_white_list}' + only_trigger_phrase: true + trigger_permit_all: true + status_context: jenkins-kind-ipv6-only-conformance + status_url: --none-- + success_status: Build finished. + failure_status: Failed. Add comment /test-kind-aws-ipv6-only-conformance to re-trigger. + error_status: Failed. Add comment /test-kind-aws-ipv6-only-conformance to re-trigger. + triggered_status: null + started_status: null + wrappers: + - timeout: + fail: true + timeout: 135 + type: absolute + publishers: [] + - '{name}-{test_name}-for-pull-request': + test_name: kind-aws-ipv6-only-e2e + node: 'antrea-kind-test' + description: 'This is the {test_name} test for {name}.' + branches: + - ${{sha1}} + builders: + - builder-e2e-kind: + ip_version: 'ipv6' + kind_cluster_name: '{test_name}' + trigger_phrase: ^(?!Thanks for your PR).*/test-kind-aws-ipv6-only-(e2e|all).* + white_list_target_branches: [] + allow_whitelist_orgs_as_admins: true + admin_list: '{antrea_admin_list}' + org_list: '{antrea_org_list}' + white_list: '{antrea_white_list}' + only_trigger_phrase: true + trigger_permit_all: true + status_context: jenkins-kind-ipv6-only-e2e + status_url: --none-- + success_status: Build finished. + failure_status: Failed. Add comment /test-kind-aws-ipv6-only-e2e to re-trigger. + error_status: Failed. Add comment /test-kind-aws-ipv6-only-e2e to re-trigger. + triggered_status: null + started_status: null + wrappers: + - timeout: + fail: true + timeout: 135 + type: absolute + publishers: [] + - '{name}-{test_name}-for-pull-request': + test_name: kind-aws-ipv6-ds-networkpolicy + node: 'antrea-kind-test' + description: 'This is the {test_name} test for {name}.' + branches: + - ${{sha1}} + builders: + - builder-conformance-kind: + conformance_type: 'networkpolicy' + ip_version: 'ds' + jenkins_location: 'cloud' + kind_cluster_name: '{test_name}' + trigger_phrase: ^(?!Thanks for your PR).*/test-kind-aws-ipv6-ds-(networkpolicy|all).* + white_list_target_branches: [] + allow_whitelist_orgs_as_admins: true + admin_list: '{antrea_admin_list}' + org_list: '{antrea_org_list}' + white_list: '{antrea_white_list}' + only_trigger_phrase: true + trigger_permit_all: true + status_context: jenkins-kind-ipv6-ds-networkpolicy + status_url: --none-- + success_status: Build finished. + failure_status: Failed. Add comment /test-kind-aws-ipv6-ds-networkpolicy to re-trigger. + error_status: Failed. Add comment /test-kind-aws-ipv6-ds-networkpolicy to re-trigger. + triggered_status: null + started_status: null + wrappers: + - timeout: + fail: true + timeout: 135 + type: absolute + publishers: [] + - '{name}-{test_name}-for-pull-request': + test_name: kind-aws-ipv6-ds-conformance + node: 'antrea-kind-test' + description: 'This is the {test_name} test for {name}.' + branches: + - ${{sha1}} + builders: + - builder-conformance-kind: + conformance_type: 'conformance' + ip_version: 'ds' + jenkins_location: 'cloud' + kind_cluster_name: '{test_name}' + trigger_phrase: ^(?!Thanks for your PR).*/test-kind-aws-ipv6-ds-(conformance|all).* + white_list_target_branches: [] + allow_whitelist_orgs_as_admins: true + admin_list: '{antrea_admin_list}' + org_list: '{antrea_org_list}' + white_list: '{antrea_white_list}' + only_trigger_phrase: true + trigger_permit_all: true + status_context: jenkins-kind-ipv6-ds-conformance + status_url: --none-- + success_status: Build finished. + failure_status: Failed. Add comment /test-kind-aws-ipv6-ds-conformance to re-trigger. + error_status: Failed. Add comment /test-kind-aws-ipv6-ds-conformance to re-trigger. + triggered_status: null + started_status: null + wrappers: + - timeout: + fail: true + timeout: 135 + type: absolute + publishers: [] + - '{name}-{test_name}-for-pull-request': + test_name: kind-aws-ipv6-ds-e2e + node: 'antrea-kind-test' + description: 'This is the {test_name} test for {name}.' + branches: + - ${{sha1}} + builders: + - builder-e2e-kind: + ip_version: 'ds' + kind_cluster_name: '{test_name}' + trigger_phrase: ^(?!Thanks for your PR).*/test-kind-aws-ipv6-ds-(e2e|all).* + white_list_target_branches: [] + allow_whitelist_orgs_as_admins: true + admin_list: '{antrea_admin_list}' + org_list: '{antrea_org_list}' + white_list: '{antrea_white_list}' + only_trigger_phrase: true + trigger_permit_all: true + status_context: jenkins-kind-ipv6-ds-e2e + status_url: --none-- + success_status: Build finished. + failure_status: Failed. Add comment /test-kind-aws-ipv6-ds-e2e to re-trigger. + error_status: Failed. Add comment /test-kind-aws-ipv6-ds-e2e to re-trigger. + triggered_status: null + started_status: null + wrappers: + - timeout: + fail: true + timeout: 135 + type: absolute + publishers: [] diff --git a/ci/jenkins/jobs/projects-lab.yaml b/ci/jenkins/jobs/projects-lab.yaml index 2d25d40dbc1..6186a29754f 100644 --- a/ci/jenkins/jobs/projects-lab.yaml +++ b/ci/jenkins/jobs/projects-lab.yaml @@ -778,6 +778,9 @@ builders: - builder-conformance-kind: conformance_type: 'conformance' + ip_version: 'ipv4' + jenkins_location: 'lab' + kind_cluster_name: '{test_name}' trigger_phrase: ^(?!Thanks for your PR).*/test-kind-conformance.* white_list_target_branches: [] allow_whitelist_orgs_as_admins: true @@ -808,6 +811,9 @@ builders: - builder-conformance-kind: conformance_type: 'networkpolicy' + ip_version: 'ipv4' + jenkins_location: 'lab' + kind_cluster_name: '{test_name}' trigger_phrase: ^(?!Thanks for your PR).*/test-kind-networkpolicy.* white_list_target_branches: [] allow_whitelist_orgs_as_admins: true @@ -1154,3 +1160,197 @@ credential-id: JENKINS_API_TOKEN variable: JENKINS_API_TOKEN publishers: [] + - '{name}-{test_name}-for-pull-request': + test_name: kind-ipv6-only-networkpolicy + node: 'antrea-kind-testbed' + description: 'This is the {test_name} test for {name}.' + branches: + - ${{sha1}} + builders: + - builder-conformance-kind: + conformance_type: 'networkpolicy' + ip_version: 'ipv6' + jenkins_location: 'lab' + kind_cluster_name: '{test_name}' + trigger_phrase: ^(?!Thanks for your PR).*/test-kind-ipv6-only-(networkpolicy|all).* + white_list_target_branches: [] + allow_whitelist_orgs_as_admins: true + admin_list: '{antrea_admin_list}' + org_list: '{antrea_org_list}' + white_list: '{antrea_white_list}' + only_trigger_phrase: true + trigger_permit_all: true + status_context: jenkins-kind-ipv6-only-networkpolicy + status_url: --none-- + success_status: Build finished. + failure_status: Failed. Add comment /test-kind-ipv6-only-networkpolicy to re-trigger. + error_status: Failed. Add comment /test-kind-ipv6-only-networkpolicy to re-trigger. + triggered_status: null + started_status: null + wrappers: + - timeout: + fail: true + timeout: 135 + type: absolute + publishers: [] + - '{name}-{test_name}-for-pull-request': + test_name: kind-ipv6-only-conformance + node: 'antrea-kind-testbed' + description: 'This is the {test_name} test for {name}.' + branches: + - ${{sha1}} + builders: + - builder-conformance-kind: + conformance_type: 'conformance' + ip_version: 'ipv6' + jenkins_location: 'lab' + kind_cluster_name: '{test_name}' + trigger_phrase: ^(?!Thanks for your PR).*/test-kind-ipv6-only-(conformance|all).* + white_list_target_branches: [] + allow_whitelist_orgs_as_admins: true + admin_list: '{antrea_admin_list}' + org_list: '{antrea_org_list}' + white_list: '{antrea_white_list}' + only_trigger_phrase: true + trigger_permit_all: true + status_context: jenkins-kind-ipv6-only-conformance + status_url: --none-- + success_status: Build finished. + failure_status: Failed. Add comment /test-kind-ipv6-only-conformance to re-trigger. + error_status: Failed. Add comment /test-kind-ipv6-only-conformance to re-trigger. + triggered_status: null + started_status: null + wrappers: + - timeout: + fail: true + timeout: 135 + type: absolute + publishers: [] + - '{name}-{test_name}-for-pull-request': + test_name: kind-ipv6-only-e2e + node: 'antrea-kind-testbed' + description: 'This is the {test_name} test for {name}.' + branches: + - ${{sha1}} + builders: + - builder-e2e-kind: + ip_version: 'ipv6' + kind_cluster_name: '{test_name}' + trigger_phrase: ^(?!Thanks for your PR).*/test-kind-ipv6-only-(e2e|all).* + white_list_target_branches: [] + allow_whitelist_orgs_as_admins: true + admin_list: '{antrea_admin_list}' + org_list: '{antrea_org_list}' + white_list: '{antrea_white_list}' + only_trigger_phrase: true + trigger_permit_all: true + status_context: jenkins-kind-ipv6-only-e2e + status_url: --none-- + success_status: Build finished. + failure_status: Failed. Add comment /test-kind-ipv6-only-e2e to re-trigger. + error_status: Failed. Add comment /test-kind-ipv6-only-e2e to re-trigger. + triggered_status: null + started_status: null + wrappers: + - timeout: + fail: true + timeout: 135 + type: absolute + publishers: [] + - '{name}-{test_name}-for-pull-request': + test_name: kind-ipv6-ds-networkpolicy + node: 'antrea-kind-testbed' + description: 'This is the {test_name} test for {name}.' + branches: + - ${{sha1}} + builders: + - builder-conformance-kind: + conformance_type: 'networkpolicy' + ip_version: 'ds' + jenkins_location: 'lab' + kind_cluster_name: '{test_name}' + trigger_phrase: ^(?!Thanks for your PR).*/test-kind-ipv6-ds-(networkpolicy|all).* + white_list_target_branches: [] + allow_whitelist_orgs_as_admins: true + admin_list: '{antrea_admin_list}' + org_list: '{antrea_org_list}' + white_list: '{antrea_white_list}' + only_trigger_phrase: true + trigger_permit_all: true + status_context: jenkins-kind-ipv6-ds-networkpolicy + status_url: --none-- + success_status: Build finished. + failure_status: Failed. Add comment /test-kind-ipv6-ds-networkpolicy to re-trigger. + error_status: Failed. Add comment /test-kind-ipv6-ds-networkpolicy to re-trigger. + triggered_status: null + started_status: null + wrappers: + - timeout: + fail: true + timeout: 135 + type: absolute + publishers: [] + - '{name}-{test_name}-for-pull-request': + test_name: kind-ipv6-ds-conformance + node: 'antrea-kind-testbed' + description: 'This is the {test_name} test for {name}.' + branches: + - ${{sha1}} + builders: + - builder-conformance-kind: + conformance_type: 'conformance' + ip_version: 'ds' + jenkins_location: 'lab' + kind_cluster_name: '{test_name}' + trigger_phrase: ^(?!Thanks for your PR).*/test-kind-ipv6-ds-(conformance|all).* + white_list_target_branches: [] + allow_whitelist_orgs_as_admins: true + admin_list: '{antrea_admin_list}' + org_list: '{antrea_org_list}' + white_list: '{antrea_white_list}' + only_trigger_phrase: true + trigger_permit_all: true + status_context: jenkins-kind-ipv6-ds-conformance + status_url: --none-- + success_status: Build finished. + failure_status: Failed. Add comment /test-kind-ipv6-ds-conformance to re-trigger. + error_status: Failed. Add comment /test-kind-ipv6-ds-conformance to re-trigger. + triggered_status: null + started_status: null + wrappers: + - timeout: + fail: true + timeout: 135 + type: absolute + publishers: [] + - '{name}-{test_name}-for-pull-request': + test_name: kind-ipv6-ds-e2e + node: 'antrea-kind-testbed' + description: 'This is the {test_name} test for {name}.' + branches: + - ${{sha1}} + builders: + - builder-e2e-kind: + ip_version: "ds" + kind_cluster_name: '{test_name}' + trigger_phrase: ^(?!Thanks for your PR).*/test-kind-ipv6-ds-(e2e|all).* + white_list_target_branches: [] + allow_whitelist_orgs_as_admins: true + admin_list: '{antrea_admin_list}' + org_list: '{antrea_org_list}' + white_list: '{antrea_white_list}' + only_trigger_phrase: true + trigger_permit_all: true + status_context: jenkins-kind-ipv6-ds-e2e + status_url: --none-- + success_status: Build finished. + failure_status: Failed. Add comment /test-kind-ipv6-ds-e2e to re-trigger. + error_status: Failed. Add comment /test-kind-ipv6-ds-e2e to re-trigger. + triggered_status: null + started_status: null + wrappers: + - timeout: + fail: true + timeout: 135 + type: absolute + publishers: [] diff --git a/ci/jenkins/test.sh b/ci/jenkins/test.sh index fda8097d451..074bb864d38 100755 --- a/ci/jenkins/test.sh +++ b/ci/jenkins/test.sh @@ -21,6 +21,7 @@ function echoerr { } KIND_CLUSTER="" +JENKINS_LOCATION="" DEFAULT_WORKDIR="/var/lib/jenkins" DEFAULT_KUBECONFIG_PATH=$DEFAULT_WORKDIR/kube.conf WORKDIR=$DEFAULT_WORKDIR @@ -88,6 +89,10 @@ case $key in KIND_CLUSTER="$2" shift 2 ;; + --jenkins-location) + JENKINS_LOCATION="$2" + shift 2 + ;; --kubeconfig) KUBECONFIG_PATH="$2" shift 2 @@ -152,6 +157,7 @@ fi export NO_PULL E2ETEST_PATH=${WORKDIR}/kubernetes/_output/dockerized/bin/linux/amd64/e2e.test +export KUBECONFIG=${KUBECONFIG_PATH} function export_govc_env_var { env_govc="${WORKDIR}/govc.env" @@ -804,7 +810,12 @@ function run_e2e { mkdir -p "${WORKDIR}/.kube" mkdir -p "${WORKDIR}/.ssh" - cp -f "${WORKDIR}/kube.conf" "${WORKDIR}/.kube/config" + + echo ${KUBECONFIG_PATH} + # For the non kind jobs the destination path will be changed from "${WORKDIR}/.kube/config" to "${WORKDIR}/kube.conf". + if [[ $TESTBED_TYPE != "kind" ]]; then + cp -f "${WORKDIR}/kube.conf" ${KUBECONFIG_PATH} + fi generate_ssh_config set +e @@ -813,6 +824,12 @@ function run_e2e { go mod edit -replace github.com/moby/spdystream=github.com/antoninbas/spdystream@v0.2.1 && go mod tidy if [[ $TESTBED_TYPE == "flexible-ipam" ]]; then go test -v antrea.io/antrea/test/e2e --logs-export-dir `pwd`/antrea-test-logs --provider remote -timeout=100m --prometheus --antrea-ipam + elif [[ $TESTBED_TYPE == "kind" ]]; then + kubectl config use-context kind-${KIND_CLUSTER} + kubectl apply -f build/yamls/antrea-prometheus.yml + kubectl apply -f build/yamls/antrea-prometheus-rbac.yml + ./hack/generate-manifest.sh | docker exec -i ${KIND_CLUSTER}-control-plane dd of=/root/antrea.yml + go test -v antrea.io/antrea/test/e2e --logs-export-dir `pwd`/antrea-test-logs --provider kind -timeout=100m --prometheus else go test -v antrea.io/antrea/test/e2e --logs-export-dir `pwd`/antrea-test-logs --provider remote -timeout=100m --prometheus fi @@ -839,6 +856,23 @@ function run_conformance { kubectl rollout status daemonset/antrea-agent -n kube-system set +e + # Conformance DNS test cases fail in IPv6 Kind cluster because here CoreDNS pods are IPv6 pods + # and it can't reach IPv4 upstream nameserver. + # Note: Default CoreDNS ConfigMap uses /etc/resolv.conf to get upstream nameservers listed in resolv.conf file on the host, + # the upstream nameservers are accessed by IPv4, when single stack IPv6 pods try to connect IPv4 nameserver it return servfail, + # with the new ConfigMap we will forward DNS query to "vmware.com:53" and it will return 'NXDOMAIN' so that client keep searching. + # For more detail: https://github.com/kubernetes/kubernetes/issues/94794 + if [[ $IP_MODE == "ipv6" && "$TESTCASE" =~ "conformance" && $TESTBED_TYPE == "kind" ]]; + then + if [[ $JENKINS_LOCATION == "lab" ]]; then + # Override the CoreDNS ConfigMap with a new one for lab environment. + kubectl apply -f ./ci/coredns-configmap.yaml + elif [[ $JENKINS_LOCATION == "cloud" ]]; then + # Override the CoreDNS ConfigMap with a different one for cloud environment. + kubectl apply -f ./ci/cloud-coredns-configmap.yaml + fi + fi + if [[ "$TESTCASE" =~ "conformance" ]]; then ${WORKSPACE}/ci/run-k8s-e2e-tests.sh --e2e-conformance --e2e-skip "$CONFORMANCE_SKIP" --log-mode $MODE --image-pull-policy ${IMAGE_PULL_POLICY} --kubernetes-version "auto" > ${WORKSPACE}/test-result.log else diff --git a/ci/kind/kind-setup.sh b/ci/kind/kind-setup.sh index 7258a24c44c..5ffceffc5a4 100755 --- a/ci/kind/kind-setup.sh +++ b/ci/kind/kind-setup.sh @@ -50,7 +50,7 @@ function echoerr { } _usage=" -Usage: $0 create CLUSTER_NAME [--pod-cidr POD_CIDR] [--service-cidr SERVICE_CIDR] [--antrea-cni] [--num-workers NUM_WORKERS] [--images IMAGES] [--subnets SUBNETS] [--ip-family ipv4|ipv6|dual] [--k8s-version VERSION] +Usage: $0 create CLUSTER_NAME [--pod-cidr POD_CIDR] [--service-cidr SERVICE_CIDR] [--antrea-cni] [--num-workers NUM_WORKERS] [--images IMAGES] [--subnets SUBNETS] [--ip-family ipv4|ipv6|ds] [--k8s-version VERSION] $0 destroy CLUSTER_NAME $0 help where: @@ -322,8 +322,8 @@ function create { exit 1 fi - if [[ "$IP_FAMILY" != "ipv4" ]] && [[ "$IP_FAMILY" != "ipv6" ]] && [[ "$IP_FAMILY" != "dual" ]]; then - echoerr "Invalid value for --ip-family \"$IP_FAMILY\", expected \"ipv4\", \"ipv6\", or \"dual\"" + if [[ "$IP_FAMILY" != "ipv4" ]] && [[ "$IP_FAMILY" != "ipv6" ]] && [[ "$IP_FAMILY" != "ds" ]]; then + echoerr "Invalid value for --ip-family \"$IP_FAMILY\", expected \"ipv4\", \"ipv6\", or \"ds\"" exit 1 fi diff --git a/ci/kind/test-e2e-kind.sh b/ci/kind/test-e2e-kind.sh index 951d16cfb77..e75f58d8133 100755 --- a/ci/kind/test-e2e-kind.sh +++ b/ci/kind/test-e2e-kind.sh @@ -22,7 +22,7 @@ function echoerr { >&2 echo "$@" } -_usage="Usage: $0 [--encap-mode ] [--ip-family ] [--coverage] [--help|-h] +_usage="Usage: $0 [--encap-mode ] [--ip-family ] [--coverage] [--help|-h] --encap-mode Traffic encapsulation mode. (default is 'encap'). --ip-family Configures the ipFamily for the KinD cluster. --feature-gates A comma-separated list of key=value pairs that describe feature gates, e.g. AntreaProxy=true,Egress=false. @@ -256,7 +256,7 @@ if $extra_vlan; then vlan_args="$vlan_args --vlan-subnets 172.100.10.1/24" elif [[ "$ipfamily" == "v6" ]]; then vlan_args="$vlan_args --vlan-subnets fd00:172:100:10::1/96" - elif [[ "$ipfamily" == "dual" ]]; then + elif [[ "$ipfamily" == "ds" ]]; then vlan_args="$vlan_args --vlan-subnets 172.100.10.1/24,fd00:172:100:10::1/96" fi fi @@ -266,8 +266,8 @@ function setup_cluster { if [[ "$ipfamily" == "v6" ]]; then args="$args --ip-family ipv6 --pod-cidr fd00:10:244::/56" - elif [[ "$ipfamily" == "dual" ]]; then - args="$args --ip-family dual" + elif [[ "$ipfamily" == "ds" ]]; then + args="$args --ip-family ds" elif [[ "$ipfamily" != "v4" ]]; then echoerr "invalid value for --ip-family \"$ipfamily\", expected \"v4\" or \"v6\"" exit 1