Skip to content

Commit

Permalink
Use WaitForLocalNodeReady in gateway main
Browse files Browse the repository at this point in the history
Signed-off-by: Tom Pantelis <tompantelis@gmail.com>
  • Loading branch information
tpantelis committed Nov 21, 2024
1 parent 34d82d3 commit 27cd304
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
11 changes: 10 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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,
Expand All @@ -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")
}
1 change: 1 addition & 0 deletions pkg/types/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
Expand Down

0 comments on commit 27cd304

Please sign in to comment.