Skip to content

Commit 2821587

Browse files
committed
fix NB Global not updated after OVN IC is disabled (#5511)
Signed-off-by: zhangzujian <[email protected]>
1 parent a695049 commit 2821587

File tree

2 files changed

+15
-6
lines changed

2 files changed

+15
-6
lines changed

pkg/ovn_ic_controller/ovn_ic_controller.go

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -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

8789
func (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:

pkg/ovs/ovn-nb_global.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,6 @@ func (c *OVNNbClient) SetICAutoRoute(enable bool, blackList []string) error {
173173
delete(options, "ic-route-blacklist")
174174
}
175175
if maps.Equal(options, nbGlobal.Options) {
176-
nbGlobal.Options = options
177176
return nil
178177
}
179178

0 commit comments

Comments
 (0)