Skip to content

Commit

Permalink
Fix the dep tools download URL is invalid (#162)
Browse files Browse the repository at this point in the history
the URL is invalid due to the OS and arch is missing
  • Loading branch information
LinuxSuRen committed Aug 19, 2021
1 parent 7f60db8 commit 9ce08e1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions kubectl-plugin/install/installer.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ type installerOption struct {
version string
nightly string
components []string
fetch bool

// inner fields
client dynamic.Interface
Expand Down
10 changes: 8 additions & 2 deletions kubectl-plugin/install/k3d.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"github.com/linuxsuren/http-downloader/pkg/installer"
"github.com/linuxsuren/ks/kubectl-plugin/common"
"github.com/spf13/cobra"
"runtime"
)

func newInstallK3DCmd() (cmd *cobra.Command) {
Expand All @@ -26,6 +27,8 @@ You can get more details from https://github.com/rancher/k3d/`,
"Specify how many agents you want to create")
flags.IntVarP(&opt.servers, "servers", "", 1,
"Specify how many servers you want to create")
flags.StringVarP(&opt.image, "image", "", "rancher/k3s:v1.18.20-k3s1",
"The image of k3s, get more images from https://hub.docker.com/r/rancher/k3s/tags")

// TODO find a better way to reuse the flags from another command
flags.StringVarP(&opt.version, "version", "", "v3.0.0",
Expand All @@ -34,8 +37,8 @@ You can get more details from https://github.com/rancher/k3d/`,
"The nightly version you want to install")
flags.StringArrayVarP(&opt.components, "components", "", []string{},
"The components that you want to Enabled with KubeSphere")
flags.StringVarP(&opt.image, "image", "", "rancher/k3s:v1.18.20-k3s1",
"The image of k3s, get more images from https://hub.docker.com/r/rancher/k3s/tags")
flags.BoolVarP(&opt.fetch, "fetch", "", true,
"Indicate if fetch the latest config of tools")
return
}

Expand All @@ -55,6 +58,9 @@ func (o *k3dOption) preRunE(cmd *cobra.Command, args []string) (err error) {

is := installer.Installer{
Provider: "github",
OS: runtime.GOOS,
Arch: runtime.GOARCH,
Fetch: o.fetch,
}
err = is.CheckDepAndInstall(map[string]string{
"k3d": "rancher/k3d",
Expand Down

0 comments on commit 9ce08e1

Please sign in to comment.