Skip to content

Commit

Permalink
fix: revert distro changes
Browse files Browse the repository at this point in the history
  • Loading branch information
FabianKramm committed May 8, 2024
1 parent 8c17678 commit 4813df3
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -227,11 +227,10 @@ jobs:
sed -i "s|REPLACE_REPOSITORY_NAME|${{ env.REPOSITORY_NAME }}|g" test/commonValues.yaml
sed -i "s|REPLACE_TAG_NAME|${{ env.TAG_NAME }}|g" test/commonValues.yaml
./vcluster-dev/vcluster create vcluster \
./vcluster-dev/vcluster create vcluster --distro=${{ matrix.distribution }} \
--connect=false \
--upgrade \
--local-chart-dir ./chart \
--set="controlPlane.distro.${{ matrix.distribution }}.enabled=true" \
-f ./test/commonValues.yaml
sleep 20
Expand Down Expand Up @@ -363,7 +362,7 @@ jobs:
--create-namespace \
--debug \
--connect=false \
--set="controlPlane.distro.${{ matrix.distribution }}.enabled=true" \
--distro=${{ matrix.distribution }} \
--local-chart-dir ./chart \
-f ./test/commonValues.yaml \
$haValues \
Expand Down
6 changes: 6 additions & 0 deletions pkg/cli/create_helm.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import (
"github.com/loft-sh/vcluster/pkg/platform"
"github.com/loft-sh/vcluster/pkg/telemetry"
"github.com/loft-sh/vcluster/pkg/upgrade"
"github.com/loft-sh/vcluster/pkg/util"
"github.com/loft-sh/vcluster/pkg/util/cliconfig"
"github.com/loft-sh/vcluster/pkg/util/clihelper"
"github.com/loft-sh/vcluster/pkg/util/helmdownloader"
Expand Down Expand Up @@ -471,6 +472,10 @@ func (cmd *createHelm) deployChart(ctx context.Context, vClusterName, chartValue
}

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

// check if we should create with node port
clusterType := localkubernetes.DetectClusterType(&cmd.rawConfig)
if cmd.ExposeLocal && clusterType.LocalKubernetes() {
Expand All @@ -479,6 +484,7 @@ func (cmd *createHelm) ToChartOptions(kubernetesVersion *version.Info, log log.L
}

return &config.ExtraValuesOptions{
Distro: cmd.Distro,
Expose: cmd.Expose,
SyncNodes: cmd.localCluster,
NodePort: cmd.localCluster,
Expand Down
6 changes: 6 additions & 0 deletions pkg/cli/create_platform.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (
"github.com/loft-sh/vcluster/pkg/strvals"
"github.com/loft-sh/vcluster/pkg/telemetry"
"github.com/loft-sh/vcluster/pkg/upgrade"
"github.com/loft-sh/vcluster/pkg/util"
"github.com/loft-sh/vcluster/pkg/util/cliconfig"
"golang.org/x/mod/semver"
kerrors "k8s.io/apimachinery/pkg/api/errors"
Expand Down Expand Up @@ -589,6 +590,10 @@ func parseString(str string) (map[string]interface{}, error) {
}

func toChartOptions(platformClient platform.Client, options *CreateOptions, log log.Logger) (*vclusterconfig.ExtraValuesOptions, error) {
if !util.Contains(options.Distro, AllowedDistros) {
return nil, fmt.Errorf("unsupported distro %s, please select one of: %s", options.Distro, strings.Join(AllowedDistros, ", "))
}

kubernetesVersion := vclusterconfig.KubernetesVersion{}
if options.KubernetesVersion != "" {
if options.KubernetesVersion[0] != 'v' {
Expand Down Expand Up @@ -619,6 +624,7 @@ func toChartOptions(platformClient platform.Client, options *CreateOptions, log
}

return &vclusterconfig.ExtraValuesOptions{
Distro: options.Distro,
Expose: options.Expose,
KubernetesVersion: kubernetesVersion,
DisableTelemetry: cliconfig.GetConfig(log).TelemetryDisabled,
Expand Down

0 comments on commit 4813df3

Please sign in to comment.