Skip to content

kn source list-types - List all available source types #511

@navidshaikh

Description

@navidshaikh

This command list the source type CRDs, as discussed in the MVP doc.

It's all about to list all possible source types which can be used with a "kn source create"

General description from the eventing spec documentation (might become outdated, the spec is the authorative specification):

# List all available builtin, plugin and generic sources which can be 
# used with the connected cluster
$ kn source list-types

TYPE              NAME                                         DESCRIPTION
kafka             kafkasources.sources.eventing.knative.dev    Kafka messages
apiserver         apiserversources.sources.eventing.knative.de Import Kubernetes event
cronjob           cronjobsources.sources.eventing.knative.dev  Periodic event from cron
twitter           twitter.mycompany.com                        Import tweets          
storage           storages.events.cloud.run
pullsubscriptions pullsubscriptions.pubsub.cloud.run

In this example output, typed and generic sources are listed together. For generic sources a short type name calculated from the full CRD name as described in Guessable CRD names is shown. Optionally an additional column should be presented in verbose output to indicate the kind of source support (builtin/plugin/generic).
This is just a sample output, the details would have to be determined during implementation. For generic sources it should be checked whether a description could be extracted from the CRD directly so that it could be presented in the Description column.
The list above is created by performing the following steps:

  • A set of all CRDs with a label indicating that this CRD is a Knative Eventing Source is obtained from the cluster.
  • For all built in-types like cronjob, apiserver and container it is checked whether their associated CRD names are in this initial set. If so, the names removed are from the set, and the found type is printed out with a fixed description.
  • All kn plugins that start with a name kn-source- are called with “kn-source- manifest” ( could be e.g. “twitter” like in the example above). This command is supposed to return metadata as a JSON structure including the description and the supported full CRD name. It is checked if this CRD name is in the set of CRDs obtained from the cluster, and if so, it is printed out and the CRD name removed from that CRD set.
  • For all CRDs remaining in this CRD set, the CRD name is printed out with a short name for the CRD. Before printing out that name it could be checked whether the CRD is really suitable to be used as generic Source by verifying that it conforms to the Eventing Source specification.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions