From 64e21cc42512be6d58b61163cbe08160b5b2ec82 Mon Sep 17 00:00:00 2001 From: Rick <1450685+LinuxSuRen@users.noreply.github.com> Date: Wed, 3 Nov 2021 13:53:10 +0800 Subject: [PATCH] Add a falg kubernetes version to kk install (#240) --- kubectl-plugin/install/kk.go | 4 +++- kubectl-plugin/types/constant.go | 6 ++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/kubectl-plugin/install/kk.go b/kubectl-plugin/install/kk.go index 073e36f..64ff3a4 100644 --- a/kubectl-plugin/install/kk.go +++ b/kubectl-plugin/install/kk.go @@ -36,6 +36,8 @@ ks install kk --version nightly --components devops`, flags := cmd.Flags() flags.StringVarP(&opt.version, "version", "v", types.KsVersion, fmt.Sprintf("The version of KubeSphere. Support value could be %s, nightly, nightly-20210309. nightly equals to nightly-latest", types.KsVersion)) + flags.StringVarP(&opt.version, "kubernetesVersion", "", types.K8sVersion, + "The version of Kubernetes") flags.StringArrayVarP(&opt.components, "components", "", []string{}, "The components which you want to enable after the installation") flags.StringVarP(&opt.zone, "zone", "", "cn", @@ -185,7 +187,7 @@ func (o *kkOption) runE(cmd *cobra.Command, args []string) (err error) { Env: []string{fmt.Sprintf("KKZONE=%s", o.zone)}, } if err = commander.execCommand("kk", "create", "cluster", "--filename", configFile, - "--with-kubesphere", o.version, "--yes"); err != nil { + "--with-kubesphere", o.version, "--with-kubernetes", o.kubernetesVersion, "--yes"); err != nil { return } diff --git a/kubectl-plugin/types/constant.go b/kubectl-plugin/types/constant.go index 851b220..e6cf922 100644 --- a/kubectl-plugin/types/constant.go +++ b/kubectl-plugin/types/constant.go @@ -1,6 +1,8 @@ package types const ( - // KsVersion is the latest release version - KsVersion = "v3.1.1" + // KsVersion is the default release version of KuberSphere + KsVersion = "v3.2.0" + // K8sVersion is the default version of the Kubernetes + K8sVersion = "v1.22.1" )