From 61e02fac882ce6f64c8d76bd6e6824bf9b380f05 Mon Sep 17 00:00:00 2001 From: Raffaele Di Fazio Date: Sun, 1 Feb 2026 14:03:56 +0000 Subject: [PATCH 1/5] fix: e2e test with dnsPolicy ClusterFirstWithHostNet for hostNetwork pods --- e2e/provider/coredns.yaml | 24 ++++++++---------------- scripts/e2e-test.sh | 27 ++++++++++++++++++++++----- 2 files changed, 30 insertions(+), 21 deletions(-) diff --git a/e2e/provider/coredns.yaml b/e2e/provider/coredns.yaml index 14d02737fb..532706be92 100644 --- a/e2e/provider/coredns.yaml +++ b/e2e/provider/coredns.yaml @@ -52,23 +52,15 @@ spec: name: dns-tcp protocol: TCP livenessProbe: - httpGet: - path: /health - port: 8080 - scheme: HTTP - initialDelaySeconds: 60 - timeoutSeconds: 5 - successThreshold: 1 - failureThreshold: 5 - readinessProbe: - httpGet: - path: /ready - port: 8181 - scheme: HTTP + tcpSocket: + port: 5353 initialDelaySeconds: 10 - timeoutSeconds: 5 - successThreshold: 1 - failureThreshold: 5 + periodSeconds: 10 + readinessProbe: + tcpSocket: + port: 5353 + initialDelaySeconds: 5 + periodSeconds: 5 volumes: - name: config-volume configMap: diff --git a/scripts/e2e-test.sh b/scripts/e2e-test.sh index 3cac31731b..0badc3a7eb 100755 --- a/scripts/e2e-test.sh +++ b/scripts/e2e-test.sh @@ -48,6 +48,18 @@ echo "Using image reference: $EXTERNAL_DNS_IMAGE" echo "Applying etcd" kubectl apply -f e2e/provider/etcd.yaml +# wait for etcd to be ready +echo "Waiting for etcd to be ready..." +kubectl wait --for=condition=ready --timeout=120s pod -l app=etcd + +# apply coredns deployment +echo "Applying CoreDNS" +kubectl apply -f e2e/provider/coredns.yaml + +# wait for coredns to be ready +echo "Waiting for CoreDNS to be ready..." +kubectl wait --for=condition=available --timeout=120s deployment/coredns + # Build a DNS testing image with dig echo "Building DNS test image with dig..." docker build -t dns-test:v1 -f - . < Date: Sun, 1 Feb 2026 19:56:55 +0000 Subject: [PATCH 2/5] remove flakiness --- scripts/e2e-test.sh | 44 +++++++++++++++++++++++--------------------- 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/scripts/e2e-test.sh b/scripts/e2e-test.sh index 0badc3a7eb..5df3dbb969 100755 --- a/scripts/e2e-test.sh +++ b/scripts/e2e-test.sh @@ -141,10 +141,6 @@ rm -rf "$TEMP_KUSTOMIZE_DIR" echo "Applying Kubernetes service..." kubectl apply -f e2e -# Wait for convergence -echo "Waiting for convergence (90 seconds)..." -sleep 90 # normal loop is 60 seconds, this is enough and should not cause flakes - # Check that the records are present echo "Checking services again..." kubectl get svc -owide @@ -157,10 +153,10 @@ echo "Testing DNS server functionality..." NODE_IP=$(kubectl get nodes -o jsonpath='{.items[0].status.addresses[?(@.type=="InternalIP")].address}') echo "Node IP: $NODE_IP" -# Test our DNS server with dig -echo "Testing DNS server with dig..." +# Test our DNS server with dig, with retry logic +echo "Testing DNS server with dig (with retries)..." -# Create DNS test job that uses dig to query our DNS server +# Create DNS test job that uses dig to query our DNS server with retries cat < Date: Mon, 2 Feb 2026 10:43:13 +0000 Subject: [PATCH 3/5] remove empty lines --- scripts/e2e-test.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/scripts/e2e-test.sh b/scripts/e2e-test.sh index 5df3dbb969..44639e1822 100755 --- a/scripts/e2e-test.sh +++ b/scripts/e2e-test.sh @@ -182,7 +182,6 @@ spec: - | echo "Testing DNS server at $NODE_IP:5353" echo "=== Testing DNS server with dig (retrying for up to 180s) ===" - MAX_ATTEMPTS=18 ATTEMPT=1 while [ \$ATTEMPT -le \$MAX_ATTEMPTS ]; do @@ -196,7 +195,6 @@ spec: sleep 10 ATTEMPT=\$((ATTEMPT + 1)) done - echo "DNS query failed after \$MAX_ATTEMPTS attempts" exit 1 From 1c12d96be612601816619db23417301a0ff8afc0 Mon Sep 17 00:00:00 2001 From: Raffaele Di Fazio Date: Mon, 23 Feb 2026 16:18:08 +0000 Subject: [PATCH 4/5] fix tests --- e2e/provider/coredns.yaml | 2 +- scripts/e2e-test.sh | 28 ++++++++++++---------------- 2 files changed, 13 insertions(+), 17 deletions(-) diff --git a/e2e/provider/coredns.yaml b/e2e/provider/coredns.yaml index 532706be92..95d4d25fb3 100644 --- a/e2e/provider/coredns.yaml +++ b/e2e/provider/coredns.yaml @@ -36,7 +36,7 @@ spec: app: coredns spec: hostNetwork: true - dnsPolicy: Default + dnsPolicy: ClusterFirstWithHostNet containers: - name: coredns image: coredns/coredns:1.13.1 diff --git a/scripts/e2e-test.sh b/scripts/e2e-test.sh index 44639e1822..1c343e2bdd 100755 --- a/scripts/e2e-test.sh +++ b/scripts/e2e-test.sh @@ -15,10 +15,20 @@ curl -Lo ./kind https://kind.sigs.k8s.io/dl/v${KIND_VERSION}/kind-linux-amd64 chmod +x ./kind sudo mv ./kind /usr/local/bin/kind +# Cleanup function +cleanup() { + echo "Cleaning up..." + kind delete cluster 2>/dev/null || true +} + # Create kind cluster echo "Creating kind cluster..." +kind delete cluster 2>/dev/null || true kind create cluster +# Set trap to cleanup on script exit +trap cleanup EXIT + # Install kubectl echo "Installing kubectl..." curl -LO "https://dl.k8s.io/release/v${KUBECTL_VERSION}/bin/linux/amd64/kubectl" @@ -186,8 +196,8 @@ spec: ATTEMPT=1 while [ \$ATTEMPT -le \$MAX_ATTEMPTS ]; do echo "Attempt \$ATTEMPT/\$MAX_ATTEMPTS: Querying externaldns-e2e.external.dns A record" - RESULT=\$(dig @$NODE_IP -p 5353 externaldns-e2e.external.dns A +short +timeout=5) - if [ -n "\$RESULT" ]; then + RESULT=\$(dig @$NODE_IP -p 5353 externaldns-e2e.external.dns A +short +timeout=5 2>/dev/null) + if echo "\$RESULT" | grep -qE '^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$'; then echo "DNS query successful: \$RESULT" exit 0 fi @@ -228,17 +238,3 @@ if [ "$TEST_PASSED" != "true" ]; then exit 1 fi -# Cleanup function -cleanup() { - echo "Cleaning up..." - if [ ! -z "$EXTERNAL_DNS_PID" ]; then - kill $EXTERNAL_DNS_PID 2>/dev/null || true - fi - if [ ! -z "$LOCAL_PROVIDER_PID" ]; then - kill $LOCAL_PROVIDER_PID 2>/dev/null || true - fi - kind delete cluster 2>/dev/null || true -} - -# Set trap to cleanup on script exit -trap cleanup EXIT From 04c18eea9bba447625c8b61e0370dad3a1131cbe Mon Sep 17 00:00:00 2001 From: Raffaele Di Fazio Date: Thu, 26 Feb 2026 10:20:46 +0000 Subject: [PATCH 5/5] removed trailing line --- scripts/e2e-test.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/e2e-test.sh b/scripts/e2e-test.sh index 1c343e2bdd..64bebedecf 100755 --- a/scripts/e2e-test.sh +++ b/scripts/e2e-test.sh @@ -237,4 +237,3 @@ echo "End-to-end test completed!" if [ "$TEST_PASSED" != "true" ]; then exit 1 fi -