Skip to content

Commit c160e90

Browse files
nerzhulmurali-reddy
authored andcommitted
[FIX] Don't ignore silently service proxy errors. (cloudnativelabs#796)
Currently we can have error on service proxy if we cannot set sysctl (in my case), but those errors are return and not shown. Just show them, like other controllers
1 parent 8bcd166 commit c160e90

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

pkg/controllers/proxy/network_services_controller.go

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ type endpointsInfo struct {
276276
type endpointsInfoMap map[string][]endpointsInfo
277277

278278
// Run periodically sync ipvs configuration to reflect desired state of services and endpoints
279-
func (nsc *NetworkServicesController) Run(healthChan chan<- *healthcheck.ControllerHeartbeat, stopCh <-chan struct{}, wg *sync.WaitGroup) error {
279+
func (nsc *NetworkServicesController) Run(healthChan chan<- *healthcheck.ControllerHeartbeat, stopCh <-chan struct{}, wg *sync.WaitGroup) {
280280
t := time.NewTicker(nsc.syncPeriod)
281281
defer t.Stop()
282282
defer wg.Done()
@@ -287,25 +287,25 @@ func (nsc *NetworkServicesController) Run(healthChan chan<- *healthcheck.Control
287287
err := ensureMasqueradeIptablesRule(nsc.masqueradeAll, nsc.podCidr)
288288
// enable masquerade rule
289289
if err != nil {
290-
return errors.New("Failed to do add masquerade rule in POSTROUTING chain of nat table due to: %s" + err.Error())
290+
glog.Errorf("Failed to do add masquerade rule in POSTROUTING chain of nat table due to: %s", err.Error())
291291
}
292292
// https://www.kernel.org/doc/Documentation/networking/ipvs-sysctl.txt
293293
// enable ipvs connection tracking
294294
sysctlErr := utils.SetSysctl("net/ipv4/vs/conntrack", 1)
295295
if sysctlErr != nil {
296-
return errors.New(sysctlErr.Error())
296+
glog.Error(sysctlErr.Error())
297297
}
298298

299299
// LVS failover not working with UDP packets https://access.redhat.com/solutions/58653
300300
sysctlErr = utils.SetSysctl("net/ipv4/vs/expire_nodest_conn", 1)
301301
if sysctlErr != nil {
302-
return errors.New(sysctlErr.Error())
302+
glog.Error(sysctlErr.Error())
303303
}
304304

305305
// LVS failover not working with UDP packets https://access.redhat.com/solutions/58653
306306
sysctlErr = utils.SetSysctl("net/ipv4/vs/expire_quiescent_template", 1)
307307
if sysctlErr != nil {
308-
return errors.New(sysctlErr.Error())
308+
glog.Error(sysctlErr.Error())
309309
}
310310

311311
// https://github.com/kubernetes/kubernetes/pull/71114
@@ -314,27 +314,28 @@ func (nsc *NetworkServicesController) Run(healthChan chan<- *healthcheck.Control
314314
// Check if the error is fatal, on older kernels this option does not exist and the same behaviour is default
315315
// if option is not found just log it
316316
if sysctlErr.IsFatal() {
317-
return errors.New(sysctlErr.Error())
317+
glog.Fatal(sysctlErr.Error())
318+
} else {
319+
glog.Info(sysctlErr.Error())
318320
}
319-
glog.Info(sysctlErr.Error())
320321
}
321322

322323
// https://github.com/kubernetes/kubernetes/pull/70530/files
323324
sysctlErr = utils.SetSysctl("net/ipv4/conf/all/arp_ignore", 1)
324325
if sysctlErr != nil {
325-
return errors.New(sysctlErr.Error())
326+
glog.Error(sysctlErr.Error())
326327
}
327328

328329
// https://github.com/kubernetes/kubernetes/pull/70530/files
329330
sysctlErr = utils.SetSysctl("net/ipv4/conf/all/arp_announce", 2)
330331
if sysctlErr != nil {
331-
return errors.New(sysctlErr.Error())
332+
glog.Error(sysctlErr.Error())
332333
}
333334

334335
// https://github.com/cloudnativelabs/kube-router/issues/282
335336
err = nsc.setupIpvsFirewall()
336337
if err != nil {
337-
return errors.New("Error setting up ipvs firewall: " + err.Error())
338+
glog.Error("Error setting up ipvs firewall: " + err.Error())
338339
}
339340

340341
gracefulTicker := time.NewTicker(5 * time.Second)
@@ -343,7 +344,7 @@ func (nsc *NetworkServicesController) Run(healthChan chan<- *healthcheck.Control
343344
select {
344345
case <-stopCh:
345346
glog.Info("Shutting down network services controller")
346-
return nil
347+
return
347348
default:
348349
err := nsc.doSync()
349350
if err != nil {
@@ -357,7 +358,7 @@ func (nsc *NetworkServicesController) Run(healthChan chan<- *healthcheck.Control
357358
select {
358359
case <-stopCh:
359360
glog.Info("Shutting down network services controller")
360-
return nil
361+
return
361362

362363
case <-gracefulTicker.C:
363364
if nsc.readyForUpdates && nsc.gracefulTermination {

0 commit comments

Comments
 (0)