Skip to content

Commit

Permalink
remove kubernetes-version flag
Browse files Browse the repository at this point in the history
  • Loading branch information
kale-amruta committed Jan 17, 2025
1 parent fa4221c commit af7604e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 34 deletions.
34 changes: 3 additions & 31 deletions pkg/cli/create_helm.go
Original file line number Diff line number Diff line change
Expand Up @@ -710,37 +710,9 @@ func (cmd *createHelm) createNamespace(ctx context.Context) error {
}

func (cmd *createHelm) getKubernetesVersion() (*version.Info, error) {
var (
kubernetesVersion *version.Info
err error
)
if cmd.KubernetesVersion != "" {
if cmd.KubernetesVersion[0] != 'v' {
cmd.KubernetesVersion = "v" + cmd.KubernetesVersion
}

if !semver.IsValid(cmd.KubernetesVersion) {
return nil, fmt.Errorf("please use valid semantic versioning format, e.g. vX.X")
}

majorMinorVer := semver.MajorMinor(cmd.KubernetesVersion)

parsedVersion, err := config.ParseKubernetesVersionInfo(majorMinorVer)
if err != nil {
return nil, err
}

kubernetesVersion = &version.Info{
Major: parsedVersion.Major,
Minor: parsedVersion.Minor,
}
}

if kubernetesVersion == nil {
kubernetesVersion, err = cmd.kubeClient.ServerVersion()
if err != nil {
return nil, err
}
kubernetesVersion, err := cmd.kubeClient.ServerVersion()
if err != nil {
return nil, err
}

return kubernetesVersion, nil
Expand Down
3 changes: 0 additions & 3 deletions pkg/cli/flags/create/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ func AddCommonFlags(cmd *cobra.Command, options *cli.CreateOptions) {
cmd.Flags().StringVar(&options.ChartVersion, "chart-version", upgrade.GetVersion(), "The virtual cluster chart version to use (e.g. v0.9.1)")
cmd.Flags().StringVar(&options.ChartName, "chart-name", "vcluster", "The virtual cluster chart name to use")
cmd.Flags().StringVar(&options.ChartRepo, "chart-repo", constants.LoftChartRepo, "The virtual cluster chart repo to use")
cmd.Flags().StringVar(&options.KubernetesVersion, "kubernetes-version", "", "The kubernetes version to use (e.g. v1.20). Patch versions are not supported")
cmd.Flags().StringArrayVarP(&options.Values, "values", "f", []string{}, "Path where to load extra helm values from")
cmd.Flags().StringArrayVar(&options.SetValues, "set", []string{}, "Set values for helm. E.g. --set 'persistence.enabled=true'")
cmd.Flags().BoolVar(&options.Print, "print", false, "If enabled, prints the context to the console")
Expand All @@ -29,8 +28,6 @@ func AddCommonFlags(cmd *cobra.Command, options *cli.CreateOptions) {
_ = cmd.Flags().MarkDeprecated("distro", fmt.Sprintf("please specify the distro by setting %q accordingly via values.yaml file.", "controlPlane.distro"))
_ = cmd.Flags().MarkHidden("update-current")
_ = cmd.Flags().MarkDeprecated("update-current", fmt.Sprintf("please use %q.", "--connect"))
_ = cmd.Flags().MarkHidden("kubernetes-version")
_ = cmd.Flags().MarkDeprecated("kubernetes-version", fmt.Sprintf("please specify the kubernetes version by setting %q accordingly via values.yaml file.", "controlPlane.distro.k8s.version"))
}

func AddHelmFlags(cmd *cobra.Command, options *cli.CreateOptions) {
Expand Down

0 comments on commit af7604e

Please sign in to comment.