plugin/kubernetes: support pods with multiple IPs (#8635)

The Pod object stored only the primary pod IP (status.podIP), causing
PodIndex lookups to fail for IPv6 clients in dual-stack clusters. This
prevented the metadata plugin from populating client-pod-name and
client-namespace.

Replace the PodIP string field with a PodIPs []string slice populated
from status.podIPs, and update podIPIndexFunc to index all IPs.

Signed-off-by: Christian Norbert Menges <christian.norbert.menges@sap.com>
This commit is contained in:
Christian Menges
2026-10-15 10:12:29 +02:00
committed by GitHub
parent 25b51bcbd9
commit 2e2324715b
6 changed files with 32 additions and 18 deletions

View File

@@ -5,6 +5,7 @@ import (
"errors"
"fmt"
"maps"
"slices"
"sync"
"sync/atomic"
"time"
@@ -271,7 +272,9 @@ func podIPIndexFunc(obj any) ([]string, error) {
if !ok {
return nil, errObj
}
return []string{p.PodIP}, nil
idx := make([]string, len(p.PodIPs))
copy(idx, p.PodIPs)
return idx, nil
}
func svcIPIndexFunc(obj any) ([]string, error) {
@@ -776,7 +779,7 @@ func podModified(oldObj, newObj any) bool {
if !okOld || !okNew {
return true
}
return oldPod.PodIP != newPod.PodIP
return !slices.Equal(oldPod.PodIPs, newPod.PodIPs)
}
// endpointsEquivalent checks if the update to an endpoint is something