-
Notifications
You must be signed in to change notification settings - Fork 875
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
karmadactl
: Fixed init
commands can not select default release version issue.
#1456
karmadactl
: Fixed init
commands can not select default release version issue.
#1456
Conversation
@prodanlabs: GitHub didn't allow me to request PR reviews from the following users: zach593. Note that only karmada-io members and repo collaborators can review this PR, and authors cannot review their own PRs. 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. |
2894640
to
3eed758
Compare
So quick!!! Thanks @prodanlabs I'll look at it tomorrow. Looks good after a quick look. |
pkg/karmadactl/cmdinit/utils/util.go
Outdated
func GetInitVersion(version string) InitVersion { | ||
// CRD version e.g. v0.10.1-547-g0190fda9-dirty -> v0.10.0 | ||
n := strings.LastIndex(version, ".") + 1 | ||
|
||
return InitVersion{ | ||
ImageVersion: initImageVersion(version), | ||
CRDVersion: fmt.Sprintf("%s%s", string([]byte(version)[:n]), "0"), | ||
} | ||
} |
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.
I guess there will be some tools/packages to handle the git version thing. I'll try to investigate it.
pkg/karmadactl/cmdinit/cmdinit.go
Outdated
flags.StringVar(&opts.CRDs, "crds", crdURL, "Karmada crds resource.(local file e.g. --crds /root/crds.tar.gz)") | ||
flags.Int32VarP(&opts.KarmadaAPIServerNodePort, "port", "p", 32443, "Karmada apiserver service node port") | ||
flags.StringVarP(&opts.KarmadaDataPath, "karmada-data", "d", "/etc/karmada", "karmada data path. kubeconfig cert and crds files") | ||
flags.StringVarP(&opts.KarmadaAPIServerImage, "karmada-apiserver-image", "", "k8s.gcr.io/kube-apiserver:v1.21.7", "Kubernetes apiserver image") | ||
flags.Int32VarP(&opts.KarmadaAPIServerReplicas, "karmada-apiserver-replicas", "", 1, "karmada apiserver replica set") | ||
flags.StringVarP(&opts.KarmadaSchedulerImage, "karmada-scheduler-image", "", "swr.ap-southeast-1.myhuaweicloud.com/karmada/karmada-scheduler:latest", "karmada scheduler image") | ||
flags.StringVarP(&opts.KarmadaSchedulerImage, "karmada-scheduler-image", "", fmt.Sprintf("swr.ap-southeast-1.myhuaweicloud.com/karmada/karmada-scheduler:latest:%s", v.ImageVersion), "karmada scheduler image") |
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.
:latest:%s
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.
oh my fault.
@@ -24,3 +25,11 @@ func TestDownloadFile(t *testing.T) { | |||
panic(err) | |||
} | |||
} | |||
|
|||
// TestGetInitVersion test GetInitVersion | |||
func TestGetInitVersion(t *testing.T) { |
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.
make it failable, so it could be useful in CI
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.
make it failable, so it could be useful in CI
The version number is passed in when compiling, I feel like I can't do anything in go test.
https://github.com/karmada-io/karmada/blob/master/Makefile#L15
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.
GetInitVersion()
get "GitVersion" from param, at least we could still check that the shift logic is correct or not
Signed-off-by: prodan <pengshihaoren@gmail.com>
3eed758
to
66c5f27
Compare
and builds by makefile from master branch will refer to latest release version (with best effort) |
Signed-off-by: RainbowMango <qdurenhongcai@gmail.com>
Hi @prodanlabs I appended a commit on yours, cloud you please help to confirm? |
Cool! |
/retitle |
karmadactl
: Fixed init
commands can not select default release version issue.
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.
/lgtm
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.
/approve
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: RainbowMango 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 |
Signed-off-by: prodan pengshihaoren@gmail.com
What type of PR is this?
/kind bug
What this PR does / why we need it:
The images and crd versions of
karmadactl init
are consistent with thekarmadactl
versionWhich issue(s) this PR fixes:
Fixes #1340
Special notes for your reviewer:
kubectl-karmada version is
v0.10.1-547-g0190fda9-dirty
crd and images version by default
Does this PR introduce a user-facing change?:
/cc @RainbowMango
@zach593