Skip to content

Commit

Permalink
refactor: use ConfigMap resourceVersion to check if ovn-vpc-nat-gw-co…
Browse files Browse the repository at this point in the history
…nfig changed (#1617)
  • Loading branch information
bobz965 authored Jun 18, 2022
1 parent c54cafa commit be66af4
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions pkg/controller/vpc_nat_gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"encoding/json"
"errors"
"fmt"
"reflect"
"strings"
"time"

Expand All @@ -26,10 +25,10 @@ import (
)

var (
vpcNatImage = ""
vpcNatEnabled = "unknown"
lastVpcNatCM map[string]string = nil
createAt = ""
vpcNatImage = ""
vpcNatEnabled = "unknown"
VpcNatCmVersion = ""
createAt = ""
)

const (
Expand Down Expand Up @@ -67,11 +66,11 @@ func (c *Controller) resyncVpcNatGwConfig() {
return
}
vpcNatEnabled = "false"
lastVpcNatCM = nil
VpcNatCmVersion = ""
klog.Info("finish clean up vpc nat gateway")
return
} else {
if vpcNatEnabled == "true" && lastVpcNatCM != nil && reflect.DeepEqual(cm.Data, lastVpcNatCM) {
if vpcNatEnabled == "true" && VpcNatCmVersion == cm.ResourceVersion {
return
}

Expand All @@ -88,7 +87,7 @@ func (c *Controller) resyncVpcNatGwConfig() {
}
vpcNatImage = cm.Data["image"]
vpcNatEnabled = "true"
lastVpcNatCM = cm.Data
VpcNatCmVersion = cm.ResourceVersion
for _, gw := range gws {
c.addOrUpdateVpcNatGatewayQueue.Add(gw.Name)
}
Expand Down

0 comments on commit be66af4

Please sign in to comment.