Skip to content

Commit

Permalink
fix: clean up gateway chassis list for external gw
Browse files Browse the repository at this point in the history
when external gateway's type is changed from
'distributed' to 'centralized' or external-gw-nodes
list changes, it needs to clean up the existing
chassis gateways.

(cherry picked from commit 5484387)
  • Loading branch information
Ruijian Zhang authored and oilbeater committed Jun 22, 2021
1 parent 96e2245 commit 63122eb
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions pkg/controller/external-gw.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,14 @@ func (c *Controller) resyncExternalGateway() {
if exGwEnabled == "true" && lastExGwCM != nil && reflect.DeepEqual(cm.Data, lastExGwCM) {
return
}
if (lastExGwCM["type"] == "distributed" && cm.Data["type"] == "centralized") ||
!reflect.DeepEqual(lastExGwCM["external-gw-nodes"], cm.Data["external-gw-nodes"]) {
klog.Info("external gw nodes list changed, start to remove ovn external gw")
if err := c.removeExternalGateway(); err != nil {
klog.Errorf("failed to remove old ovn external gw, %v", err)
return
}
}
klog.Info("start to establish ovn external gw")
if err := c.establishExternalGateway(cm.Data); err != nil {
klog.Errorf("failed to establish ovn-external-gw, %v", err)
Expand Down

0 comments on commit 63122eb

Please sign in to comment.