Skip to content

Commit 0d9df4b

Browse files
Add modprobe br_netfilter step in test workflows
GH runners don't load this module anymore so we need to load it manually so that flannel works properly in the e2e tests.
1 parent 57790df commit 0d9df4b

File tree

4 files changed

+34
-2
lines changed

4 files changed

+34
-2
lines changed

.github/workflows/e2eTests.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ jobs:
1616
- name: Check out code into the Go module directory
1717
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #v4.2.2
1818

19+
- name: set up modules
20+
run: sudo modprobe br_netfilter overlay
21+
1922
- name: Run tests
2023
id: testing
2124
continue-on-error: true

.github/workflows/k3s-e2eTests.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: e2e tests for flannel
1+
name: k3s e2e tests for flannel
22

33
on: pull_request
44

@@ -20,6 +20,9 @@ jobs:
2020
with:
2121
go-version: ${{ env.GO_VERSION }}
2222

23+
- name: set up modules
24+
run: sudo modprobe br_netfilter overlay
25+
2326
- name: build flannel image
2427
run: make image
2528

e2e/e2e-functions.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,12 @@ e2e-wait-for-services() {
5252
}
5353
export -f e2e-wait-for-services
5454

55+
e2e-get-flannel-pod() {
56+
local node_name=$1
57+
kubectl --kubeconfig="${HOME}/.kube/config" get pods --field-selector "spec.nodeName=${node_name}" -n kube-flannel --no-headers
58+
}
59+
export -f e2e-get-flannel-pod
60+
5561
e2e-wait-for-test-pods() {
5662
for pod in ${WAIT_FOR_PODS:="multitool1 multitool2"}; do
5763
while [[ "$(e2e-pod-ready $pod)" != 'true' ]]; do

e2e/run-e2e-tests.sh

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,10 @@ get_pod_cidr() {
8383
kubectl --kubeconfig="${HOME}/.kube/config" get node ${node_name} --template '{{.spec.podCIDR}}'
8484
}
8585

86-
# get_flannel_logs()
86+
get_pod_logs() {
87+
local pod_name=$1
88+
kubectl --kubeconfig="${HOME}/.kube/config" logs $pod_name -n kube-flannel
89+
}
8790

8891
pings() {
8992
create_test_pod multitool1 local-worker
@@ -96,6 +99,10 @@ pings() {
9699
if [ $retVal -ne 0 ]; then
97100
echo "test pods not ready in time. Checking their status..."
98101
kubectl --kubeconfig="${HOME}/.kube/config" get events --sort-by='.lastTimestamp' -A
102+
echo "*****************************"
103+
echo "flannel pod log:")
104+
flannel_pod=$(e2e-get-flannel-pod local-worker)
105+
echo "$(get_pod_logs $flannel_pod)"
99106
exit $retVal
100107
fi
101108

@@ -136,8 +143,21 @@ prepare_test() {
136143
write-flannel-conf ${backend} ${enable_nftables}
137144

138145
install-flannel
146+
# wait for flannel pods
147+
timeout --foreground 5m bash -c "e2e-wait-for-flannel-pods"
148+
139149
# wait for nodes to be ready
140150
timeout --foreground 5m bash -c "e2e-wait-for-nodes"
151+
retVal=$?
152+
if [ $retVal -ne 0 ]; then
153+
echo "test nodes not ready in time. Checking their status..."
154+
kubectl --kubeconfig="${HOME}/.kube/config" get events --sort-by='.lastTimestamp' -A
155+
echo "*****************************"
156+
echo "flannel pod log:")
157+
flannel_pod=$(e2e-get-flannel-pod local-worker)
158+
echo "$(get_pod_logs $flannel_pod)"
159+
exit $retVal
160+
fi
141161
# wait for services to be ready
142162
echo "wait for services to be ready..."
143163
timeout --foreground 5m bash -c "e2e-wait-for-services"

0 commit comments

Comments
 (0)