setting a custom resource as sink doc (#3502)

* First pass to setting resource as sink

* Adding more clarity on example
This commit is contained in:
Daniel Grist 2021-05-03 12:51:58 -04:00 committed by GitHub
parent f7b75e373d
commit 9ef47abba0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 31 additions and 0 deletions

View File

@ -44,6 +44,37 @@ spec:
name: my-kafka-sink
```
## Setting up a Custom Resource to be used as a sink
To allow a Custom Resource to act as a sink for events, there are two things needed:
#### 1. Make the resource Addressable
To make a Custom Resource Addressable, it needs to contain a `status.address.url`. More information about [Addressable resources](https://github.com/knative/specs/blob/main/specs/eventing/interfaces.md#addressable).
#### 2. Create an addressable-resolver ClusterRole
An addressable-resolver ClusterRole is needed in order to obtain the necessary RBAC rules for the sink to receive events.
For example, we can create a `kafkasinks-addressable-resolver` ClusterRole to allow `get`, `list`, and `watch` access to `kafkasinks` and `kafkasinks/status`
```yaml
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: kafkasinks-addressable-resolver
labels:
kafka.eventing.knative.dev/release: devel
duck.knative.dev/addressable: "true"
# Do not use this role directly. These rules will be added to the "addressable-resolver" role.
rules:
- apiGroups:
- eventing.knative.dev
resources:
- kafkasinks
- kafkasinks/status
verbs:
- get
- list
- watch
```
## Knative Sinks
| Name | Maintainer | Description |