mirror of
https://github.com/coredns/coredns.git
synced 2026-10-16 23:35:43 -04:00
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:
@@ -55,7 +55,7 @@ func deepCopyCases() []struct {
|
||||
}{
|
||||
{"Pod", &Pod{
|
||||
Version: "1",
|
||||
PodIP: "10.244.0.1",
|
||||
PodIPs: []string{"10.244.0.1", "fd00::1"},
|
||||
Name: "pod1",
|
||||
Namespace: "testns",
|
||||
Labels: map[string]string{"app": "nginx", "tier": "frontend"},
|
||||
@@ -196,7 +196,7 @@ func TestDeepCopyObjectIsDeep(t *testing.T) {
|
||||
// Nil maps and slices must stay nil rather than becoming empty, so a round trip does
|
||||
// not change how a value compares.
|
||||
func TestDeepCopyObjectPreservesNilLabels(t *testing.T) {
|
||||
pod := &Pod{Version: "1", PodIP: "10.244.0.1", Name: "pod1", Namespace: "testns"}
|
||||
pod := &Pod{Version: "1", PodIPs: []string{"10.244.0.1"}, Name: "pod1", Namespace: "testns"}
|
||||
cp := pod.DeepCopyObject().(*Pod)
|
||||
if cp.Labels != nil {
|
||||
t.Errorf("nil Labels became %#v after a round trip", cp.Labels)
|
||||
|
||||
Reference in New Issue
Block a user