aboutsummaryrefslogtreecommitdiff
path: root/plugin/kubernetes/controller.go
diff options
context:
space:
mode:
authorGravatar Chris O'Haver <cohaver@infoblox.com> 2020-12-21 05:30:24 -0500
committerGravatar GitHub <noreply@github.com> 2020-12-21 02:30:24 -0800
commit51c05679e69dacd745db2b1eb33be04d7b626959 (patch)
tree6ec0071b8378f31a0d96eeea4061e58723be2d6d /plugin/kubernetes/controller.go
parent302434e3928219138313610c7faf9be5cc598129 (diff)
downloadcoredns-51c05679e69dacd745db2b1eb33be04d7b626959.tar.gz
coredns-51c05679e69dacd745db2b1eb33be04d7b626959.tar.zst
coredns-51c05679e69dacd745db2b1eb33be04d7b626959.zip
plugin/kubernetes: Add support for dual stack ClusterIP Services (#4339)
* support dual stack clusterIPs Signed-off-by: Chris O'Haver <cohaver@infoblox.com> * stickler Signed-off-by: Chris O'Haver <cohaver@infoblox.com> * fix ClusterIPs make Signed-off-by: Chris O'Haver <cohaver@infoblox.com>
Diffstat (limited to 'plugin/kubernetes/controller.go')
-rw-r--r--plugin/kubernetes/controller.go8
1 files changed, 5 insertions, 3 deletions
diff --git a/plugin/kubernetes/controller.go b/plugin/kubernetes/controller.go
index 2319cf203..d10d9f313 100644
--- a/plugin/kubernetes/controller.go
+++ b/plugin/kubernetes/controller.go
@@ -200,11 +200,13 @@ func svcIPIndexFunc(obj interface{}) ([]string, error) {
if !ok {
return nil, errObj
}
+ idx := make([]string, len(svc.ClusterIPs)+len(svc.ExternalIPs))
+ copy(idx, svc.ClusterIPs)
if len(svc.ExternalIPs) == 0 {
- return []string{svc.ClusterIP}, nil
+ return idx, nil
}
-
- return append([]string{svc.ClusterIP}, svc.ExternalIPs...), nil
+ copy(idx[len(svc.ClusterIPs):], svc.ExternalIPs)
+ return idx, nil
}
func svcNameNamespaceIndexFunc(obj interface{}) ([]string, error) {