From 0638b554c60a782ec7980bf1a7e2eea65bf40af2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cz=C3=A9kus=20M=C3=A1t=C3=A9?= Date: Sun, 12 Nov 2023 14:32:10 +0100 Subject: [PATCH] feat: add kwokctl to arkade get tools MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Czékus Máté --amend Signed-off-by: Czékus Máté --- README.md | 4 +++- pkg/get/get_test.go | 40 ++++++++++++++++++++++++++++++++++++++++ pkg/get/tools.go | 19 +++++++++++++++++++ 3 files changed, 62 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index bd15c0956..98d5ca46e 100644 --- a/README.md +++ b/README.md @@ -814,6 +814,8 @@ There are 56 apps that you can install on your cluster. | [kubeval](https://github.com/instrumenta/kubeval) | Validate your Kubernetes configuration files, supports multiple Kubernetes versions | | [kumactl](https://github.com/kumahq/kuma) | kumactl is a CLI to interact with Kuma and its data | | [kustomize](https://github.com/kubernetes-sigs/kustomize) | Customization of kubernetes YAML configurations | +| [kwok](https://github.com/kubernetes-sigs/kwok) | KWOK stands for Kubernetes WithOut Kubelet, responsible for simulating the lifecycle of fake nodes, pods, and other Kubernetes API resources | +| [kwokctl](https://github.com/kubernetes-sigs/kwok) | CLI tool designed to streamline the creation and management of clusters, with nodes simulated by `kwok` | | [kyverno](https://github.com/kyverno/kyverno) | CLI to apply and test Kyverno policies outside a cluster. | | [lazygit](https://github.com/jesseduffield/lazygit) | A simple terminal UI for git commands. | | [linkerd2](https://github.com/linkerd/linkerd2) | Ultralight, security-first service mesh for Kubernetes. | @@ -868,6 +870,6 @@ There are 56 apps that you can install on your cluster. | [waypoint](https://github.com/hashicorp/waypoint) | Easy application deployment for Kubernetes and Amazon ECS | | [yq](https://github.com/mikefarah/yq) | Portable command-line YAML processor. | | [yt-dlp](https://github.com/yt-dlp/yt-dlp) | Fork of youtube-dl with additional features and fixes | -There are 141 tools, use `arkade get NAME` to download one. +There are 143 tools, use `arkade get NAME` to download one. > Note to contributors, run `arkade get --format markdown` to generate this list diff --git a/pkg/get/get_test.go b/pkg/get/get_test.go index daa4e0cba..69cd55e0d 100644 --- a/pkg/get/get_test.go +++ b/pkg/get/get_test.go @@ -6761,3 +6761,43 @@ func Test_DownloadKwok(t *testing.T) { } } } + +func Test_DownloadKwokctl(t *testing.T) { + var ( + tools = MakeTools() + name = "kwokctl" + toolVersion = "v0.4.0" + tool = getTool(name, tools) + ) + + tests := []test{ + { + os: "linux", + version: toolVersion, + arch: arch64bit, + url: `https://github.com/kubernetes-sigs/kwok/releases/download/v0.4.0/kwokctl-linux-amd64`, + }, + { + os: "darwin", + version: toolVersion, + arch: archDarwinARM64, + url: `https://github.com/kubernetes-sigs/kwok/releases/download/v0.4.0/kwokctl-darwin-arm64`, + }, + { + os: "darwin", + version: toolVersion, + arch: arch64bit, + url: `https://github.com/kubernetes-sigs/kwok/releases/download/v0.4.0/kwokctl-darwin-amd64`, + }, + } + + 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) + } + } +} diff --git a/pkg/get/tools.go b/pkg/get/tools.go index 239215e9b..e6f4dbca1 100644 --- a/pkg/get/tools.go +++ b/pkg/get/tools.go @@ -3911,5 +3911,24 @@ https://github.com/{{.Owner}}/{{.Repo}}/releases/download/{{.Version}}/{{.Repo}} kwok-{{$os}}-{{$arch}}{{$ext}}`, }) + + tools = append(tools, + Tool{ + Owner: "kubernetes-sigs", + Repo: "kwok", + Name: "kwokctl", + Description: "CLI tool designed to streamline the creation and management of clusters, with nodes simulated by `kwok`", + BinaryTemplate: ` + {{ $os := .OS }} + {{ $arch := .Arch }} + + {{- if (or (eq .Arch "aarch64") (eq .Arch "arm64")) -}} + {{ $arch = "arm64" }} + {{- else if eq .Arch "x86_64" -}} + {{ $arch = "amd64" }} + {{- end -}} + + kwokctl-{{$os}}-{{$arch}}`, + }) return tools }