Skip to content

Commit b5af7ac

Browse files
committed
Add job to run e2e test with traffic encrytion mode
as WireGuard Signed-off-by: Pulkit Jain <[email protected]>
1 parent d64f559 commit b5af7ac

File tree

4 files changed

+96
-1
lines changed

4 files changed

+96
-1
lines changed

ci/jenkins/jobs/macros.yaml

+24
Original file line numberDiff line numberDiff line change
@@ -300,3 +300,27 @@
300300
#!/bin/bash
301301
set -e
302302
./ci/jenkins/stop-stale-jobs.sh --pull-request "${ghprbPullId}" --jenkins "${JENKINS_URL}"
303+
304+
- builder:
305+
name: builder-e2e-kind-wireGuard
306+
builders:
307+
- shell: |-
308+
#!/bin/bash
309+
set -ex
310+
DOCKER_REGISTRY="$(head -n1 ci/docker-registry)"
311+
[ "$DOCKER_REGISTRY" != "docker.io" ] || ./ci/jenkins/docker_login.sh --docker-user ${{DOCKER_USERNAME}} --docker-password ${{DOCKER_PASSWORD}}
312+
KIND_TIMEOUT=135
313+
FULL_CLUSTER_NAME='{kind_cluster_name}'-"${{BUILD_NUMBER}}"
314+
# Delete all Kind clusters created more than 135 mins ago. 135 minutes is the timeout
315+
# we have configured for running conformance, NetworkPolicy and e2e tests on Kind,
316+
# so clusters older than that can de deleted safely.
317+
./ci/kind/kind-setup.sh destroy --all --until ${{KIND_TIMEOUT}}
318+
./ci/kind/kind-install.sh
319+
./ci/kind/kind-setup.sh --antrea-cni create "${{FULL_CLUSTER_NAME}}"
320+
kind export kubeconfig -n "${{FULL_CLUSTER_NAME}}" --kubeconfig ${{PWD}}/.kube/config
321+
set +e
322+
./ci/jenkins/test.sh --testcase e2e --traffic-mode "wireGuard" --registry ${{DOCKER_REGISTRY}} --kubeconfig ${{PWD}}/.kube/config --testbed-type "kind" --kind-cluster-name "${{FULL_CLUSTER_NAME}}" --build-tag "e2e-${{BUILD_NUMBER}}"
323+
return_code=$?
324+
set -ex
325+
./ci/kind/kind-setup.sh destroy "${{FULL_CLUSTER_NAME}}"
326+
exit $return_code

ci/jenkins/jobs/projects-cloud.yaml

+45
Original file line numberDiff line numberDiff line change
@@ -1717,3 +1717,48 @@
17171717
key-file-variable: AWS_EC2_SSH_KEY
17181718
username-variable: AWS_EC2_SSH_USER_NAME
17191719
passphrase-variable: AWS_EC2_SSH_PASSPHRASE
1720+
- '{name}-{test_name}-for-pull-request':
1721+
test_name: kind-e2e-wireguard
1722+
node: 'antrea-kind-testbed'
1723+
description: 'This is for running e2e tests on kind.'
1724+
branches:
1725+
- ${{sha1}}
1726+
builders:
1727+
- builder-e2e-kind-wireGuard:
1728+
kind_cluster_name: '{test_name}'
1729+
trigger_phrase: ^(?!Thanks for your PR).*/test-(kind-e2e-wireguard|kind-all|all).*
1730+
white_list_target_branches: []
1731+
allow_whitelist_orgs_as_admins: true
1732+
admin_list: '{antrea_admin_list}'
1733+
org_list: '{antrea_org_list}'
1734+
white_list: '{antrea_white_list}'
1735+
only_trigger_phrase: true
1736+
trigger_permit_all: true
1737+
throttle_concurrent_builds_enabled: 'true'
1738+
status_context: jenkins-kind-e2e-wireguard
1739+
status_url: null
1740+
success_status: Build finished.
1741+
failure_status: Failed. Add comment /test-kind-e2e-wireguard to re-trigger.
1742+
error_status: Failed. Add comment /test-kind-e2e-wireguard to re-trigger.
1743+
triggered_status: null
1744+
started_status: null
1745+
wrappers:
1746+
- credentials-binding:
1747+
- text:
1748+
credential-id: DOCKER_USERNAME
1749+
variable: DOCKER_USERNAME
1750+
- text:
1751+
credential-id: DOCKER_PASSWORD
1752+
variable: DOCKER_PASSWORD
1753+
- timeout:
1754+
fail: true
1755+
timeout: 135
1756+
type: absolute
1757+
publishers:
1758+
- archive:
1759+
allow-empty: true
1760+
artifacts: antrea-test-logs.tar.gz
1761+
case-sensitive: true
1762+
default-excludes: true
1763+
fingerprint: false
1764+
only-if-success: false

ci/jenkins/test.sh

+12-1
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ CLEAN_STALE_IMAGES_CONTAINERD="crictl rmi --prune"
5656
PRINT_DOCKER_STATUS="docker system df -v"
5757
PRINT_CONTAINERD_STATUS="crictl ps --state Exited"
5858
BUILD_TAG="latest"
59+
TRAFFIC_MODE=""
5960
MANIFEST_ARGS=""
6061

6162
_usage="Usage: $0 [--kubeconfig <KubeconfigSavePath>] [--workdir <HomePath>]
@@ -74,7 +75,8 @@ Run K8s e2e community tests (Conformance & Network Policy) or Antrea e2e tests o
7475
--proxyall Enable proxyAll to test AntreaProxy.
7576
--build-tag Custom build tag for images.
7677
--docker-user Username for Docker account.
77-
--docker-password Password for Docker account."
78+
--docker-password Password for Docker account.
79+
--traffic-mode Traffic Encryption mode."
7880

7981
function print_usage {
8082
echoerr "$_usage"
@@ -137,6 +139,10 @@ case $key in
137139
DOCKER_PASSWORD="$2"
138140
shift 2
139141
;;
142+
--traffic-mode)
143+
TRAFFIC_MODE="$2"
144+
shift 2
145+
;;
140146
-h|--help)
141147
print_usage
142148
exit 0
@@ -537,6 +543,11 @@ function deliver_antrea {
537543
fi
538544
chmod -R g-w build/images/ovs
539545
chmod -R g-w build/images/base
546+
547+
if [[ "$TRAFFIC_MODE" == "wireGuard" ]]; then
548+
MANIFEST_ARGS="$MANIFEST_ARGS --wireGuard"
549+
fi
550+
540551
if [[ "$BUILD_TAG" != "latest" ]]; then
541552
DOCKER_REGISTRY="${DOCKER_REGISTRY}" ./hack/build-antrea-linux-all.sh --build-tag ${BUILD_TAG} --pull
542553
IMG_TAG="${BUILD_TAG}" ./hack/generate-manifest.sh $MANIFEST_ARGS > build/yamls/antrea.yml

hack/generate-manifest.sh

+15
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ Generate a YAML manifest for Antrea using Helm and print it to stdout.
2626
--encap-mode (mode) Traffic encapsulation mode (default is 'encap').
2727
--cloud Generate a manifest appropriate for running Antrea in Public Cloud.
2828
--ipsec Generate a manifest with IPsec encryption of tunnel traffic enabled.
29+
--wireGuard Generate a manifest with WireGuard encryption of tunnel traffic enabled.
2930
--feature-gates A comma-separated list of key=value pairs that describe feature gates, e.g. TrafficControl=true,Egress=false.
3031
This option can be specified multiple times.
3132
--proxy-all Generate a manifest with Antrea proxy with all Service support enabled.
@@ -89,6 +90,7 @@ MULTICAST_INTERFACES=""
8990
HELM_VALUES_FILES=()
9091
HELM_VALUES=()
9192
FEATURE_GATES=()
93+
WIREGUARD=false
9294

9395
while [[ $# -gt 0 ]]
9496
do
@@ -114,6 +116,10 @@ case $key in
114116
IPSEC=true
115117
shift
116118
;;
119+
--wireGuard)
120+
WIREGUARD=true
121+
shift
122+
;;
117123
--feature-gates)
118124
FEATURE_GATES+=("$2")
119125
shift 2
@@ -250,6 +256,11 @@ if [[ "$ENCAP_MODE" != "" ]] && [[ "$ENCAP_MODE" != "encap" ]] && $IPSEC; then
250256
exit 1
251257
fi
252258

259+
if [[ "$ENCAP_MODE" != "" ]] && [[ "$ENCAP_MODE" != "encap" ]] && $WIREGUARD; then
260+
echoerr "Encap mode '$ENCAP_MODE' does not make sense with wireGuard"
261+
exit 1
262+
fi
263+
253264
THIS_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
254265

255266
source $THIS_DIR/verify-helm.sh
@@ -268,6 +279,10 @@ if $IPSEC; then
268279
HELM_VALUES+=("trafficEncryptionMode=ipsec" "tunnelType=gre")
269280
fi
270281

282+
if $WIREGUARD; then
283+
HELM_VALUES+=("trafficEncryptionMode=wireGuard")
284+
fi
285+
271286
if $FLEXIBLE_IPAM; then
272287
HELM_VALUES+=("featureGates.AntreaIPAM=true" "enableBridgingMode=true" "trafficEncapMode=noEncap" "noSNAT=true")
273288
fi

0 commit comments

Comments
 (0)