knative-extensions / knative-extensions/kn-plugin-source-kafka

Add option to specify relative uri for service

Open
#301 5 comments 1 reaction 0 assignees View on GitHub
kind/feature-request kind/good-first-issue triage/accepted
Dominant language
Go
Stars
3
Forks
21
Avg merge
17m
Merged PRs (30d)
3

Description

### Feature request

One useful addition would be a relative `uri` option when specifying a service sink.

### Use case

It's very common for the CloudEvents endpoint to be at a URI other than `/`. `KafkaSource` supports `uri` [in addition to `ref`](https://knative.dev/docs/eventing/sinks/#sink-as-a-parameter):

> uri: [...] Relative URIs are resolved using the base URI retrieved from Ref.

I had to use YAML instead:

```
apiVersion: sources.knative.dev/v1beta1
kind: KafkaSource
metadata:
name: mysource
spec:
bootstrapServers:
- my-cluster-kafka-bootstrap.amq-streams-kafka.svc:9092
sink:
ref:
apiVersion: serving.knative.dev/v1
kind: Service
name: myservice
uri: "/api/cloudevents/mytopic"
topics:
- mytopic
```

### UI Example

```
kn source kafka create mysource --servers my-cluster-kafka-bootstrap.amq-streams-kafka.svc:9092 --topics mytopic --sink myservice --uri /api/cloudevents/mytopic
```

Contributor guide

Open the contributing guide

Research direction

Begin with the `kn source kafka create` command and trace how the existing `--sink` and sink `ref` options are handled. Compare that path with the KafkaSource `uri` behavior described in the issue; done means the command accepts a relative `--uri` and passes it through when creating the source.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
cli
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.