From 56a98e2d93482a0fd07a6cf9639412bc9f46f3d9 Mon Sep 17 00:00:00 2001 From: zhuanlan Date: Wed, 8 May 2024 15:19:59 +0800 Subject: [PATCH] Disable pod use NodeSwitch subnet Signed-off-by: zhuanlan --- pkg/controller/pod.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkg/controller/pod.go b/pkg/controller/pod.go index cbc6b0b3d8dd..7d0f1b0aa79c 100644 --- a/pkg/controller/pod.go +++ b/pkg/controller/pod.go @@ -835,6 +835,11 @@ func (c *Controller) reconcileRouteSubnets(cachedPod, pod *v1.Pod, needRoutePodN podIP = pod.Annotations[fmt.Sprintf(util.IPAddressAnnotationTemplate, podNet.ProviderName)] subnet = podNet.Subnet + // Check if pod uses nodeSwitch subnet + if subnet.Name == c.config.NodeSwitch { + return fmt.Errorf("NodeSwitch subnet %s is unavailable for pod", subnet.Name) + } + if (!c.config.EnableLb || !(subnet.Spec.EnableLb != nil && *subnet.Spec.EnableLb)) && subnet.Spec.Vpc == c.config.ClusterRouter && subnet.Spec.U2OInterconnection &&