@@ -192,14 +192,13 @@ func (c *Controller) handleAddOrUpdateVpcNatGw(key string) error {
192192 }
193193
194194 var natGwPodContainerRestartCount int32
195- pod , _err := c .getNatGwPod (key )
196- if _err == nil {
197- for _ , psc := range pod .Status .ContainerStatuses {
198- if psc .Name != "vpc-nat-gw" {
199- continue
195+ pod , err := c .getNatGwPod (key )
196+ if err == nil {
197+ for _ , containerStatus := range pod .Status .ContainerStatuses {
198+ if containerStatus .Name == "vpc-nat-gw" {
199+ natGwPodContainerRestartCount = containerStatus .RestartCount
200+ break
200201 }
201- natGwPodContainerRestartCount = psc .RestartCount
202- break
203202 }
204203 }
205204
@@ -972,10 +971,13 @@ func (c *Controller) genNatGwStatefulSet(gw *kubeovnv1.VpcNatGateway, oldSts *v1
972971 if v6Gateway != "" {
973972 routes = append (routes , request.Route {Destination : "::/0" , Gateway : v6Gateway })
974973 }
975-
976- if err = setPodRoutesAnnotation (annotations , subnet .Spec .Provider , routes ); err != nil {
977- klog .Error (err )
978- return nil , err
974+ if ! gw .Spec .NoDefaultEIP {
975+ if err = setPodRoutesAnnotation (annotations , subnet .Spec .Provider , routes ); err != nil {
976+ klog .Error (err )
977+ return nil , err
978+ }
979+ } else {
980+ annotations [fmt .Sprintf (util .AllocatedAnnotationTemplate , subnet .Spec .Provider )] = "true"
979981 }
980982
981983 selectors := util .GenNatGwSelectors (gw .Spec .Selector )
@@ -1006,6 +1008,16 @@ func (c *Controller) genNatGwStatefulSet(gw *kubeovnv1.VpcNatGateway, oldSts *v1
10061008 Image : vpcNatImage ,
10071009 Command : []string {"sleep" , "infinity" },
10081010 ImagePullPolicy : corev1 .PullIfNotPresent ,
1011+ Env : []corev1.EnvVar {
1012+ {
1013+ Name : "GATEWAY_V4" ,
1014+ Value : v4Gateway ,
1015+ },
1016+ {
1017+ Name : "GATEWAY_V6" ,
1018+ Value : v6Gateway ,
1019+ },
1020+ },
10091021 SecurityContext : & corev1.SecurityContext {
10101022 Privileged : ptr .To (true ),
10111023 AllowPrivilegeEscalation : ptr .To (true ),
0 commit comments