diff --git a/pkg/controller/pod.go b/pkg/controller/pod.go index 071c811a122..4132c0544b6 100644 --- a/pkg/controller/pod.go +++ b/pkg/controller/pod.go @@ -854,7 +854,7 @@ func (c *Controller) reconcileRouteSubnets(cachedPod, pod *v1.Pod, needRoutePodN } if err := c.addStaticRouteToVpc( - c.config.ClusterRouter, + subnet.Spec.Vpc, &kubeovnv1.StaticRoute{ Policy: kubeovnv1.PolicySrc, CIDR: podIP, @@ -905,7 +905,7 @@ func (c *Controller) reconcileRouteSubnets(cachedPod, pod *v1.Pod, needRoutePodN if pod.Annotations[util.NorthGatewayAnnotation] != "" { if err := c.addStaticRouteToVpc( - subnet.Spec.RouteTable, + subnet.Spec.Vpc, &kubeovnv1.StaticRoute{ Policy: kubeovnv1.PolicySrc, CIDR: podIP, diff --git a/pkg/controller/subnet.go b/pkg/controller/subnet.go index ecaf8acb661..3cd62fa1385 100644 --- a/pkg/controller/subnet.go +++ b/pkg/controller/subnet.go @@ -1546,7 +1546,7 @@ func (c *Controller) reconcileDistributedSubnetRouteInDefaultVpc(subnet *kubeovn if pod.Annotations[util.NorthGatewayAnnotation] != "" { if err := c.addStaticRouteToVpc( - c.config.ClusterRouter, + subnet.Spec.Vpc, &kubeovnv1.StaticRoute{ Policy: kubeovnv1.PolicySrc, CIDR: pod.Annotations[fmt.Sprintf(util.IPAddressAnnotationTemplate, podNet.ProviderName)],