Skip to content

Commit

Permalink
Add k3sup tool in arkade get
Browse files Browse the repository at this point in the history
Signed-off-by: Tuan Anh Tran <me@tuananh.org>
  • Loading branch information
tuananh authored and alexellis committed Jul 24, 2020
1 parent 3c3970e commit 5c46d64
Show file tree
Hide file tree
Showing 4 changed files with 74 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ arkade get faas-cli
arkade get helm
arkade get inletsctl
arkade get k3d
arkade get k3sup
arkade get kind
arkade get kubectl
arkade get kubectx
Expand Down
1 change: 1 addition & 0 deletions cmd/get.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ const arkadeGet = `Use "arkade get TOOL" to download a tool or application:
- helm
- inletsctl
- k3d
- k3sup
- kind
- kubectl
- kubectx
Expand Down
52 changes: 52 additions & 0 deletions pkg/get/get_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,58 @@ func Test_DownloadK3d(t *testing.T) {
}
}

func Test_DownloadK3sup(t *testing.T) {
tools := MakeTools()
name := "k3sup"

var tool *Tool
for _, target := range tools {
if name == target.Name {
tool = &target
break
}
}

type test struct {
os string
arch string
version string
url string
}

tests := []test{
{os: "mingw64_nt-10.0-18362",
arch: arch64bit,
version: "0.9.2",
url: "https://github.com/alexellis/k3sup/releases/download/0.9.2/k3sup.exe"},
{os: "linux",
arch: arch64bit,
version: "0.9.2",
url: "https://github.com/alexellis/k3sup/releases/download/0.9.2/k3sup"},
{os: "darwin",
arch: arch64bit,
version: "0.9.2",
url: "https://github.com/alexellis/k3sup/releases/download/0.9.2/k3sup-darwin"},
{os: "linux",
arch: "armv7l",
version: "0.9.2",
url: "https://github.com/alexellis/k3sup/releases/download/0.9.2/k3sup-armhf"},
{os: "linux",
arch: "aarch64",
version: "0.9.2",
url: "https://github.com/alexellis/k3sup/releases/download/0.9.2/k3sup-arm64"},
}
for _, tc := range tests {
got, err := tool.GetURL(tc.os, tc.arch, tc.version)
if err != nil {
t.Fatal(err)
}
if got != tc.url {
t.Fatalf("want: %s, got: %s", tc.url, got)
}
}
}

func Test_DownloadInletsctl(t *testing.T) {
tools := MakeTools()
name := "inletsctl"
Expand Down
20 changes: 20 additions & 0 deletions pkg/get/tools.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,26 @@ https://storage.googleapis.com/kubernetes-release/release/{{.Version}}/bin/{{$os
{{- end -}}`,
})

tools = append(tools,
Tool{
Owner: "alexellis",
Repo: "k3sup",
Name: "k3sup",
BinaryTemplate: `{{ if HasPrefix .OS "ming" -}}
{{.Name}}.exe
{{- else if eq .OS "darwin" -}}
{{.Name}}-darwin
{{- else if eq .Arch "armv6l" -}}
{{.Name}}-armhf
{{- else if eq .Arch "armv7l" -}}
{{.Name}}-armhf
{{- else if eq .Arch "aarch64" -}}
{{.Name}}-arm64
{{- else -}}
{{.Name}}
{{- end -}}`,
})

tools = append(tools,
Tool{
Owner: "bitnami-labs",
Expand Down

0 comments on commit 5c46d64

Please sign in to comment.