# Rukpak client (rukpakctl)
## Summary
The rukpak client is a typed client that can be used to interact with rukpak resources on-cluster via kubectl. It is very similar to the existing `kubectl-operator` [plugin](https://github.com/operator-framework/kubectl-operator) in that it interacts with Custom Resources (CRs) that are associated with an installation of an operator. The rukpak client would exlusively interact with rukpak resources and provide users a quick and easy way to get extra information about rukpak resources on their cluster.
For inspiration, see the cert-manager [cmctl tool](https://cert-manager.io/docs/usage/cmctl/#approve-and-deny-certificaterequests), which provides a first class experience interacting with the cert-manager APIs.
## Implementation details
To begin, the client code can be stored in the existing [rukpak](https://github.com/operator-framework/rukpak) repository in a new directory under `/cmd`. Keeping the client in-tree with the rest of the code enables the existing CI infrastructure to be used. It also makes the client more visible to the contributors to the rukpak project. A version of the client can be bundled and released alongside each rukpak milestone.
The proposed name of the client binary is `rukpakctl`. It can begin as a standalone binary, and may later be packaged and distributed as a kubectl plugin if required. The client should use the [cobra](https://github.com/spf13/cobra) CLI framework to provide a good UX.
## Initial commands
### rukpakctl status
`rukpakctl status` -- returns diagnostic information the rukpak install and status of the components of the stack. Rukpak comes bundled with several webhooks and a deployment, and the goal of this command is to check to ensure that all relevant components are available and responsive on the server. See [the release notes](https://github.com/operator-framework/rukpak/releases/tag/v0.3.0) for an example of the types of diagnostic checks that are done for a rukpak installation.
```
$ rukpakctl status
Checking rukpak resources...
✅ deployment plain-provisioner Available
✅ webhook bundle Available
✅ webhook crdvalidator Available
```
### rukpakctl install
`rukpakctl install` -- installs the latest tagged release from github
```
$ rukpakctl install
Installing rukpak...
<installation logs>
✅ Installed successfully.
```
### rukpakctl unpack
`rukpak unpack <bundle>` -- finds the tar.gz files associated with a bundle on the local volume of the relevant provisioner and prints them out as a YAML-encoded stream. This command would basically be a Go-implementation of the existing [bash script](https://github.com/operator-framework/rukpak/blob/main/internal/provisioner/plain/README.md#make-bundle-content-available-but-do-not-install-it) that is able to get the bundle contents out from the cluster.
Note: the existing bash implementation may have to change to support the new service account token generation methodology in kubernetes 1.24
```
$ rukpakctl unpack <bundle>
👀 Looking for <bundle> contents...
<YAML-encoded stream of <bundle>
```
### rukpakctl approve/deny
- support auditing workflows
### rukpak create bundle
- create a bundle from a manifests directory and apply it to the cluster
### rukpakctl convert
- converts registry+v1 bundle to plain+v0 bundle
### rukpakctl disable crd-validation
- disables the crd validator webhook (for a particular bundle?)