Skip to content

Commit

Permalink
Merge pull request #2029 from rmweir/external-db-shared
Browse files Browse the repository at this point in the history
Connect to vCluster Platform earlier
  • Loading branch information
FabianKramm authored Sep 4, 2024
2 parents c9688ca + bdf6379 commit 00bd813
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
17 changes: 11 additions & 6 deletions cmd/vcluster/cmd/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,12 @@ func ExecuteStart(ctx context.Context, options *StartOptions) error {
// set features for plugins to recognize
plugin.DefaultManager.SetProFeatures(pro.LicenseFeatures())

// check if we should create certs
// connect to vCluster platform if configured
startPlatformServersAndControllers, err := pro.ConnectToPlatform(ctx, vConfig)
if err != nil {
return fmt.Errorf("connect to platform: %w", err)
}

err = setup.Initialize(ctx, vConfig)
if err != nil {
return fmt.Errorf("initialize: %w", err)
Expand All @@ -101,6 +106,11 @@ func ExecuteStart(ctx context.Context, options *StartOptions) error {
return fmt.Errorf("create controller context: %w", err)
}

err = startPlatformServersAndControllers(controllerCtx.VirtualManager)
if err != nil {
return fmt.Errorf("start platform controllers: %w", err)
}

// start integrations
err = integrations.StartIntegrations(controllerCtx)
if err != nil {
Expand Down Expand Up @@ -134,11 +144,6 @@ func ExecuteStart(ctx context.Context, options *StartOptions) error {
}
}

// connect to vCluster platform if configured
if err := pro.ConnectToPlatform(ctx, vConfig, controllerCtx.VirtualManager); err != nil {
return fmt.Errorf("connect to platform: %w", err)
}

// start leader election + controllers
err = StartLeaderElection(controllerCtx, func() error {
return setup.StartControllers(controllerCtx, syncers)
Expand Down
4 changes: 2 additions & 2 deletions pkg/pro/platform.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ import (
"sigs.k8s.io/controller-runtime/pkg/manager"
)

var ConnectToPlatform = func(context.Context, *config.VirtualClusterConfig, manager.Manager) error {
return nil
var ConnectToPlatform = func(context.Context, *config.VirtualClusterConfig) (func(mgr manager.Manager) error, error) {
return func(_ manager.Manager) error { return nil }, nil
}

0 comments on commit 00bd813

Please sign in to comment.