|
| 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. |
0 commit comments