Skip to content

Commit

Permalink
feat: add kwok to arkade get tools
Browse files Browse the repository at this point in the history
Signed-off-by: Czékus Máté <[email protected]>
  • Loading branch information
Shikachuu committed Nov 12, 2023
1 parent 59b0991 commit 1ed0e39
Show file tree
Hide file tree
Showing 2 changed files with 83 additions and 0 deletions.
58 changes: 58 additions & 0 deletions pkg/get/get_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6703,3 +6703,61 @@ func Test_DownloaSkupper(t *testing.T) {
}
}
}

func Test_DownloadKwok(t *testing.T) {
var (
tools = MakeTools()
name = "kwok"
toolVersion = "v0.4.0"
tool = getTool(name, tools)
)

tests := []test{
{
os: "linux",
version: toolVersion,
arch: archARM64,
url: `https://github.com/kubernetes-sigs/kwok/releases/download/v0.4.0/kwok-linux-arm64`,
},
{
os: "linux",
version: toolVersion,
arch: arch64bit,
url: `https://github.com/kubernetes-sigs/kwok/releases/download/v0.4.0/kwok-linux-amd64`,
},
{
os: "darwin",
version: toolVersion,
arch: archDarwinARM64,
url: `https://github.com/kubernetes-sigs/kwok/releases/download/v0.4.0/kwok-darwin-arm64`,
},
{
os: "darwin",
version: toolVersion,
arch: arch64bit,
url: `https://github.com/kubernetes-sigs/kwok/releases/download/v0.4.0/kwok-darwin-amd64`,
},
{
os: "ming",
version: toolVersion,
arch: archARM64,
url: `https://github.com/kubernetes-sigs/kwok/releases/download/v0.4.0/kwok-windows-arm64.exe`,
},
{
os: "ming",
version: toolVersion,
arch: arch64bit,
url: `https://github.com/kubernetes-sigs/kwok/releases/download/v0.4.0/kwok-windows-amd64.exe`,
},
}

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.Errorf("want: %s, got: %s", tc.url, got)
}
}
}
25 changes: 25 additions & 0 deletions pkg/get/tools.go
Original file line number Diff line number Diff line change
Expand Up @@ -3886,5 +3886,30 @@ https://github.com/{{.Owner}}/{{.Repo}}/releases/download/{{.Version}}/{{.Repo}}
skupper-cli-{{.VersionNumber}}-{{$os}}-{{$arch}}.{{$ext}}
`,
})

tools = append(tools,
Tool{
Owner: "kubernetes-sigs",
Repo: "kwok",
Name: "kwok",
Description: "KWOK stands for Kubernetes WithOut Kubelet, responsible for simulating the lifecycle of fake nodes, pods, and other Kubernetes API resources",
BinaryTemplate: `
{{ $os := .OS }}
{{ $arch := .Arch }}
{{ $ext := "" }}
{{- if HasPrefix .OS "ming" -}}
{{ $os = "windows" }}
{{ $ext = ".exe" }}
{{- end -}}
{{- if (or (eq .Arch "aarch64") (eq .Arch "arm64")) -}}
{{ $arch = "arm64" }}
{{- else if eq .Arch "x86_64" -}}
{{ $arch = "amd64" }}
{{- end -}}
kwok-{{$os}}-{{$arch}}{{$ext}}`,
})
return tools
}

0 comments on commit 1ed0e39

Please sign in to comment.