Skip to content

Commit

Permalink
Merge pull request #3675 from jordigilh/fix/add_wait_egressgw_for_rep…
Browse files Browse the repository at this point in the history
…air_end

Wait for APB controller's clean external gateway ECMP routes before resuming default net controller startup
  • Loading branch information
trozet committed Jun 30, 2023
2 parents de9f76d + b4fcdce commit 2b0eb9a
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -197,9 +197,6 @@ func (c *ExternalGatewayMasterController) Run(threadiness int) {
}
syncWg.Wait()

klog.V(4).InfoS("Repairing Admin Policy Based External Route Services")
c.repair()

wg := &sync.WaitGroup{}
for i := 0; i < threadiness; i++ {
for _, workerFn := range []func(*sync.WaitGroup){
Expand Down
2 changes: 1 addition & 1 deletion go-controller/pkg/ovn/controller/apbroute/repair.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ type managedGWIPs struct {
gwList gatewayInfoList
}

func (c *ExternalGatewayMasterController) repair() {
func (c *ExternalGatewayMasterController) Repair() {
start := time.Now()
defer func() {
klog.V(4).InfoS("Syncing exgw routes took %v", time.Since(start))
Expand Down
5 changes: 4 additions & 1 deletion go-controller/pkg/ovn/default_network_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,10 @@ func (oc *DefaultNetworkController) Init() error {
klog.Errorf("Failed to setup master (%v)", err)
return err
}

// Sync external gateway routes. External gateway are set via Admin Policy Based External Route CRs.
// So execute an individual sync method at startup to cleanup any difference
klog.V(4).InfoS("Cleaning External Gateway ECMP routes")
WithSyncDurationMetricNoError("external gateway routes", oc.apbExternalRouteController.Repair)
return nil
}

Expand Down
1 change: 1 addition & 0 deletions go-controller/pkg/ovn/external_gateway_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3042,6 +3042,7 @@ func deleteNamespace(namespaceName string, fakeClient kubernetes.Interface) {
}

func (o *FakeOVN) RunAPBExternalPolicyController() {
o.controller.apbExternalRouteController.Repair()
o.controller.wg.Add(1)
go func() {
defer o.controller.wg.Done()
Expand Down

0 comments on commit 2b0eb9a

Please sign in to comment.