Skip to content

Commit

Permalink
health: Prefer contacting health EP over IPv4
Browse files Browse the repository at this point in the history
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 <joe@cilium.io>
  • Loading branch information
joestringer authored and tgraf committed Aug 27, 2019
1 parent 713da5a commit ecf7ada
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions cilium-health/launch/endpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit ecf7ada

Please sign in to comment.