Skip to content

Commit

Permalink
adjust license pro functions to the changes made in the vcluster-pro …
Browse files Browse the repository at this point in the history
…refactor

Signed-off-by: Paweł Bojanowski <[email protected]>
  • Loading branch information
hidalgopl committed Dec 6, 2024
1 parent b611b0f commit 0eb47ff
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 33 deletions.
22 changes: 7 additions & 15 deletions cmd/vcluster/cmd/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,34 +81,26 @@ func ExecuteStart(ctx context.Context, options *StartOptions) error {
}()

// initialize feature gate from environment
err = pro.LicenseInit(ctx, vConfig)
if err != nil {
return fmt.Errorf("init license: %w", err)
}

// set features for plugins to recognize
plugin.DefaultManager.SetProFeatures(pro.LicenseFeatures())

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

err = setup.Initialize(ctx, vConfig)
if err != nil {
return fmt.Errorf("initialize: %w", err)
}

// set features for plugins to recognize
plugin.DefaultManager.SetProFeatures(pro.LicenseFeatures())

// build controller context
controllerCtx, err := setup.NewControllerContext(ctx, vConfig)
if err != nil {
return fmt.Errorf("create controller context: %w", err)
}

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

// start integrations
Expand Down
14 changes: 8 additions & 6 deletions pkg/pro/license.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@ import (
"context"

"github.com/loft-sh/vcluster/pkg/config"
"github.com/loft-sh/vcluster/pkg/syncer/synccontext"
)

// LicenseInit is used to initialize the license reader
var LicenseInit = func(_ context.Context, _ *config.VirtualClusterConfig) error {
// LicenseInit is used to initialize the license loader
var LicenseInit = func(_ context.Context, _ *config.VirtualClusterConfig) {}

// LicenseStart is used to start license loader
var LicenseStart = func(_ *synccontext.ControllerContext) error {
return nil
}

// LicenseFeatures is used to retrieve all enabled features
var LicenseFeatures = func() map[string]bool {
return make(map[string]bool)
}
// LicenseFeatures returns a map of featureName: enabled / disabled
var LicenseFeatures func() map[string]bool
12 changes: 0 additions & 12 deletions pkg/pro/platform.go

This file was deleted.

0 comments on commit 0eb47ff

Please sign in to comment.