ministryofjustice / cloud-platform

Documentation on the MoJ cloud platform
MIT License
87 stars 44 forks source link

FIREBREAK: Convert the cloud-platform cli to a krew plugin #2807

Closed jasonBirchall closed 3 years ago

jasonBirchall commented 3 years ago

Background

Currently we've built a separate tool for our users to manipulate Kubernetes resources in the Cloud Platform live-1 cluster (like decoding secrets). It would be nice if, instead of a separate tool, we just add a plugin to kubectl. This means users would install the plugin via a tool like krew, then they can run moj cloud-platform commands and arguments. Source: https://github.com/kubernetes-sigs/krew

Krew is a tool that makes it easy to use kubectl plugins. Krew helps you discover plugins, install and manage them on your machine. It is similar to tools like apt, dnf or brew. Today, over 130 kubectl plugins are available on Krew.

Questions / Assumptions

Are we able to move some of our cloud-platform cli features to a krew plugin? Investigate krew and see how easy it is to add our own plugin.

Definition of done

jasonBirchall commented 3 years ago

Is it possible? We can absolutely turn the whole cloud-platform cli into a kubectl plugin. It would require users to install krew, which would then allow users to add a custom index and install the cloud-platform cli.

How would it affect users? Installing the CLI via a kubectl plugin allows users to run kubectl cloud-platform <command>. The functionality of the cli would remain the same.

Advantages of using krew? Like any package manager krew allows you to easily install and maintain the latest version of the cli.

Disadvantages of using krew? It's not a popular package manager, so users would inevitably have to install krew (at the time of writing) manually. It doesn't actually improve the user experience, in fact it would increase the amount of characters typed at the command line. kubectl cloud-platform <command> rather than just cloud-platform <command>.

Should we do it? In my opinion, time would be better spent adding brew or snap support to the GoReleaser. When a new version is released, the binary is uploaded to a brew cask or snap package.

Next steps? Close this ticket and raise the possibility of amending GoReleaser.