Skip to content

Commit 9b6bf95

Browse files
authored
limit disableSrcDstCheck performed on OnNodeUpdate() (#327)
1 parent d72c410 commit 9b6bf95

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

app/controllers/network_routes_controller.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ type NetworkRoutingController struct {
6969
bgpRRServer bool
7070
bgpClusterId uint32
7171
cniConfFile string
72+
initSrcDstCheckDone bool
7273
}
7374

7475
var (
@@ -117,6 +118,7 @@ func (nrc *NetworkRoutingController) Run(healthChan chan<- *ControllerHeartbeat,
117118

118119
// In case of cluster provisioned on AWS disable source-destination check
119120
nrc.disableSourceDestinationCheck()
121+
nrc.initSrcDstCheckDone = true
120122

121123
// enable IP forwarding for the packets coming in/out from the pods
122124
err = nrc.enableForwarding()
@@ -1338,7 +1340,12 @@ func (nrc *NetworkRoutingController) OnNodeUpdate(nodeUpdate *watchers.NodeUpdat
13381340
if nrc.bgpEnableInternal {
13391341
nrc.syncInternalPeers()
13401342
}
1341-
nrc.disableSourceDestinationCheck()
1343+
1344+
// skip if first round of disableSourceDestinationCheck() is not done yet, this is to prevent
1345+
// all the nodes for all the node add update trying to perfrom disableSourceDestinationCheck
1346+
if nrc.initSrcDstCheckDone {
1347+
nrc.disableSourceDestinationCheck()
1348+
}
13421349
}
13431350

13441351
func (nrc *NetworkRoutingController) startBgpServer() error {
@@ -1563,6 +1570,7 @@ func NewNetworkRoutingController(clientset *kubernetes.Clientset,
15631570
nrc.bgpRRClient = false
15641571
nrc.bgpRRServer = false
15651572
nrc.bgpServerStarted = false
1573+
nrc.initSrcDstCheckDone = false
15661574

15671575
nrc.cniConfFile = os.Getenv("KUBE_ROUTER_CNI_CONF_FILE")
15681576
if nrc.cniConfFile == "" {

0 commit comments

Comments
 (0)