Skip to content

Commit

Permalink
Add kubetrim by Alex Ellis
Browse files Browse the repository at this point in the history
Signed-off-by: Alex Ellis (OpenFaaS Ltd) <[email protected]>
  • Loading branch information
alexellis committed Aug 19, 2024
1 parent 2fb58a4 commit 3225ec3
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 0 deletions.
43 changes: 43 additions & 0 deletions pkg/get/get_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,49 @@ func Test_DownloadArkade(t *testing.T) {
}
}

func Test_DownloadKubetrim(t *testing.T) {
tools := MakeTools()
name := "kubetrim"

tool := getTool(name, tools)

tests := []test{
{os: "mingw64_nt-10.0-18362",
arch: arch64bit,
version: "0.8.28",
url: "https://github.com/alexellis/kubetrim/releases/download/0.8.28/kubetrim.exe"},
{os: "darwin",
arch: arch64bit,
version: "0.8.28",
url: "https://github.com/alexellis/kubetrim/releases/download/0.8.28/kubetrim-darwin"},
{os: "darwin",
arch: archDarwinARM64,
version: "0.8.28",
url: "https://github.com/alexellis/kubetrim/releases/download/0.8.28/kubetrim-darwin-arm64"},
{os: "linux",
arch: arch64bit,
version: "0.8.28",
url: "https://github.com/alexellis/kubetrim/releases/download/0.8.28/kubetrim"},
{os: "linux",
arch: "armv7l",
version: "0.8.28",
url: "https://github.com/alexellis/kubetrim/releases/download/0.8.28/kubetrim-armhf"},
{os: "linux",
arch: archARM64,
version: "0.8.28",
url: "https://github.com/alexellis/kubetrim/releases/download/0.8.28/kubetrim-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("want: %s, got: %s", tc.url, got)
}
}
}

func Test_Download_RunJob(t *testing.T) {
tools := MakeTools()
name := "run-job"
Expand Down
23 changes: 23 additions & 0 deletions pkg/get/tools.go
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,29 @@ https://dl.k8s.io/release/{{.Version}}/bin/{{$os}}/{{$arch}}/kubectl{{$ext}}`})
{{- end -}}`,
})

tools = append(tools,
Tool{
Owner: "alexellis",
Repo: "kubetrim",
Name: "kubetrim",
Description: "Tidy up old Kubernetes clusters from kubeconfig.",
BinaryTemplate: `{{ if HasPrefix .OS "ming" -}}
{{.Name}}.exe
{{- else if eq .OS "darwin" -}}
{{ if eq .Arch "arm64" -}}
{{.Name}}-darwin-arm64
{{- else -}}
{{.Name}}-darwin
{{- end -}}
{{- else if eq .Arch "armv7l" -}}
{{.Name}}-armhf
{{- else if eq .Arch "aarch64" -}}
{{.Name}}-arm64
{{- else -}}
{{.Name}}
{{- end -}}`,
})

tools = append(tools,
Tool{
Owner: "alexellis",
Expand Down

0 comments on commit 3225ec3

Please sign in to comment.