Skip to content

Commit cb26a3c

Browse files
authored
Merge pull request #57548 from gabriel-rh/SRVKE-1366-namespaced-kafka-broker
SRVKE-1366 Namespaced Kafka broker
2 parents cc10a26 + 050d3cf commit cb26a3c

File tree

3 files changed

+97
-1
lines changed

3 files changed

+97
-1
lines changed
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * serverless/eventing/brokers/kafka-broker.adoc
4+
5+
:_content-type: PROCEDURE
6+
[id="serverless-create-kafka-namespaced-broker-{context}"]
7+
= Creating a Knative broker for Apache Kafka that uses an isolated data plane
8+
9+
:FeatureName: The Knative Broker implementation for Apache Kafka with isolated data plane
10+
include::snippets/technology-preview.adoc[leveloffset=+2]
11+
12+
To create a `KafkaNamespaced` broker, you must set the `eventing.knative.dev/broker.class` annotation to `KafkaNamespaced`.
13+
14+
.Prerequisites
15+
16+
* The {ServerlessOperatorName}, Knative Eventing, and the `KnativeKafka` custom resource are installed on your {product-title} cluster.
17+
18+
* You have access to an Apache Kafka instance, such as link:https://access.redhat.com/documentation/en-us/red_hat_amq/7.6/html/amq_streams_on_openshift_overview/kafka-concepts_str#kafka-concepts-key_str[Red Hat AMQ Streams], and have created a Kafka topic.
19+
20+
* You have created a project, or have access to a project, with the appropriate roles and permissions to create applications and other workloads in {product-title}.
21+
22+
* You have installed the OpenShift CLI (`oc`).
23+
24+
.Procedure
25+
26+
. Create an Apache Kafka-based broker by using a YAML file:
27+
+
28+
[source,yaml]
29+
----
30+
apiVersion: eventing.knative.dev/v1
31+
kind: Broker
32+
metadata:
33+
annotations:
34+
eventing.knative.dev/broker.class: KafkaNamespaced <1>
35+
name: default
36+
namespace: my-namespace <2>
37+
spec:
38+
config:
39+
apiVersion: v1
40+
kind: ConfigMap
41+
name: my-config <2>
42+
...
43+
----
44+
<1> To use the Apache Kafka broker with isolated data planes, the broker class value must be `KafkaNamespaced`.
45+
<2> The referenced `ConfigMap` object `my-config` must be in the same namespace as the `Broker` object, in this case `my-namespace`.
46+
47+
. Apply the Apache Kafka-based broker YAML file:
48+
+
49+
[source,terminal]
50+
----
51+
$ oc apply -f <filename>
52+
----
53+
54+
[IMPORTANT]
55+
====
56+
The `ConfigMap` object in `spec.config` must be in the same namespace as the `Broker` object:
57+
58+
[source,yaml]
59+
----
60+
apiVersion: v1
61+
kind: ConfigMap
62+
metadata:
63+
name: my-config
64+
namespace: my-namespace
65+
data:
66+
...
67+
----
68+
====
69+
70+
After the creation of the first `Broker` object with the `KafkaNamespaced` class, the `kafka-broker-receiver` and `kafka-broker-dispatcher` deployments are created in the namespace. Subsequently, all brokers with the `KafkaNamespaced` class in the same namespace will use the same data plane. If no brokers with the `KafkaNamespaced` class exist in the namespace, the data plane in the namespace is deleted.
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * serverless/eventing/brokers/kafka-broker.adoc
4+
5+
:_content-type: CONCEPT
6+
[id="serverless-kafka-broker-with-isolated-dataplane_{context}"]
7+
= Knative Broker implementation for Apache Kafka with isolated data plane
8+
9+
:FeatureName: The Knative Broker implementation for Apache Kafka with isolated data plane
10+
include::snippets/technology-preview.adoc[leveloffset=+2]
11+
12+
The Knative Broker implementation for Apache Kafka has 2 planes:
13+
14+
Control plane:: Consists of controllers that talk to the Kubernetes API, watch for custom objects, and manage the data plane.
15+
16+
Data plane:: The collection of components that listen for incoming events, talk to Apache Kafka, and send events to the event sinks. The Knative Broker implementation for Apache Kafka data plane is where events flow. The implementation consists of `kafka-broker-receiver` and `kafka-broker-dispatcher` deployments.
17+
18+
When you configure a Broker class of `Kafka`, the Knative Broker implementation for Apache Kafka uses a shared data plane. This means that the `kafka-broker-receiver` and `kafka-broker-dispatcher` deployments in the `knative-eventing` namespace are used for all Apache Kafka Brokers in the cluster.
19+
20+
However, when you configure a Broker class of `KafkaNamespaced`, the Apache Kafka broker controller creates a new data plane for each namespace where a broker exists. This data plane is used by all `KafkaNamespaced` brokers in that namespace. This provides isolation between the data planes, so that the `kafka-broker-receiver` and `kafka-broker-dispatcher` deployments in the user namespace are only used for the broker in that namespace.
21+
22+
[IMPORTANT]
23+
====
24+
As a consequence of having separate data planes, this security feature creates more deployments and uses more resources. Unless you have such isolation requirements, use a *regular* Broker with a class of `Kafka`.
25+
====

serverless/eventing/brokers/kafka-broker.adoc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ If your {ServerlessProductName} deployment is not configured to use Kafka broker
1616

1717
include::modules/serverless-kafka-broker.adoc[leveloffset=+2]
1818
include::modules/serverless-kafka-broker-with-kafka-topic.adoc[leveloffset=+2]
19-
19+
include::modules/serverless-kafka-broker-with-isolated-dataplane.adoc[leveloffset=+2]
20+
include::modules/serverless-create-kafka-namespaced-broker.adoc[leveloffset=+2]
2021

2122
// kafka broker general configmap
2223
include::modules/serverless-kafka-broker-configmap.adoc[leveloffset=+1]

0 commit comments

Comments
 (0)