knative / knative/client

kn plugin management

Open
#1,386 14 comments 0 reactions 0 assignees View on GitHub
kind/feature kind/proposal triage/accepted
Dominant language
Go
Stars
387
Forks
274
Avg merge
1d 6h
Merged PRs (30d)
8

Description

### Feature request

I think kn CLI should provide an easy way to manage and discover plugins for itself. By this, I think of adding a couple of sub commands to `kn plugin`.

My idea for this is to rely on container images as transport layer. I imagine a kn to have configurable list of plugin index images, by default equal to (can be configured by `kn config` command):

```json
{
"default": "gcr.io/knative-releases/knative.dev/client/plugins-index"
}
```

Such container image will contain just a file database (format TBD, SQLite maybe?!? YAML files?!?) of plugins metadata. We can set up this in the way that every PR merge to repo like https://github.com/knative-sandbox/client-plugins will build and publish new index image, so users will see new content.

This index database will contain information such as plugin name, version, container image, description, maturity level, keywords as well as previous releases of given plugin.

Using the information in such index container, the `kn plugin search` will perform its operations, as well as `kn plugin install`

Such operation is cross-platform, and don't rely on any external tooling to be installed on user's machine (see: [github.com/containers/image/v5](https://pkg.go.dev/github.com/containers/image/v5) as example implementation).

### Use cases

- _As a kn CLI user, I would like to discover, install and remove plugins easily_
- _As a corporate kn CLI user, I would like to publish, discover and install my own kn plugins in addition to upstream ones_
- _As a knative vendor, I would like to publish productized plugins for knative_

### UI Examples

#### Searching plugins

```bash
$ kn plugin search event
NAME DESCRIPTION VERSION MATURITY PLATFORM
event Build, send & listen to cloud events v0.3.0 alpha amd64
```

#### Installing plugins from index

```bash
$ kn plugin install event
INFO Downloading event plugin
Using tag: v0.3.0
latest: Pulling from gcr.io/knative-releases/knative.dev/client/plugins/event:v0.3.0
fdd5d7827f33: Pull complete
a3ed95caeb02: Pull complete
Digest: sha256:e7d38b3517548a1c71e41bffe9c8ae6d6d29546ce46bf62159837aad072c90aa
Status: Downloaded newer image for gcr.io/knative-releases/knative.dev/client/plugins/event:v0.3.0
INFO Installing event plugin
INFO Plugin event successfully installed. Call: `kn event --help`!
```

#### Installing custom plugins (Ad hoc)

_**NOTE:** by configuring custom plugin index, vendors and corporate users can utilize previous method as well._

```bash
$ kn plugin install costsavings --image=registry.example.org/kn-plugin/costsavings
INFO Downloading costsavings plugin
Using latest tag: latest
latest: Pulling from registry.example.org/kn-plugin/costsavings:latest
546ce46bf621: Pull complete
7d38b3517548: Pull complete
Digest: sha256:d0b2326c74911ac7a3cb5a2775fc6b696371557751ab004a8d13a7998027c518
Status: Downloaded newer image for registry.example.org/kn-plugin/costsavings:latest
INFO Installing costsavings plugin
INFO Plugin costsavings successfully installed. Call: `kn costsavings --help`!
```

#### Updating single plugin

```bash
$ kn plugin update event
INFO Updating event plugin
Using tag: v0.3.1
latest: Pulling from gcr.io/knative-releases/knative.dev/client/plugins/event:v0.3.1
a471bb98a512: Pull complete
fdd5d7827f33: Already exists
a3ed95caeb02: Already exists
Digest: sha256:6a117897d88659e22b221ea420af5953f1b2b97e70560e39369dd0193c39808b
Status: Downloaded newer image for gcr.io/knative-releases/knative.dev/client/plugins/event:v0.3.1
INFO Installing event plugin
INFO Plugin event successfully updated.
```

#### Updating all installed plugins

```bash
$ kn plugin update
INFO Updating all installed plugins
INFO All plugins are now up-to-date.
```

#### Removing installed plugin

```bash
$ kn plugin remove event
INFO Plugin event has been removed.
```

Contributor guide

Open the contributing guide

Research direction

Start by reviewing the existing `kn plugin` and `kn config` command entry points, then examine the proposed `containers/image/v5` approach for accessing plugin index images. Define the index format and command scope before implementing search, install, update, and remove; done means the documented discovery and plugin-management use cases work cross-platform.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
cli
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.