Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Helm installation for vcluster #1

Open
yorugac opened this issue Jun 5, 2024 · 0 comments
Open

Helm installation for vcluster #1

yorugac opened this issue Jun 5, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@yorugac
Copy link
Collaborator

yorugac commented Jun 5, 2024

Currently vcluster is invoked with a simple os/exec which adds a requirement to have vcluster binary already installed in the system. Since another way to create a virtual cluster is with Helm chart, it'd be good to switch to that and remove dependency on the binary.

After looking into this possibility, it appears that there is a CreateHelm Golang function that can be used directly for creation, for example:

import (
	"context"

	"github.com/loft-sh/log"
	"github.com/loft-sh/vcluster/pkg/cli"
	"github.com/loft-sh/vcluster/pkg/cli/flags"
)

func create(ctx context.Context, name string) error {
	opts := &cli.CreateOptions{
		KubeConfigContextName: name,
	}
	flags := flags.GlobalFlags{
		Context:   "..",
		Namespace: "..",
	}
	log := log.New() // or smth smarter

	return cli.CreateHelm(ctx, opts, flags, name, log)
}

Similarly, DeleteHelm function can be used for deletion.

Caveat: creating namespace might be a requirement with this method. Needs to be checked.

Apparently, under the hood, both of those functions are also relying on os/exec of Helm binary though with added bonus of implemented downloader: likely when Helm installation is absent, vcluster is downloading its binary to /tmp.

These should be sufficient for xk6-environment at this point. However, as of now, these functions are absent in latest stable version so it makes sense to wait a bit for the next release before adding them.

@yorugac yorugac added the enhancement New feature or request label Jun 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant