-
Notifications
You must be signed in to change notification settings - Fork 569
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: support k8s and kubesphere version without "v" #1396
feat: support k8s and kubesphere version without "v" #1396
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work, thanks for your contribution.
And please confirm whether the file of go.sum
needs to be modified
pkg/common/loader.go
Outdated
@@ -109,7 +109,11 @@ func (d *DefaultLoader) Load() (*kubekeyapiv1alpha2.Cluster, error) { | |||
Registry: {hostname}, | |||
} | |||
if d.KubernetesVersion != "" { | |||
s := strings.Split(d.KubernetesVersion, "-") | |||
ver := normalizedBuildVersion(d.KubernetesVersion) | |||
if len(ver) < 2 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use regex to check the version more better, like https://github.com/kubernetes/kubernetes/blob/89aaf7c02dd33415ac994cecfddca7c02ed75834/cmd/kubeadm/app/util/version.go#L153
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks your advice. :)
pkg/common/loader.go
Outdated
@@ -127,7 +131,11 @@ func (d *DefaultLoader) Load() (*kubekeyapiv1alpha2.Cluster, error) { | |||
} | |||
|
|||
if d.KubeSphereEnable { | |||
if err := defaultKSConfig(&allInOne.Spec.KubeSphere, d.KubeSphereVersion); err != nil { | |||
ver := normalizedBuildVersion(d.KubeSphereVersion) | |||
if len(ver) < 2 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above
Hi @zaunist , seems this place also need to process Lines 232 to 246 in 7c761db
|
/label tide/merge-method-squash |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good to me
/LGTM
@mangoGoForward: changing LGTM is restricted to collaborators In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
@pixiake PTAL. |
return nil, err | ||
} | ||
} | ||
|
||
if f.KubernetesVersion != "" { | ||
s := strings.Split(f.KubernetesVersion, "-") | ||
if ver := normalizedBuildVersion(f.KubernetesVersion); ver != "" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
f.KubernetesVersion
is generated by cmd's flag:
kubekey/cmd/ctl/create/cluster.go
Line 133 in 7c761db
cmd.Flags().StringVarP(&o.Kubernetes, "with-kubernetes", "", "", "Specify a supported version of kubernetes") |
So, I guess normalizing this variable may not work for the Kubernetes version only specified in the config file.
What do you think about normalizing clusterCfg.Spec.Kubernetes.Version
directly?
Hi @zaunist , thanks for your contributions! |
Good catch, thanks for your carefulness :) |
/lgtm |
LGTM label has been added. Git tree hash: c7143bbee50aca004ad747dc78210b9bcd75c64b
|
LGTM, the last thing, could you please squash your commits @zaunist ? The git history will look more clear. |
support kubenetes and kubesphere version without "v"
Thanks @zaunist /approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: 24sama, zaunist The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
@all-contributors please add @zaunist for code |
I've put up a pull request to add @zaunist! 🎉 |
@all-contributors please add @mangoGoForward for review |
I've put up a pull request to add @mangoGoForward! 🎉 |
What type of PR is this?
/kind feature
What this PR does / why we need it:
This makes kubekey more convenient to use and improves the user experience
Which issue(s) this PR fixes:
Fixes #1365
Special notes for reviewers:
Does this PR introduced a user-facing change?
Additional documentation, usage docs, etc.: