mirror of
https://github.com/cloudnativelabs/kube-router.git
synced 2025-10-23 15:51:26 +02:00
Send heartbeats during NetworkPolicy and NetworkService sync. (#741)
In reference to issue #725, we modified kube-router to send heartbeats before starting policy sync to prevent missing heartbeats while running iptables commands. Signed-off-by: Jérôme Poulin <jeromepoulin@gmail.com>
This commit is contained in:
parent
6470795db3
commit
94fd7b6d74
@ -58,6 +58,7 @@ type NetworkPolicyController struct {
|
||||
MetricsEnabled bool
|
||||
v1NetworkPolicy bool
|
||||
readyForUpdates bool
|
||||
healthChan chan<- *healthcheck.ControllerHeartbeat
|
||||
|
||||
// list of all active network policies expressed as networkPolicyInfo
|
||||
networkPoliciesInfo *[]networkPolicyInfo
|
||||
@ -140,6 +141,7 @@ func (npc *NetworkPolicyController) Run(healthChan chan<- *healthcheck.Controlle
|
||||
defer wg.Done()
|
||||
|
||||
glog.Info("Starting network policy controller")
|
||||
npc.healthChan = healthChan
|
||||
|
||||
// loop forever till notified to stop on stopCh
|
||||
for {
|
||||
@ -222,6 +224,7 @@ func (npc *NetworkPolicyController) Sync() error {
|
||||
npc.mu.Lock()
|
||||
defer npc.mu.Unlock()
|
||||
|
||||
healthcheck.SendHeartBeat(npc.healthChan, "NPC")
|
||||
start := time.Now()
|
||||
syncVersion := strconv.FormatInt(start.UnixNano(), 10)
|
||||
defer func() {
|
||||
|
@ -384,6 +384,7 @@ func (nsc *NetworkServicesController) Run(healthChan chan<- *healthcheck.Control
|
||||
|
||||
case <-t.C:
|
||||
glog.V(1).Info("Performing periodic sync of ipvs services")
|
||||
healthcheck.SendHeartBeat(healthChan, "NSC")
|
||||
err := nsc.doSync()
|
||||
if err != nil {
|
||||
glog.Errorf("Error during periodic ipvs sync in network service controller. Error: " + err.Error())
|
||||
|
Loading…
x
Reference in New Issue
Block a user