Merge pull request #2220 from my-git9/initversion

fix karmada init help crd version
This commit is contained in:
karmada-bot 2022-07-22 15:24:47 +08:00 committed by GitHub
commit eff23524d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 1 deletions

View File

@ -87,6 +87,11 @@ func NewCmdInit(parentCommand string) *cobra.Command {
}
func initExample(parentCommand string) string {
releaseVer, err := version.ParseGitVersion(version.Get().GitVersion)
if err != nil {
klog.Infof("No default release version found. build version: %s", version.Get().String())
releaseVer = &version.ReleaseVersion{}
}
example := `
# Install Karmada in Kubernetes cluster
# The karmada-apiserver binds the master node's IP by default` + "\n" +
@ -99,7 +104,7 @@ func initExample(parentCommand string) string {
fmt.Sprintf("%s init --kube-image-registry=registry.cn-hangzhou.aliyuncs.com/google_containers", parentCommand) + `
# Specify the URL to download CRD tarball` + "\n" +
fmt.Sprintf("%s init --crds https://github.com/karmada-io/karmada/releases/download/v1.1.0/crds.tar.gz", parentCommand) + `
fmt.Sprintf("%s init --crds https://github.com/karmada-io/karmada/releases/download/%s/crds.tar.gz", parentCommand, releaseVer.FirstMinorRelease()) + `
# Specify the local CRD tarball` + "\n" +
fmt.Sprintf("%s init --crds /root/crds.tar.gz", parentCommand) + `