From e2e21d870a37c9e1909bf0b9fff17c7731ec1c3c Mon Sep 17 00:00:00 2001 From: Richard Gee Date: Thu, 17 Oct 2024 12:19:43 +0100 Subject: [PATCH] feat: add duplik8s to tools Signed-off-by: Richard Gee --- README.md | 3 ++- pkg/get/get_test.go | 56 +++++++++++++++++++++++++++++++++++++++++++++ pkg/get/tools.go | 30 ++++++++++++++++++++++++ 3 files changed, 88 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index a6bc1af79..f434d8f7e 100644 --- a/README.md +++ b/README.md @@ -788,6 +788,7 @@ There are 52 apps that you can install on your cluster. | [dive](https://github.com/wagoodman/dive) | A tool for exploring each layer in a docker image | | [docker-compose](https://github.com/docker/compose) | Define and run multi-container applications with Docker. | | [doctl](https://github.com/digitalocean/doctl) | Official command line interface for the DigitalOcean API. | +| [duplik8s](https://github.com/Telemaco019/duplik8s) | kubectl plugin to duplicate resources in a Kubernetes cluster. | | [eksctl](https://github.com/eksctl-io/eksctl) | Amazon EKS Kubernetes cluster management | | [eksctl-anywhere](https://github.com/aws/eks-anywhere) | Run Amazon EKS on your own infrastructure | | [etcd](https://github.com/etcd-io/etcd) | Distributed reliable key-value store for the most critical data of a distributed system. | @@ -913,6 +914,6 @@ There are 52 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 155 tools, use `arkade get NAME` to download one. +There are 156 tools, use `arkade get NAME` to download one. > Note to contributors, run `go build && ./arkade get --format markdown` to generate this list \ No newline at end of file diff --git a/pkg/get/get_test.go b/pkg/get/get_test.go index 19921efd3..9531593b4 100644 --- a/pkg/get/get_test.go +++ b/pkg/get/get_test.go @@ -7816,3 +7816,59 @@ func Test_Download_labctl(t *testing.T) { } } } + +func Test_Download_duplik8s(t *testing.T) { + tools := MakeTools() + name := "duplik8s" + const toolVersion = "v0.3.0" + + tool := getTool(name, tools) + + tests := []test{ + { + os: "darwin", + arch: arch64bit, + version: toolVersion, + url: "https://github.com/Telemaco019/duplik8s/releases/download/v0.3.0/duplik8s_Darwin_x86_64.tar.gz", + }, + { + os: "darwin", + arch: archDarwinARM64, + version: toolVersion, + url: "https://github.com/Telemaco019/duplik8s/releases/download/v0.3.0/duplik8s_Darwin_arm64.tar.gz", + }, + { + os: "linux", + arch: arch64bit, + version: toolVersion, + url: "https://github.com/Telemaco019/duplik8s/releases/download/v0.3.0/duplik8s_Linux_x86_64.tar.gz", + }, + { + os: "linux", + arch: archARM64, + version: toolVersion, + url: "https://github.com/Telemaco019/duplik8s/releases/download/v0.3.0/duplik8s_Linux_arm64.tar.gz", + }, + { + os: "mingw64_nt-10.0-18362", + arch: arch64bit, + version: toolVersion, + url: "https://github.com/Telemaco019/duplik8s/releases/download/v0.3.0/duplik8s_Windows_x86_64.zip", + }, + { + os: "mingw64_nt-10.0-18362", + arch: archARM64, + version: toolVersion, + url: "https://github.com/Telemaco019/duplik8s/releases/download/v0.3.0/duplik8s_Windows_arm64.zip", + }, + } + 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 a8c83bb38..3ebc5fe95 100644 --- a/pkg/get/tools.go +++ b/pkg/get/tools.go @@ -4266,5 +4266,35 @@ https://github.com/{{.Owner}}/{{.Repo}}/releases/download/{{.Version}}/{{.Name}} labctl_{{$os}}_{{$arch}}.{{$ext}} `, }) + + tools = append(tools, + Tool{ + Owner: "Telemaco019", + Repo: "duplik8s", + Name: "duplik8s", + Description: "kubectl plugin to duplicate resources in a Kubernetes cluster.", + BinaryTemplate: ` + {{ $os := .OS }} + {{ $arch := .Arch }} + {{ $ext := "tar.gz" }} + + {{- if (or (eq .Arch "aarch64") (eq .Arch "arm64")) -}} + {{ $arch = "arm64" }} + {{- end -}} + + {{ if HasPrefix .OS "ming" -}} + {{$os = "Windows"}} + {{ $ext = "zip" }} + {{- end -}} + + {{- if eq .OS "darwin" -}} + {{$os = "Darwin"}} + {{- else if eq .OS "linux" -}} + {{ $os = "Linux" }} + {{- end -}} + + duplik8s_{{$os}}_{{$arch}}.{{$ext}} + `, + }) return tools }