From 27392128af0a64a6621c285fbf8e45fbaa6f158c Mon Sep 17 00:00:00 2001 From: Rahul Duvedi <53002164+rahulduvedi@users.noreply.github.com> Date: Wed, 19 Mar 2025 20:03:36 +0530 Subject: [PATCH 01/14] updated the yaml to use the go/build pipeline and added new tests --- flannel.yaml | 66 ++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 46 insertions(+), 20 deletions(-) diff --git a/flannel.yaml b/flannel.yaml index 8bb23c6d806..c481bdaa3ee 100644 --- a/flannel.yaml +++ b/flannel.yaml @@ -1,41 +1,33 @@ package: name: flannel version: "0.26.5" - epoch: 3 + epoch: 2 description: flannel is a network fabric for containers, designed for Kubernetes copyright: - license: Apache-2.0 -environment: - contents: - packages: - - build-base - - busybox - - ca-certificates-bundle - - go - pipeline: - uses: git-checkout with: repository: https://github.com/flannel-io/flannel tag: v${{package.version}} - expected-commit: 0d1f8e28f5a6697629c7b39627b342ac48f09862 + expected-commit: "0d1f8e28f5a6697629c7b39627b342ac48f09862" - - uses: go/bump + - uses: go/build with: - deps: |- - golang.org/x/oauth2@v0.27.0 - golang.org/x/crypto@v0.35.0 - golang.org/x/net@v0.36.0 + packages: "." + output: "flanneld" + ldflags: "-X github.com/flannel-io/flannel/pkg/version.Version=v${{package.version}}" - # Build with CGO_ENABLED=1 to include the UDP backend - runs: | CGO_ENABLED=0 if [ "$(go env GOARCH)" = "amd64" ]; then CGO_ENABLED=1 fi - CGO_ENABLED=$(CGO_ENABLED) go build -o "${{targets.destdir}}"/usr/bin/flanneld \ - -ldflags '-extldflags "-static" -X github.com/flannel-io/flannel/pkg/version.version=${{package.version}}' + CGO_ENABLED=$CGO_ENABLED \ + go build \ + -ldflags="-X github.com/flannel-io/flannel/pkg/version.Version=v${{package.version}}" \ + -o "${{targets.destdir}}"/usr/bin/flanneld update: enabled: true @@ -44,8 +36,42 @@ update: strip-prefix: v test: + environment: + contents: + packages: + - ${{package.name}} + - etcd pipeline: - # AUTOGENERATED - runs: | + # Check flanneld version flanneld --version - flanneld --help + + # Start etcd (default v3) + mkdir -p /var/lib/etcd + etcd --data-dir=/var/lib/etcd --listen-client-urls=http://127.0.0.1:2379 --advertise-client-urls=http://127.0.0.1:2379 > /tmp/etcd.log 2>&1 & + ETCD_PID=$! + + # Wait for etcd readiness (max 5 attempts) + for i in {1..5}; do + if curl -s http://127.0.0.1:2379/version; then + break + fi + sleep 1 + done + + # Set flannel config in etcd using etcdctl v3 command + etcdctl --endpoints=http://127.0.0.1:2379 put /coreos.com/network/config '{"Network": "10.244.0.0/16", "Backend": {"Type": "host-gw"}}' + + # Run flanneld with a timeout, specifying a valid interface (e.g. eth0) + timeout 3s flanneld --etcd-endpoints=http://127.0.0.1:2379 --iface=eth0 > /tmp/flannel-output.log 2>&1 || true + + cat /tmp/flannel-output.log + + # Verify subnet manager creation + if ! grep -q "Created subnet manager" /tmp/flannel-output.log; then + cat /tmp/flannel-output.log + exit 1 + fi + + # Clean up: Stop etcd + kill $ETCD_PID \ No newline at end of file From 8baf090ce8613e27e3d842afdea9271246d1e579 Mon Sep 17 00:00:00 2001 From: Rahul Duvedi <53002164+rahulduvedi@users.noreply.github.com> Date: Wed, 19 Mar 2025 23:08:07 +0530 Subject: [PATCH 02/14] added tests --- flannel.yaml | 40 +++++++++++++++++++++++++++++++++++++--- 1 file changed, 37 insertions(+), 3 deletions(-) diff --git a/flannel.yaml b/flannel.yaml index 8bb23c6d806..3acc5d5fcec 100644 --- a/flannel.yaml +++ b/flannel.yaml @@ -1,7 +1,7 @@ package: name: flannel version: "0.26.5" - epoch: 3 + epoch: 4 description: flannel is a network fabric for containers, designed for Kubernetes copyright: - license: Apache-2.0 @@ -44,8 +44,42 @@ update: strip-prefix: v test: + environment: + contents: + packages: + - ${{package.name}} + - etcd pipeline: - # AUTOGENERATED - runs: | + # Check flanneld version flanneld --version - flanneld --help + + # Start etcd (default v3) + mkdir -p /var/lib/etcd + etcd --data-dir=/var/lib/etcd --listen-client-urls=http://127.0.0.1:2379 --advertise-client-urls=http://127.0.0.1:2379 > /tmp/etcd.log 2>&1 & + ETCD_PID=$! + + # Wait for etcd readiness (max 5 attempts) + for i in {1..5}; do + if curl -s http://127.0.0.1:2379/version; then + break + fi + sleep 1 + done + + # Set flannel config in etcd using etcdctl v3 command + etcdctl --endpoints=http://127.0.0.1:2379 put /coreos.com/network/config '{"Network": "10.244.0.0/16", "Backend": {"Type": "host-gw"}}' + + # Run flanneld with a timeout, specifying a valid interface (e.g. eth0) + timeout 3s flanneld --etcd-endpoints=http://127.0.0.1:2379 --iface=eth0 > /tmp/flannel-output.log 2>&1 || true + + cat /tmp/flannel-output.log + + # Verify subnet manager creation + if ! grep -q "Created subnet manager" /tmp/flannel-output.log; then + cat /tmp/flannel-output.log + exit 1 + fi + + # Clean up: Stop etcd + kill $ETCD_PID \ No newline at end of file From f2a6d1a5cf169c681ea9b40c021f35dca59b4685 Mon Sep 17 00:00:00 2001 From: Rahul Duvedi <53002164+rahulduvedi@users.noreply.github.com> Date: Wed, 19 Mar 2025 23:13:39 +0530 Subject: [PATCH 03/14] revereted to use go/bump and orignal config --- flannel.yaml | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/flannel.yaml b/flannel.yaml index 217dca78a4e..0b61ad48293 100644 --- a/flannel.yaml +++ b/flannel.yaml @@ -1,33 +1,41 @@ package: name: flannel version: "0.26.5" - epoch: 4 + epoch: 3 description: flannel is a network fabric for containers, designed for Kubernetes copyright: - license: Apache-2.0 +environment: + contents: + packages: + - build-base + - busybox + - ca-certificates-bundle + - go + pipeline: - uses: git-checkout with: repository: https://github.com/flannel-io/flannel tag: v${{package.version}} - expected-commit: "0d1f8e28f5a6697629c7b39627b342ac48f09862" + expected-commit: 0d1f8e28f5a6697629c7b39627b342ac48f09862 - - uses: go/build + - uses: go/bump with: - packages: "." - output: "flanneld" - ldflags: "-X github.com/flannel-io/flannel/pkg/version.Version=v${{package.version}}" + deps: |- + golang.org/x/oauth2@v0.27.0 + golang.org/x/crypto@v0.35.0 + golang.org/x/net@v0.36.0 + # Build with CGO_ENABLED=1 to include the UDP backend - runs: | CGO_ENABLED=0 if [ "$(go env GOARCH)" = "amd64" ]; then CGO_ENABLED=1 fi - CGO_ENABLED=$CGO_ENABLED \ - go build \ - -ldflags="-X github.com/flannel-io/flannel/pkg/version.Version=v${{package.version}}" \ - -o "${{targets.destdir}}"/usr/bin/flanneld + CGO_ENABLED=$(CGO_ENABLED) go build -o "${{targets.destdir}}"/usr/bin/flanneld \ + -ldflags '-extldflags "-static" -X github.com/flannel-io/flannel/pkg/version.version=${{package.version}}' update: enabled: true From 9073755620b5f6c7b9c129dd793391128b4b50c5 Mon Sep 17 00:00:00 2001 From: Rahul Duvedi <53002164+rahulduvedi@users.noreply.github.com> Date: Wed, 19 Mar 2025 23:22:59 +0530 Subject: [PATCH 04/14] corrected linting in yaml --- flannel.yaml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/flannel.yaml b/flannel.yaml index 0b61ad48293..8a6f317939e 100644 --- a/flannel.yaml +++ b/flannel.yaml @@ -1,7 +1,7 @@ package: name: flannel version: "0.26.5" - epoch: 3 + epoch: 4 description: flannel is a network fabric for containers, designed for Kubernetes copyright: - license: Apache-2.0 @@ -53,12 +53,12 @@ test: - runs: | # Check flanneld version flanneld --version - + # Start etcd (default v3) mkdir -p /var/lib/etcd etcd --data-dir=/var/lib/etcd --listen-client-urls=http://127.0.0.1:2379 --advertise-client-urls=http://127.0.0.1:2379 > /tmp/etcd.log 2>&1 & ETCD_PID=$! - + # Wait for etcd readiness (max 5 attempts) for i in {1..5}; do if curl -s http://127.0.0.1:2379/version; then @@ -66,13 +66,13 @@ test: fi sleep 1 done - + # Set flannel config in etcd using etcdctl v3 command etcdctl --endpoints=http://127.0.0.1:2379 put /coreos.com/network/config '{"Network": "10.244.0.0/16", "Backend": {"Type": "host-gw"}}' - + # Run flanneld with a timeout, specifying a valid interface (e.g. eth0) timeout 3s flanneld --etcd-endpoints=http://127.0.0.1:2379 --iface=eth0 > /tmp/flannel-output.log 2>&1 || true - + cat /tmp/flannel-output.log # Verify subnet manager creation @@ -80,6 +80,6 @@ test: cat /tmp/flannel-output.log exit 1 fi - + # Clean up: Stop etcd - kill $ETCD_PID \ No newline at end of file + kill $ETCD_PID From d3e12a91214175f20c4b433d4d9337163688fe42 Mon Sep 17 00:00:00 2001 From: Rahul Duvedi <53002164+rahulduvedi@users.noreply.github.com> Date: Thu, 20 Mar 2025 12:22:55 +0530 Subject: [PATCH 05/14] updated the string to correctlly pass the ld ldflags and updated tests Signed-off-by: Rahul Duvedi <53002164+rahulduvedi@users.noreply.github.com> --- flannel.yaml | 45 +++++++++++++++++++++++++++++---------------- 1 file changed, 29 insertions(+), 16 deletions(-) diff --git a/flannel.yaml b/flannel.yaml index 8a6f317939e..11e0b5dc8bb 100644 --- a/flannel.yaml +++ b/flannel.yaml @@ -1,7 +1,7 @@ package: name: flannel version: "0.26.5" - epoch: 4 + epoch: 12 description: flannel is a network fabric for containers, designed for Kubernetes copyright: - license: Apache-2.0 @@ -34,9 +34,8 @@ pipeline: if [ "$(go env GOARCH)" = "amd64" ]; then CGO_ENABLED=1 fi - CGO_ENABLED=$(CGO_ENABLED) go build -o "${{targets.destdir}}"/usr/bin/flanneld \ - -ldflags '-extldflags "-static" -X github.com/flannel-io/flannel/pkg/version.version=${{package.version}}' - + CGO_ENABLED=$CGO_ENABLED go build -o "${{targets.destdir}}"/usr/bin/flanneld \ + -ldflags "-extldflags \"-static\" -X github.com/flannel-io/flannel/pkg/version.Version=${{package.version}}" update: enabled: true github: @@ -47,39 +46,53 @@ test: environment: contents: packages: - - ${{package.name}} + - ${{ package.name }} - etcd pipeline: - runs: | + #!/bin/bash + set -euxo pipefail + # Check flanneld version flanneld --version - # Start etcd (default v3) - mkdir -p /var/lib/etcd - etcd --data-dir=/var/lib/etcd --listen-client-urls=http://127.0.0.1:2379 --advertise-client-urls=http://127.0.0.1:2379 > /tmp/etcd.log 2>&1 & + # Start etcd with a dedicated temporary data directory + mkdir -p /tmp/etcd-data + etcd --data-dir=/tmp/etcd-data \ + --listen-client-urls=http://127.0.0.1:2379 \ + --advertise-client-urls=http://127.0.0.1:2379 > /tmp/etcd.log 2>&1 & ETCD_PID=$! + # Ensure etcd is always killed even if an error occurs + trap 'kill $ETCD_PID || true' EXIT - # Wait for etcd readiness (max 5 attempts) + # Wait for etcd readiness (try up to 5 times) for i in {1..5}; do - if curl -s http://127.0.0.1:2379/version; then + if etcdctl --endpoints=http://127.0.0.1:2379 endpoint status --write-out=table; then break fi sleep 1 done - # Set flannel config in etcd using etcdctl v3 command - etcdctl --endpoints=http://127.0.0.1:2379 put /coreos.com/network/config '{"Network": "10.244.0.0/16", "Backend": {"Type": "host-gw"}}' + # Set flannel configuration in etcd using etcdctl v3 command + etcdctl --endpoints=http://127.0.0.1:2379 put /coreos.com/network/config \ + '{"Network": "10.244.0.0/16", "Backend": {"Type": "host-gw"}}' # Run flanneld with a timeout, specifying a valid interface (e.g. eth0) - timeout 3s flanneld --etcd-endpoints=http://127.0.0.1:2379 --iface=eth0 > /tmp/flannel-output.log 2>&1 || true + timeout 5s flanneld --etcd-endpoints=http://127.0.0.1:2379 --iface=eth0 > /tmp/flannel-output.log 2>&1 || true + # Output flannel logs for debugging purposes cat /tmp/flannel-output.log - # Verify subnet manager creation + # Verify that flanneld successfully created the subnet manager if ! grep -q "Created subnet manager" /tmp/flannel-output.log; then + echo "Subnet manager not created. Logs:" cat /tmp/flannel-output.log exit 1 fi - # Clean up: Stop etcd - kill $ETCD_PID + # Optionally, check that the subnet file was created and contains expected values + if [ ! -f /run/flannel/subnet.env ]; then + echo "Subnet file not found" + exit 1 + fi + grep -q "FLANNEL_SUBNET=" /run/flannel/subnet.env From 2be9cd3f062ba5cfa0b1a698de812e2580235492 Mon Sep 17 00:00:00 2001 From: Rahul Duvedi <53002164+rahulduvedi@users.noreply.github.com> Date: Thu, 20 Mar 2025 13:16:27 +0530 Subject: [PATCH 06/14] updated tests to use the test/daemon-check-output pipeline --- flannel.yaml | 101 ++++++++++++++++++++++++++++----------------------- 1 file changed, 56 insertions(+), 45 deletions(-) diff --git a/flannel.yaml b/flannel.yaml index 11e0b5dc8bb..86e9595c85f 100644 --- a/flannel.yaml +++ b/flannel.yaml @@ -46,53 +46,64 @@ test: environment: contents: packages: - - ${{ package.name }} + - flannel - etcd pipeline: - - runs: | - #!/bin/bash - set -euxo pipefail + - name: "Test flanneld daemon output" + uses: test/daemon-check-output + with: + setup: | + #!/bin/sh -ex + # Start etcd in background with proper networking configuration + mkdir -p /tmp/etcd-data + etcd --data-dir=/tmp/etcd-data \ + --listen-client-urls=http://127.0.0.1:2379 \ + --advertise-client-urls=http://127.0.0.1:2379 > /tmp/etcd.log 2>&1 & + ETCD_PID=$! + + # Ensure etcd is ready before proceeding + for i in 1 2 3 4 5; do + if etcdctl --endpoints=http://127.0.0.1:2379 endpoint status --write-out=table; then + break + fi + sleep 1 + done + + # Store flannel network config in etcd + printf "{\"Network\": \"10.244.0.0/16\", \"Backend\": {\"Type\": \"host-gw\"}}" > /tmp/flannel-config.json + etcdctl --endpoints=http://127.0.0.1:2379 put /coreos.com/network/config "$(cat /tmp/flannel-config.json)" + + # Save PID for cleanup + echo "export ETCD_PID=$ETCD_PID" > /tmp/etcd_pid.sh - # Check flanneld version - flanneld --version + # Disable iptables to avoid permission issues in unprivileged test environments and focus testing on core networking capabilities + start: flanneld --etcd-endpoints=http://127.0.0.1:2379 --iface=eth0 --iptables-forward-rules=false + + timeout: 10 - # Start etcd with a dedicated temporary data directory - mkdir -p /tmp/etcd-data - etcd --data-dir=/tmp/etcd-data \ - --listen-client-urls=http://127.0.0.1:2379 \ - --advertise-client-urls=http://127.0.0.1:2379 > /tmp/etcd.log 2>&1 & - ETCD_PID=$! - # Ensure etcd is always killed even if an error occurs - trap 'kill $ETCD_PID || true' EXIT - - # Wait for etcd readiness (try up to 5 times) - for i in {1..5}; do - if etcdctl --endpoints=http://127.0.0.1:2379 endpoint status --write-out=table; then - break + expected_output: | + Created subnet manager + + error_strings: | + "msg":"error connecting to etcd" + "level":"error" .* "could not create subnet manager" + "panic" + "fatal" + "Failed" + "Error: could not access etcd" + "error: could not allocate lease" + + post: | + #!/bin/sh -ex + # Load etcd PID from setup phase + . /tmp/etcd_pid.sh + + # Verify flannel created the proper subnet configuration + if [ ! -f /run/flannel/subnet.env ]; then + echo "Subnet file not found" + exit 1 fi - sleep 1 - done - - # Set flannel configuration in etcd using etcdctl v3 command - etcdctl --endpoints=http://127.0.0.1:2379 put /coreos.com/network/config \ - '{"Network": "10.244.0.0/16", "Backend": {"Type": "host-gw"}}' - - # Run flanneld with a timeout, specifying a valid interface (e.g. eth0) - timeout 5s flanneld --etcd-endpoints=http://127.0.0.1:2379 --iface=eth0 > /tmp/flannel-output.log 2>&1 || true - - # Output flannel logs for debugging purposes - cat /tmp/flannel-output.log - - # Verify that flanneld successfully created the subnet manager - if ! grep -q "Created subnet manager" /tmp/flannel-output.log; then - echo "Subnet manager not created. Logs:" - cat /tmp/flannel-output.log - exit 1 - fi - - # Optionally, check that the subnet file was created and contains expected values - if [ ! -f /run/flannel/subnet.env ]; then - echo "Subnet file not found" - exit 1 - fi - grep -q "FLANNEL_SUBNET=" /run/flannel/subnet.env + grep -q "FLANNEL_SUBNET=" /run/flannel/subnet.env + + # Cleanup etcd process + kill $ETCD_PID || true \ No newline at end of file From f84d4d1d6870e4d06553ef8642c347c4b1396c1f Mon Sep 17 00:00:00 2001 From: Rahul Duvedi <53002164+rahulduvedi@users.noreply.github.com> Date: Thu, 20 Mar 2025 13:17:23 +0530 Subject: [PATCH 07/14] corrected the linting by running yam --- flannel.yaml | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/flannel.yaml b/flannel.yaml index 86e9595c85f..8310403a851 100644 --- a/flannel.yaml +++ b/flannel.yaml @@ -36,6 +36,7 @@ pipeline: fi CGO_ENABLED=$CGO_ENABLED go build -o "${{targets.destdir}}"/usr/bin/flanneld \ -ldflags "-extldflags \"-static\" -X github.com/flannel-io/flannel/pkg/version.Version=${{package.version}}" + update: enabled: true github: @@ -60,7 +61,7 @@ test: --listen-client-urls=http://127.0.0.1:2379 \ --advertise-client-urls=http://127.0.0.1:2379 > /tmp/etcd.log 2>&1 & ETCD_PID=$! - + # Ensure etcd is ready before proceeding for i in 1 2 3 4 5; do if etcdctl --endpoints=http://127.0.0.1:2379 endpoint status --write-out=table; then @@ -68,22 +69,18 @@ test: fi sleep 1 done - - # Store flannel network config in etcd + + # Store flannel network config in etcd printf "{\"Network\": \"10.244.0.0/16\", \"Backend\": {\"Type\": \"host-gw\"}}" > /tmp/flannel-config.json etcdctl --endpoints=http://127.0.0.1:2379 put /coreos.com/network/config "$(cat /tmp/flannel-config.json)" - + # Save PID for cleanup echo "export ETCD_PID=$ETCD_PID" > /tmp/etcd_pid.sh - # Disable iptables to avoid permission issues in unprivileged test environments and focus testing on core networking capabilities start: flanneld --etcd-endpoints=http://127.0.0.1:2379 --iface=eth0 --iptables-forward-rules=false - timeout: 10 - expected_output: | Created subnet manager - error_strings: | "msg":"error connecting to etcd" "level":"error" .* "could not create subnet manager" @@ -92,18 +89,17 @@ test: "Failed" "Error: could not access etcd" "error: could not allocate lease" - post: | #!/bin/sh -ex # Load etcd PID from setup phase . /tmp/etcd_pid.sh - + # Verify flannel created the proper subnet configuration if [ ! -f /run/flannel/subnet.env ]; then echo "Subnet file not found" exit 1 fi grep -q "FLANNEL_SUBNET=" /run/flannel/subnet.env - + # Cleanup etcd process - kill $ETCD_PID || true \ No newline at end of file + kill $ETCD_PID || true From 6550a0f4d9dca956537e57387ae96bfdcdb356c0 Mon Sep 17 00:00:00 2001 From: Rahul Duvedi <53002164+rahulduvedi@users.noreply.github.com> Date: Thu, 20 Mar 2025 13:18:50 +0530 Subject: [PATCH 08/14] updated to correct epoch --- flannel.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flannel.yaml b/flannel.yaml index 8310403a851..a739937530c 100644 --- a/flannel.yaml +++ b/flannel.yaml @@ -1,7 +1,7 @@ package: name: flannel version: "0.26.5" - epoch: 12 + epoch: 4 description: flannel is a network fabric for containers, designed for Kubernetes copyright: - license: Apache-2.0 From 61b8483485a4c90a2b9772c3aa0c9356ce725462 Mon Sep 17 00:00:00 2001 From: Rahul Duvedi <53002164+rahulduvedi@users.noreply.github.com> Date: Thu, 20 Mar 2025 13:28:16 +0530 Subject: [PATCH 09/14] updated code to pass the lint check --- flannel.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flannel.yaml b/flannel.yaml index a739937530c..2f668a3feda 100644 --- a/flannel.yaml +++ b/flannel.yaml @@ -47,7 +47,7 @@ test: environment: contents: packages: - - flannel + - ${{package.name}} - etcd pipeline: - name: "Test flanneld daemon output" From a081fa8f80f518d2df57a564a7ee6d5062d1bd4e Mon Sep 17 00:00:00 2001 From: Rahul Duvedi <53002164+rahulduvedi@users.noreply.github.com> Date: Fri, 21 Mar 2025 20:08:36 +0530 Subject: [PATCH 10/14] Update flannel.yaml Co-authored-by: maxgio92 Signed-off-by: Rahul Duvedi <53002164+rahulduvedi@users.noreply.github.com> --- flannel.yaml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/flannel.yaml b/flannel.yaml index 2f668a3feda..5e630b30070 100644 --- a/flannel.yaml +++ b/flannel.yaml @@ -77,7 +77,11 @@ test: # Save PID for cleanup echo "export ETCD_PID=$ETCD_PID" > /tmp/etcd_pid.sh # Disable iptables to avoid permission issues in unprivileged test environments and focus testing on core networking capabilities - start: flanneld --etcd-endpoints=http://127.0.0.1:2379 --iface=eth0 --iptables-forward-rules=false + start: | + sleep 3 + IFACE=$(ip -json route show default | jq -r '.[0].dev') + echo "export IFACE=$IFACE" >> /tmp/env.sh + flanneld --etcd-endpoints=http://127.0.0.1:2379 --iface=$IFACE --iptables-forward-rules=false timeout: 10 expected_output: | Created subnet manager From 105f1949c3fd5e669c20bbf96f4835d9c6738763 Mon Sep 17 00:00:00 2001 From: Rahul Duvedi <53002164+rahulduvedi@users.noreply.github.com> Date: Fri, 21 Mar 2025 20:09:20 +0530 Subject: [PATCH 11/14] Updated flanneld tests Co-authored-by: maxgio92 Signed-off-by: Rahul Duvedi <53002164+rahulduvedi@users.noreply.github.com> --- flannel.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/flannel.yaml b/flannel.yaml index 5e630b30070..b1472470802 100644 --- a/flannel.yaml +++ b/flannel.yaml @@ -82,6 +82,10 @@ test: IFACE=$(ip -json route show default | jq -r '.[0].dev') echo "export IFACE=$IFACE" >> /tmp/env.sh flanneld --etcd-endpoints=http://127.0.0.1:2379 --iface=$IFACE --iptables-forward-rules=false + sleep 3 + IFACE=$(ip -json route show default | jq -r '.[0].dev') + echo "export IFACE=$IFACE" >> /tmp/env.sh + flanneld --etcd-endpoints=http://127.0.0.1:2379 --iface=$IFACE --iptables-forward-rules=false timeout: 10 expected_output: | Created subnet manager From 0f548967b48099fdd790ad82cc13422c4b526253 Mon Sep 17 00:00:00 2001 From: Rahul Duvedi <53002164+rahulduvedi@users.noreply.github.com> Date: Fri, 21 Mar 2025 20:09:38 +0530 Subject: [PATCH 12/14] Update flannel.yaml Co-authored-by: maxgio92 Signed-off-by: Rahul Duvedi <53002164+rahulduvedi@users.noreply.github.com> --- flannel.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flannel.yaml b/flannel.yaml index b1472470802..bc0d9780255 100644 --- a/flannel.yaml +++ b/flannel.yaml @@ -75,7 +75,7 @@ test: etcdctl --endpoints=http://127.0.0.1:2379 put /coreos.com/network/config "$(cat /tmp/flannel-config.json)" # Save PID for cleanup - echo "export ETCD_PID=$ETCD_PID" > /tmp/etcd_pid.sh + echo "export ETCD_PID=$ETCD_PID" > /tmp/env.sh # Disable iptables to avoid permission issues in unprivileged test environments and focus testing on core networking capabilities start: | sleep 3 From 52a7b4dcb0a0c681fa5fd5eac96f684f11120646 Mon Sep 17 00:00:00 2001 From: Rahul Duvedi <53002164+rahulduvedi@users.noreply.github.com> Date: Fri, 21 Mar 2025 20:09:59 +0530 Subject: [PATCH 13/14] Update flannel.yaml Co-authored-by: maxgio92 Signed-off-by: Rahul Duvedi <53002164+rahulduvedi@users.noreply.github.com> --- flannel.yaml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/flannel.yaml b/flannel.yaml index bc0d9780255..73de7e9ec82 100644 --- a/flannel.yaml +++ b/flannel.yaml @@ -108,6 +108,13 @@ test: exit 1 fi grep -q "FLANNEL_SUBNET=" /run/flannel/subnet.env - ++ # Check leases: https://github.com/flannel-io/flannel/blob/b73b907459f317a25ba589c233784517eacf260c/Documentation/reservations.md#leases ++ LEASE_SUBNET_ETCD_KEY=$(etcdctl get /coreos.com/network/subnets --prefix --keys-only) ++ LEASE_PUBLIC_IP=$(etcdctl get $LEASE_SUBNET_ETCD_KEY --print-value-only=true | jq '.PublicIP' | tr -d "\"") ++ ++ LEASE_ETCD_LEASE_ID=$(etcdctl lease list | tail -1) ++ etcdctl lease timetolive --keys $LEASE_ETCD_LEASE_ID | grep $LEASE_SUBNET_ETCD_KEY ++ ip address show $IFACE | grep $LEASE_PUBLIC_IP ++ ip route get $LEASE_PUBLIC_IP # Cleanup etcd process kill $ETCD_PID || true From fc7d38541456d157f4bb45aab7bf15bc5ce8c2a8 Mon Sep 17 00:00:00 2001 From: Rahul Duvedi <53002164+rahulduvedi@users.noreply.github.com> Date: Fri, 21 Mar 2025 20:10:15 +0530 Subject: [PATCH 14/14] Update flannel.yaml Co-authored-by: maxgio92 Signed-off-by: Rahul Duvedi <53002164+rahulduvedi@users.noreply.github.com> --- flannel.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/flannel.yaml b/flannel.yaml index 73de7e9ec82..5f75e14c0ed 100644 --- a/flannel.yaml +++ b/flannel.yaml @@ -49,6 +49,8 @@ test: packages: - ${{package.name}} - etcd + - jq + - iproute2 pipeline: - name: "Test flanneld daemon output" uses: test/daemon-check-output