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

feat: add vcluster create without templates #1230

Merged
merged 1 commit into from
Sep 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
354 changes: 343 additions & 11 deletions cmd/vclusterctl/cmd/app/create/pro.go

Large diffs are not rendered by default.

9 changes: 4 additions & 5 deletions cmd/vclusterctl/cmd/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ import (
)

var (
AllowedDistros = []string{"k3s", "k0s", "k8s", "eks"}
CreatedByVClusterAnnotation = "vcluster.loft.sh/created"
)

Expand Down Expand Up @@ -97,7 +96,7 @@ vcluster create test --namespace test
cobraCmd.Flags().StringVar(&cmd.ChartVersion, "chart-version", upgrade.GetVersion(), "The virtual cluster chart version to use (e.g. v0.9.1)")
cobraCmd.Flags().StringVar(&cmd.ChartName, "chart-name", "vcluster", "The virtual cluster chart name to use")
cobraCmd.Flags().StringVar(&cmd.ChartRepo, "chart-repo", create.LoftChartRepo, "The virtual cluster chart repo to use")
cobraCmd.Flags().StringVar(&cmd.Distro, "distro", "k3s", fmt.Sprintf("Kubernetes distro to use for the virtual cluster. Allowed distros: %s", strings.Join(AllowedDistros, ", ")))
cobraCmd.Flags().StringVar(&cmd.Distro, "distro", "k3s", fmt.Sprintf("Kubernetes distro to use for the virtual cluster. Allowed distros: %s", strings.Join(create.AllowedDistros, ", ")))
cobraCmd.Flags().StringVar(&cmd.KubernetesVersion, "kubernetes-version", "", "The kubernetes version to use (e.g. v1.20). Patch versions are not supported")
cobraCmd.Flags().StringArrayVarP(&cmd.Values, "values", "f", []string{}, "Path where to load extra helm values from")
cobraCmd.Flags().StringArrayVar(&cmd.SetValues, "set", []string{}, "Set values for helm. E.g. --set 'persistence.enabled=true'")
Expand Down Expand Up @@ -169,7 +168,7 @@ func (cmd *CreateCmd) Run(ctx context.Context, args []string) error {
proClient, err := pro.CreateProClient()
if err == nil {
// deploy pro cluster
err = create.DeployProCluster(ctx, &cmd.Options, proClient, args[0], cmd.log)
err = create.DeployProCluster(ctx, &cmd.Options, proClient, args[0], cmd.Namespace, cmd.log)
if err != nil {
return err
}
Expand Down Expand Up @@ -400,8 +399,8 @@ func (cmd *CreateCmd) deployChart(ctx context.Context, vClusterName, chartValues
}

func (cmd *CreateCmd) ToChartOptions(kubernetesVersion *version.Info) (*helmUtils.ChartOptions, error) {
if !util.Contains(cmd.Distro, AllowedDistros) {
return nil, fmt.Errorf("unsupported distro %s, please select one of: %s", cmd.Distro, strings.Join(AllowedDistros, ", "))
if !util.Contains(cmd.Distro, create.AllowedDistros) {
return nil, fmt.Errorf("unsupported distro %s, please select one of: %s", cmd.Distro, strings.Join(create.AllowedDistros, ", "))
}

if cmd.ChartName == "vcluster" && cmd.Distro != "k3s" {
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ require (
github.com/kubernetes-csi/external-snapshotter/client/v4 v4.2.0
github.com/loft-sh/agentapi/v3 v3.3.0-ci.1.0.20230921083523-e1d74f6f8fd1
github.com/loft-sh/api/v3 v3.0.0-20230922094800-6d0c1cbf0fa6
github.com/loft-sh/loftctl/v3 v3.0.0-20230922112452-20febcea05a7
github.com/loft-sh/utils v0.0.25
github.com/loft-sh/loftctl/v3 v3.0.0-20230922135015-e6ba659111d7
github.com/loft-sh/utils v0.0.28-0.20230922120533-1b39f079a09e
github.com/mitchellh/go-homedir v1.1.0
github.com/moby/term v0.5.0
github.com/onsi/ginkgo/v2 v2.11.0
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -558,12 +558,12 @@ github.com/loft-sh/external-types v0.0.2-0.20230301201552-ec939da949b4 h1:eSuBR+
github.com/loft-sh/external-types v0.0.2-0.20230301201552-ec939da949b4/go.mod h1:qnerIOkD67CmTkV8HsXQit6BfB7Qiw45bSUy1oefIXU=
github.com/loft-sh/jspolicy v0.1.0 h1:FNAWR6tRX5NRWxAf9RI/86NRH83NXYbobLHSZyMND74=
github.com/loft-sh/jspolicy v0.1.0/go.mod h1:4Zi38iEB0JvhnkrNHPpoueSUWQ1OlHMNB9JHTGEsPO0=
github.com/loft-sh/loftctl/v3 v3.0.0-20230922112452-20febcea05a7 h1:lsBF4llFeHcDvYj2TCFVNsdYAPemIXXg7v0w2A6txPw=
github.com/loft-sh/loftctl/v3 v3.0.0-20230922112452-20febcea05a7/go.mod h1:g2HZHmpkqtiQGqM8QVRuaCgNDI6IMW6DZQP0cOUgxp8=
github.com/loft-sh/loftctl/v3 v3.0.0-20230922135015-e6ba659111d7 h1:RVzm0PIWQywUkJjwsCa24xt6olUQ7x3LFvlhXrWebEc=
github.com/loft-sh/loftctl/v3 v3.0.0-20230922135015-e6ba659111d7/go.mod h1:x8PaBRZbUVL1s32iM8cdei1z4kAJ5YTtn0A8jrRlgls=
github.com/loft-sh/log v0.0.0-20230824104949-bd516c25712a h1:/gqqjKpcHEdFXIX41lx1Y/FBqT/72gbPpf7sa20tyM8=
github.com/loft-sh/log v0.0.0-20230824104949-bd516c25712a/go.mod h1:YImeRjXH34Yf5E79T7UHBQpDZl9fIaaFRgyZ/bkY+UQ=
github.com/loft-sh/utils v0.0.25 h1:JbbRJfXO1Rd34fQcaoDSmwyPBEzsrLwBSR21C90hHuk=
github.com/loft-sh/utils v0.0.25/go.mod h1:9hlX9cGpWHg3mNi/oBlv3X4ePGDMK66k8MbOZGFMDTI=
github.com/loft-sh/utils v0.0.28-0.20230922120533-1b39f079a09e h1:oruuACHMZGg6wn3fASWd1pmpuj7CrRjyYG8dPDfrcdw=
github.com/loft-sh/utils v0.0.28-0.20230922120533-1b39f079a09e/go.mod h1:9hlX9cGpWHg3mNi/oBlv3X4ePGDMK66k8MbOZGFMDTI=
github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
github.com/mailru/easyjson v0.0.0-20160728113105-d5b7844b561a/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
github.com/mailru/easyjson v0.0.0-20180823135443-60711f1a8329/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
Expand Down
2 changes: 1 addition & 1 deletion pkg/pro/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
)

var (
MinimumVersionTag = "v3.3.0-alpha.24"
MinimumVersionTag = "v3.3.0-alpha.25"
MinimumVersion = semver.MustParse(strings.TrimPrefix(MinimumVersionTag, "v"))
)

Expand Down