diff --git a/pkg/get/get_test.go b/pkg/get/get_test.go index b03098d48..c67a56145 100644 --- a/pkg/get/get_test.go +++ b/pkg/get/get_test.go @@ -7722,3 +7722,59 @@ func Test_DownloadKeploy(t *testing.T) { } } + +func Test_Download_k0sctl(t *testing.T) { + tools := MakeTools() + name := "k0sctl" + const toolVersion = "v0.19.0" + + tool := getTool(name, tools) + + tests := []test{ + { + os: "mingw64_nt-10.0-18362", + arch: arch64bit, + version: toolVersion, + url: "https://github.com/k0sproject/k0sctl/releases/download/v0.19.0/k0sctl-win-amd64.exe", + }, + { + os: "darwin", + arch: arch64bit, + version: toolVersion, + url: "https://github.com/k0sproject/k0sctl/releases/download/v0.19.0/k0sctl-darwin-amd64", + }, + { + os: "darwin", + arch: archDarwinARM64, + version: toolVersion, + url: "https://github.com/k0sproject/k0sctl/releases/download/v0.19.0/k0sctl-darwin-arm64", + }, + { + os: "linux", + arch: arch64bit, + version: toolVersion, + url: "https://github.com/k0sproject/k0sctl/releases/download/v0.19.0/k0sctl-linux-amd64", + }, + { + os: "linux", + arch: "armv7l", + version: toolVersion, + url: "https://github.com/k0sproject/k0sctl/releases/download/v0.19.0/k0sctl-linux-arm", + }, + { + os: "linux", + arch: archARM64, + version: toolVersion, + url: "https://github.com/k0sproject/k0sctl/releases/download/v0.19.0/k0sctl-linux-arm64", + }, + } + for _, tc := range tests { + got, err := tool.GetURL(tc.os, tc.arch, tc.version, false) + if err != nil { + t.Fatal(err) + } + if got != tc.url { + t.Fatalf("\nwant: %s\ngot: %s", tc.url, got) + } + } +} diff --git a/pkg/get/tools.go b/pkg/get/tools.go index df8b98121..989d22516 100644 --- a/pkg/get/tools.go +++ b/pkg/get/tools.go @@ -1965,9 +1965,11 @@ https://github.com/{{.Owner}}/{{.Repo}}/releases/download/{{.Version}}/{{.Name}} Repo: "k0sctl", Name: "k0sctl", Description: "A bootstrapping and management tool for k0s clusters", - BinaryTemplate: `{{$arch := "x64"}} - {{- if eq .Arch "aarch64" -}} + BinaryTemplate: `{{$arch := "amd64"}} + {{- if or (eq .Arch "aarch64") (eq .Arch "arm64") -}} {{$arch = "arm64"}} + {{- else if eq .Arch "armv7l" -}} + {{$arch = "arm"}} {{- end -}} {{$os := .OS}}