New commands to manage agent token cache
We've recently introduced a cache for agent tokens created by glab cluster agent get-token (this is a Kubernetes credential plugin used when configuring with glab cluster agent update-kubeconfig).
This cache is currently a black box to our users. A new set of commands should allow to list the tokens in the cache and to clear and / or revoke them.
Implementation Plan
- Implement a new
token-cachecommand group underglab cluster agent. - Implement a new
token-cachesubcommand calledlistto list all available tokens. By default this command shows the cached tokens in the keyring and file system cache. A--filestsyem=true/falseand--keyring=true/falseflag should make this configurable. For--keyring(or keyring in general) to work, we first need to fetch all available agents of the project (from --repo) or allow to specify them via--agent. - Implement a new
token-cachesubcommand calledclearto remove all locally cached tokens. Have--filesystemand--keyringflags similar to thelistcommand. Have a--revokeflag to automatically revoke the cleared tokens. (or rather a--no-revoketo opt out. Revoking is probably the better default behavior).