diff --git a/main.go b/main.go index 57aa86fca..dd6c544eb 100644 --- a/main.go +++ b/main.go @@ -36,6 +36,7 @@ import ( submarinerClientset "github.com/submariner-io/submariner/pkg/client/clientset/versioned" "github.com/submariner-io/submariner/pkg/gateway" "github.com/submariner-io/submariner/pkg/natdiscovery" + "github.com/submariner-io/submariner/pkg/node" "github.com/submariner-io/submariner/pkg/types" "github.com/submariner-io/submariner/pkg/versions" "golang.org/x/net/http/httpproxy" @@ -123,6 +124,14 @@ func main() { logger.FatalOnError(subv1.AddToScheme(scheme.Scheme), "Error adding submariner types to the scheme") + ctx := signals.SetupSignalHandler() + + if submSpec.WaitForNode { + node.WaitForLocalNodeReady(ctx, k8sClient) + + return + } + gw, err := gateway.New(&gateway.Config{ LeaderElectionConfig: gateway.LeaderElectionConfig{ LeaseDuration: time.Duration(gwLeadershipConfig.LeaseDuration) * time.Second, @@ -146,7 +155,7 @@ func main() { }) logger.FatalOnError(err, "Error creating gateway instance") - err = gw.Run(signals.SetupSignalHandler()) + err = gw.Run(ctx) logger.FatalOnError(err, "Error running the gateway") } diff --git a/pkg/types/types.go b/pkg/types/types.go index 6f5c8f3c9..4dbcf83a1 100644 --- a/pkg/types/types.go +++ b/pkg/types/types.go @@ -46,6 +46,7 @@ type SubmarinerSpecification struct { HealthCheckEnabled bool `default:"true"` Uninstall bool HaltOnCertError bool `split_words:"true"` + WaitForNode bool HealthCheckInterval int HealthCheckMaxPacketLossCount int MetricsPort int `default:"32780"`