Skip to content

Commit 6833ac3

Browse files
mkowalskiclaude
andcommitted
Fix DCM ingress tests to support IPv6-only clusters
Replace hardcoded 127.0.0.1 loopback address with dynamic detection based on the router pod's IP family. On IPv6-only clusters, 127.0.0.1 is unavailable, so ::1 must be used instead. Also bracket the IPv6 address in the metrics curl URL via exutil.IPUrl(). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent f183253 commit 6833ac3

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

test/extended/router/config_manager_ingress.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import (
2727
"k8s.io/kubernetes/test/utils/image"
2828
"k8s.io/pod-security-admission/api"
2929
"k8s.io/utils/exec"
30+
utilnet "k8s.io/utils/net"
3031
"k8s.io/utils/ptr"
3132

3233
operatorv1 "github.com/openshift/api/operator/v1"
@@ -123,12 +124,18 @@ var _ = g.Describe("[sig-network-edge][Feature:Router][apigroup:route.openshift.
123124
o.Expect(err).NotTo(o.HaveOccurred())
124125
o.Expect(pods.Items).To(o.HaveLen(1))
125126

127+
// Use the appropriate loopback address based on the pod's IP family.
128+
// IPv6-only clusters won't have 127.0.0.1 available.
129+
loopback := "127.0.0.1"
130+
if utilnet.IsIPv6String(pods.Items[0].Status.PodIP) {
131+
loopback = "::1"
132+
}
126133
execPod = execPodRef{
127134
NamespacedName: types.NamespacedName{
128135
Namespace: pods.Items[0].Namespace,
129136
Name: pods.Items[0].Name,
130137
},
131-
ipAddress: "127.0.0.1",
138+
ipAddress: loopback,
132139
}
133140
})
134141

@@ -521,7 +528,7 @@ var _ = g.Describe("[sig-network-edge][Feature:Router][apigroup:route.openshift.
521528
getMetric := func(metricName string) int {
522529
cmd := fmt.Sprintf(
523530
`curl -sS %s:1936/metrics --user %s:%s | grep '^%s.*route="%s"' | sed 's/.* //'`,
524-
execPod.ipAddress, statsUser, statsPasswd, metricName, resourceName)
531+
exutil.IPUrl(execPod.ipAddress), statsUser, statsPasswd, metricName, resourceName)
525532
output, err := e2eoutput.RunHostCmd(execPod.Namespace, execPod.Name, cmd)
526533
o.Expect(err).NotTo(o.HaveOccurred())
527534
if output == "" {

0 commit comments

Comments
 (0)