From ecf7ada64b82c7892383b3b8e027fa5d65ca401c Mon Sep 17 00:00:00 2001 From: Joe Stringer Date: Mon, 19 Aug 2019 14:14:11 -0700 Subject: [PATCH] health: Prefer contacting health EP over IPv4 Reorder the initialization of 'healthIP' to prefer IPv4 over IPv6 when both are enabled. This makes the health endpoint less likely to fail out in some of the newly introduced datapath configuration modes. Signed-off-by: Joe Stringer --- cilium-health/launch/endpoint.go | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/cilium-health/launch/endpoint.go b/cilium-health/launch/endpoint.go index 590e7a2b46315..e1511a0c32504 100644 --- a/cilium-health/launch/endpoint.go +++ b/cilium-health/launch/endpoint.go @@ -240,17 +240,16 @@ func LaunchAsEndpoint(baseCtx context.Context, owner regeneration.Owner, n *node ip4Address, ip6Address *net.IPNet ) - if n.IPv4HealthIP != nil { - healthIP = n.IPv4HealthIP - info.Addressing.IPV4 = healthIP.String() - ip4Address = &net.IPNet{IP: healthIP, Mask: defaults.ContainerIPv4Mask} - } - if n.IPv6HealthIP != nil { healthIP = n.IPv6HealthIP info.Addressing.IPV6 = healthIP.String() ip6Address = &net.IPNet{IP: healthIP, Mask: defaults.ContainerIPv6Mask} } + if n.IPv4HealthIP != nil { + healthIP = n.IPv4HealthIP + info.Addressing.IPV4 = healthIP.String() + ip4Address = &net.IPNet{IP: healthIP, Mask: defaults.ContainerIPv4Mask} + } netNS, err := netns.ReplaceNetNSWithName(netNSName) if err != nil {