diff --git a/main.go b/main.go index eaec235..80bb9ff 100644 --- a/main.go +++ b/main.go @@ -20,6 +20,7 @@ import ( "flag" "fmt" "os" + "time" // Import all Kubernetes client auth plugins (e.g. Azure, GCP, OIDC, etc.) // to ensure that exec-entrypoint and run can make use of them. @@ -92,6 +93,7 @@ func main() { } go pkg.SpawnLoxiLB() + time.Sleep(10 * time.Second) if loxilbIngressIP == "127.0.0.1" { myIP, _ := pkg.GetLocalNonLoopBackIP() diff --git a/pkg/loxilb.go b/pkg/loxilb.go index f9fe557..f233147 100644 --- a/pkg/loxilb.go +++ b/pkg/loxilb.go @@ -17,8 +17,8 @@ package pkg import ( - "fmt" "k8s.io/klog/v2" + "os" "os/exec" "time" ) @@ -29,13 +29,12 @@ const ( func SpawnLoxiLB() { for { - - command := fmt.Sprintf("%s --proxyonlymode", LoxiLBImg) - cmd := exec.Command("bash", "-c", command) + cmd := exec.Command(LoxiLBImg, "--proxyonlymode") klog.Infof("Spawning loxilb: %s", cmd) err := cmd.Run() if err != nil { klog.Infof("Spawning loxilb failed: %s", err) + os.Exit(2) } time.Sleep(3000 * time.Millisecond) }