From b171744553c0f05b8267ca9f22dd7cc9dc66e02c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E7=A5=96=E5=BB=BA?= Date: Wed, 19 Jul 2023 13:21:22 +0800 Subject: [PATCH] ipam: fix ippool with single dual-stack address (#3054) --- pkg/controller/pod.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkg/controller/pod.go b/pkg/controller/pod.go index 26a156a3d12..0fd06687eb6 100644 --- a/pkg/controller/pod.go +++ b/pkg/controller/pod.go @@ -1448,6 +1448,9 @@ func (c *Controller) acquireAddress(pod *v1.Pod, podNet *kubeovnNet) (string, st ipPool = strings.Split(pod.Annotations[fmt.Sprintf(util.IpPoolAnnotationTemplate, podNet.ProviderName)], ";") } else { ipPool = strings.Split(pod.Annotations[fmt.Sprintf(util.IpPoolAnnotationTemplate, podNet.ProviderName)], ",") + if len(ipPool) == 2 && util.CheckProtocol(ipPool[0]) != util.CheckProtocol(ipPool[1]) { + ipPool = []string{pod.Annotations[fmt.Sprintf(util.IpPoolAnnotationTemplate, podNet.ProviderName)]} + } } for i, ip := range ipPool { ipPool[i] = strings.TrimSpace(ip)