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 87393cd commit e69118d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
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")
}
2 changes: 0 additions & 2 deletions pkg/routeagent_driver/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import (
"io/fs"
"os"
"strconv"
"time"

"github.com/kelseyhightower/envconfig"
"github.com/pkg/errors"
Expand All @@ -49,7 +48,6 @@ import (
"github.com/submariner-io/submariner/pkg/routeagent_driver/handlers/mtu"
"github.com/submariner-io/submariner/pkg/routeagent_driver/handlers/ovn"
"github.com/submariner-io/submariner/pkg/versions"
corev1 "k8s.io/api/core/v1"
"k8s.io/client-go/dynamic"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/kubernetes/scheme"
Expand Down
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 uint
HealthCheckMaxPacketLossCount uint
MetricsPort int `default:"32780"`
Expand Down

0 comments on commit e69118d

Please sign in to comment.