@@ -52,12 +52,12 @@ func (c *Controller) disableOVNIC(azName string) error {
5252 return nil
5353}
5454
55- func (c * Controller ) setAutoRoute (autoRoute bool ) {
55+ func (c * Controller ) setAutoRoute (autoRoute bool ) error {
5656 var blackList []string
5757 subnets , err := c .subnetsLister .List (labels .Everything ())
5858 if err != nil {
5959 klog .Errorf ("failed to list subnets, %v" , err )
60- return
60+ return err
6161 }
6262 for _ , subnet := range subnets {
6363 if subnet .Spec .DisableInterConnection || subnet .Name == c .config .NodeSwitch {
@@ -67,7 +67,7 @@ func (c *Controller) setAutoRoute(autoRoute bool) {
6767 nodes , err := c .nodesLister .List (labels .Everything ())
6868 if err != nil {
6969 klog .Errorf ("failed to list node, %v" , err )
70- return
70+ return err
7171 }
7272 for _ , node := range nodes {
7373 ipv4 , ipv6 := util .GetNodeInternalIP (* node )
@@ -80,8 +80,10 @@ func (c *Controller) setAutoRoute(autoRoute bool) {
8080 }
8181 if err := c .OVNNbClient .SetICAutoRoute (autoRoute , blackList ); err != nil {
8282 klog .Errorf ("failed to config auto route, %v" , err )
83- return
83+ return err
8484 }
85+
86+ return nil
8587}
8688
8789func (c * Controller ) DeleteICResources (azName string ) error {
@@ -178,14 +180,22 @@ func (c *Controller) resyncInterConnection() {
178180 klog .Errorf ("Disable az %s OVN IC failed: %v" , azName , err )
179181 return
180182 }
183+ if err = c .setAutoRoute (false ); err != nil {
184+ klog .Errorf ("failed to disable auto route: %v" , err )
185+ return
186+ }
187+
181188 icEnabled = "false"
182189 lastIcCm = nil
183190
184191 klog .Info ("finish removing ovn-ic" )
185192 return
186193 }
187194
188- c .setAutoRoute (cm .Data ["auto-route" ] == "true" )
195+ if err = c .setAutoRoute (cm .Data ["auto-route" ] == "true" ); err != nil {
196+ klog .Errorf ("failed to set auto route: %v" , err )
197+ return
198+ }
189199
190200 switch c .getICState (cm .Data , lastIcCm ) {
191201 case icNoAction :
0 commit comments