diff --git a/cmd/vcluster/cmd/start.go b/cmd/vcluster/cmd/start.go index b55b3565e8..910e244ca0 100644 --- a/cmd/vcluster/cmd/start.go +++ b/cmd/vcluster/cmd/start.go @@ -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) @@ -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 { @@ -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) diff --git a/pkg/pro/platform.go b/pkg/pro/platform.go index 11407313ab..4674f3ee52 100644 --- a/pkg/pro/platform.go +++ b/pkg/pro/platform.go @@ -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 }