Skip to content

Commit 34270e4

Browse files
bazuchanmurali-reddy
authored andcommitted
Periodicaly sync iptables MASQUERADE rules (#619)
1 parent c63e71a commit 34270e4

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

pkg/controllers/proxy/network_services_controller.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,12 @@ func (nsc *NetworkServicesController) sync() error {
350350
nsc.mu.Lock()
351351
defer nsc.mu.Unlock()
352352

353+
// enable masquerad rule
354+
err = ensureMasqueradeIptablesRule(nsc.masqueradeAll, nsc.podCidr)
355+
if err != nil {
356+
glog.Errorf("Failed to do add masquerad rule in POSTROUTING chain of nat table due to: %s", err.Error())
357+
}
358+
353359
nsc.serviceMap = nsc.buildServicesInfo()
354360
nsc.endpointsMap = nsc.buildEndpointsInfo()
355361
err = nsc.syncHairpinIptablesRules()
@@ -1287,7 +1293,7 @@ func ensureMasqueradeIptablesRule(masqueradeAll bool, podCidr string) error {
12871293
return errors.New("Failed to run iptables command" + err.Error())
12881294
}
12891295
}
1290-
glog.V(1).Info("Successfully added iptables masquerad rule")
1296+
glog.V(2).Info("Successfully synced iptables masquerad rule")
12911297
return nil
12921298
}
12931299

0 commit comments

Comments
 (0)