From 9ef47abba058af68d07df0d75ece04e40e590764 Mon Sep 17 00:00:00 2001 From: Daniel Grist Date: Mon, 3 May 2021 12:51:58 -0400 Subject: [PATCH] setting a custom resource as sink doc (#3502) * First pass to setting resource as sink * Adding more clarity on example --- docs/eventing/sink/_index.md | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/docs/eventing/sink/_index.md b/docs/eventing/sink/_index.md index 58013ed6b..b67b95f0c 100644 --- a/docs/eventing/sink/_index.md +++ b/docs/eventing/sink/_index.md @@ -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 |