mirror of
https://github.com/tailscale/tailscale.git
synced 2025-04-22 08:51:41 +00:00
cmd/k8s-operator: fix Pod IP selection (#13743)
Ensure that .status.podIPs is used to select Pod's IP in all reconcilers. Updates tailscale/tailscale#13406 Signed-off-by: Irbe Krumina <irbe@tailscale.com>
This commit is contained in:
parent
da40609abd
commit
60011e73b8
@ -111,9 +111,13 @@ func (er *egressEpsReconciler) Reconcile(ctx context.Context, req reconcile.Requ
|
|||||||
if !ready {
|
if !ready {
|
||||||
continue // maybe next time
|
continue // maybe next time
|
||||||
}
|
}
|
||||||
|
podIP, err := podIPv4(&pod) // we currently only support IPv4
|
||||||
|
if err != nil {
|
||||||
|
return res, fmt.Errorf("error determining IPv4 address for Pod: %w", err)
|
||||||
|
}
|
||||||
newEndpoints = append(newEndpoints, discoveryv1.Endpoint{
|
newEndpoints = append(newEndpoints, discoveryv1.Endpoint{
|
||||||
Hostname: (*string)(&pod.UID),
|
Hostname: (*string)(&pod.UID),
|
||||||
Addresses: []string{pod.Status.PodIP},
|
Addresses: []string{podIP},
|
||||||
Conditions: discoveryv1.EndpointConditions{
|
Conditions: discoveryv1.EndpointConditions{
|
||||||
Ready: ptr.To(true),
|
Ready: ptr.To(true),
|
||||||
Serving: ptr.To(true),
|
Serving: ptr.To(true),
|
||||||
|
@ -104,7 +104,7 @@ func TestTailscaleEgressEndpointSlices(t *testing.T) {
|
|||||||
})
|
})
|
||||||
expectReconciled(t, er, "operator-ns", "foo")
|
expectReconciled(t, er, "operator-ns", "foo")
|
||||||
eps.Endpoints = append(eps.Endpoints, discoveryv1.Endpoint{
|
eps.Endpoints = append(eps.Endpoints, discoveryv1.Endpoint{
|
||||||
Addresses: []string{pod.Status.PodIP},
|
Addresses: []string{"10.0.0.1"},
|
||||||
Hostname: pointer.To("foo"),
|
Hostname: pointer.To("foo"),
|
||||||
Conditions: discoveryv1.EndpointConditions{
|
Conditions: discoveryv1.EndpointConditions{
|
||||||
Serving: pointer.ToBool(true),
|
Serving: pointer.ToBool(true),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user