From 05ab610f10274fefab6d0378aafcb0e330ab0119 Mon Sep 17 00:00:00 2001 From: Tyler Lloyd Date: Wed, 23 Mar 2022 16:01:35 +0000 Subject: [PATCH] cleanup IPv6 references only check node IPs when determining hostIP IP_VERSIONS not IP_FAMILIES Signed-off-by: Tyler Lloyd --- README.md | 2 +- pkg/goldpinger/k8s.go | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 181aad2..1ad76a7 100644 --- a/README.md +++ b/README.md @@ -231,7 +231,7 @@ You can also see [an example of using `kubeconfig` in the `./extras`](./extras/e ### Using with IPv4/IPv6 dual-stack -If your pods having IPv4 and IPv6 addresses assigned and you want to test communication over IPv6, you can specify the `USE_IPV6` environment variable which will use the IPv6 address on the pod and host. +If your cluster IPv4/IPv6 dual-stack and you want to force IPv6, you can set the `IP_VERSIONS` environment variable to "6" (default is "4") which will use the IPv6 address on the pod and host. ![ipv6](./extras/screenshot-ipv6.png) diff --git a/pkg/goldpinger/k8s.go b/pkg/goldpinger/k8s.go index 7b323be..7227933 100644 --- a/pkg/goldpinger/k8s.go +++ b/pkg/goldpinger/k8s.go @@ -69,7 +69,8 @@ func getHostIP(p v1.Pod) string { var hostIP string for _, addr := range node.Status.Addresses { - if ipMatchesConfig(addr.Address) { + if (addr.Type == v1.NodeInternalIP || addr.Type == v1.NodeExternalIP) && + ipMatchesConfig(addr.Address) { hostIP = addr.Address } }