LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File keepalived-delay.diff of Package kubernetes-keepalived (Project home:barclaac:hackweek)

diff --git a/keepalived-vip/keepalived.go b/keepalived-vip/keepalived.go
index f57dea93..bda6b0e5 100644
--- a/keepalived-vip/keepalived.go
+++ keepalived.go
@@ -23,6 +23,7 @@ import (
 	"os/exec"
 	"syscall"
 	"text/template"
+	"time"
 
 	"github.com/golang/glog"
 	k8sexec "k8s.io/kubernetes/pkg/util/exec"
@@ -114,12 +115,14 @@ func (k *keepalived) Start() {
 	k.cmd.Stdout = os.Stdout
 	k.cmd.Stderr = os.Stderr
 
-	k.started = true
-
 	if err := k.cmd.Start(); err != nil {
 		glog.Errorf("keepalived error: %v", err)
 	}
 
+	// Give keepalived enough time to install its SIGHUP handler before we send the signal
+	time.Sleep(1000 * time.Millisecond)
+	k.started = true
+
 	if err := k.cmd.Wait(); err != nil {
 		glog.Fatalf("keepalived error: %v", err)
 	}