Revert "drop eventing-rabbitmq (#5861)" (#5910)

This reverts commit a0d137bc66.
This commit is contained in:
Iliia Khaprov - VMware by Broadcom 2024-03-15 11:28:04 +01:00 committed by GitHub
parent 5e094593e7
commit d8d932bf8d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
11 changed files with 299 additions and 2 deletions

View File

@ -195,6 +195,7 @@ nav:
- Apache Kafka:
- About Apache Kafka Broker: eventing/brokers/broker-types/kafka-broker/README.md
- Configuring Kafka features: eventing/brokers/broker-types/kafka-broker/configuring-kafka-features.md
- RabbitMQ Broker: eventing/brokers/broker-types/rabbitmq-broker/README.md
- Creating a Broker: eventing/brokers/create-broker.md
- Developer configuration options: eventing/brokers/broker-developer-config-options.md
- Triggers:
@ -214,6 +215,7 @@ nav:
- PingSource:
- Creating a PingSource object: eventing/sources/ping-source/README.md
- PingSource reference: eventing/sources/ping-source/reference.md
- RabbitMQSource: eventing/sources/rabbitmq-source/README.md
- RedisStreamSource:
- About RedisStreamSource: eventing/sources/redis/README.md
- Creating a RedisStreamSource object: eventing/sources/redis/getting-started.md

View File

@ -6,6 +6,7 @@ plugins:
eventing/broker/create-mtbroker.md: eventing/brokers/create-broker.md
eventing/broker/example-mtbroker.md: eventing/brokers/broker-developer-config-options.md
eventing/broker/kafka-broker/README.md: eventing/brokers/broker-types/kafka-broker/README.md
eventing/broker/rabbitmq-broker/README.md: eventing/brokers/broker-types/rabbitmq-broker/README.md
eventing/broker/README.md: eventing/brokers/README.md
concepts/resources/revisions.md: concepts/serving-resources/revisions.md
serving/revision-gc.md: serving/revisions/revision-developer-config-options.md

View File

@ -33,6 +33,6 @@ spec:
- You can specify any valid `name` for your broker. Using `default` will create a broker named `default`.
- The `namespace` must be an existing namespace in your cluster. Using `default` will create the broker in the `default` namespace.
- You can set the `eventing.knative.dev/broker.class` annotation to change the class of the broker. The default broker class is `MTChannelBasedBroker`, but Knative also supports use of the `Kafka`. For more information see the [Apache Kafka Broker](../brokers/broker-types/kafka-broker/README.md) documentation.
- You can set the `eventing.knative.dev/broker.class` annotation to change the class of the broker. The default broker class is `MTChannelBasedBroker`, but Knative also supports use of the `Kafka` and `RabbitMQBroker` broker class. For more information see the [Apache Kafka Broker](../brokers/broker-types/kafka-broker/README.md) or [RabbitMQ Broker](../brokers/broker-types/rabbitmq-broker/README.md) documentation.
- `spec.config` is used to specify the default backing channel configuration for Channel based Broker implementations. For more information on configuring the default channel type, see the documentation on [Configure Broker defaults](../configuration/broker-configuration.md).
- `spec.delivery` is used to configure event delivery options. Event delivery options specify what happens to an event that fails to be delivered to an event sink. For more information, see the documentation on [Event delivery](../event-delivery.md).

View File

@ -17,3 +17,8 @@ The following is a list of Brokers provided by the community or vendors:
### Knative Broker for Apache Kafka
This Broker implementation uses [Apache Kafka](https://kafka.apache.org/) as its backing technology. For more information, see the [Knative Broker for Apache Kafka](./kafka-broker/README.md) documentation.
### RabbitMQ broker
The RabbitMQ Broker uses [RabbitMQ](https://www.rabbitmq.com/) for its underlying implementation.
For more information, see [RabbitMQ Broker](./rabbitmq-broker/README.md) or [the docs available on GitHub](https://github.com/knative-extensions/eventing-rabbitmq).

View File

@ -1,7 +1,7 @@
# Channel based Broker
The Channel based Broker (`MTChannelBasedBroker`) uses [Channels](../../../channels) for event routing. It is shipped by default with Knative Eventing.
Users should prefer native Broker implementations (like [Knative Broker for Apache Kafka](../kafka-broker/README.md) over the MTChannelBasedBroker and Channel combination because it is usually more efficient as they reduce network hops for example.
Users should prefer native Broker implementations (like [Knative Broker for Apache Kafka](../kafka-broker/README.md) or [RabbitMQ Broker](../rabbitmq-broker/README.md)) over the MTChannelBasedBroker and Channel combination because it is usually more efficient as they reduce network hops for example.
## Prerequisites
* You have Knative Eventing installed.

View File

@ -0,0 +1,114 @@
# Creating a RabbitMQ Broker
This topic describes how to create a RabbitMQ Broker.
## Prerequisites
1. You have installed Knative Eventing.
1. You have installed [CertManager v1.5.4](https://github.com/jetstack/cert-manager/releases/tag/v1.5.4) - easiest integration with RabbitMQ Messaging Topology Operator
1. You have installed [RabbitMQ Messaging Topology Operator](https://github.com/rabbitmq/messaging-topology-operator) - our recommendation is [latest release](https://github.com/rabbitmq/messaging-topology-operator/releases/latest) with CertManager
1. You have access to a working RabbitMQ instance. You can create a RabbitMQ instance by using the [RabbitMQ Cluster Kubernetes Operator](https://github.com/rabbitmq/cluster-operator). For more information see the [RabbitMQ website](https://www.rabbitmq.com/kubernetes/operator/using-operator.html).
## Install the RabbitMQ controller
1. Install the RabbitMQ controller by running the command:
```bash
kubectl apply -f {{ artifact(org="knative-extensions", repo="eventing-rabbitmq", file="rabbitmq-broker.yaml") }}
```
1. Verify that `rabbitmq-broker-controller` and `rabbitmq-broker-webhook` are running:
```bash
kubectl get deployments.apps -n knative-eventing
```
Example output:
```{ .bash .no-copy }
NAME READY UP-TO-DATE AVAILABLE AGE
eventing-controller 1/1 1 1 10s
eventing-webhook 1/1 1 1 9s
rabbitmq-broker-controller 1/1 1 1 3s
rabbitmq-broker-webhook 1/1 1 1 4s
```
## Create a RabbitMQBrokerConfig object
1. Create a YAML file using the following template:
```yaml
apiVersion: eventing.knative.dev/v1alpha1
kind: RabbitmqBrokerConfig
metadata:
name: <rabbitmq-broker-config-name>
spec:
rabbitmqClusterReference:
# Configure name if a RabbitMQ Cluster Operator is being used.
name: <cluster-name>
# Configure connectionSecret if an external RabbitMQ cluster is being used.
connectionSecret:
name: rabbitmq-secret-credentials
queueType: quorum
```
Where:
- <rabbitmq-broker-config-name> is the name you want for your RabbitMQBrokerConfig object.
- <cluster-name> is the name of the RabbitMQ cluster you created earlier.
!!! note
You cannot set `name` and `connectionSecret` at the same time, since `name` is for a RabbitMQ Cluster Operator instance running in the same cluster as the Broker, and `connectionSecret` is for an external RabbitMQ server.
1. Apply the YAML file by running the command:
```bash
kubectl create -f <filename>
```
Where `<filename>` is the name of the file you created in the previous step.
## Create a RabbitMQBroker object
1. Create a YAML file using the following template:
```yaml
apiVersion: eventing.knative.dev/v1
kind: Broker
metadata:
annotations:
eventing.knative.dev/broker.class: RabbitMQBroker
name: <broker-name>
spec:
config:
apiVersion: eventing.knative.dev/v1alpha1
kind: RabbitmqBrokerConfig
name: <rabbitmq-broker-config-name>
```
Where `<rabbitmq-broker-config-name>` is the name you gave your RabbitMQBrokerConfig in the step above.
1. Apply the YAML file by running the command:
```bash
kubectl apply -f <filename>
```
Where `<filename>` is the name of the file you created in the previous step.
## Configure message ordering
By default, Triggers will consume messages one at a time to preserve ordering. If ordering of events isn't important and higher performance is desired, you can configure this by using the
`parallelism` annotation. Setting `parallelism` to `n` creates `n` workers for the Trigger that will all consume messages in parallel.
The following YAML shows an example of a Trigger with parallelism set to `10`:
```yaml
apiVersion: eventing.knative.dev/v1
kind: Trigger
metadata:
name: high-throughput-trigger
annotations:
rabbitmq.eventing.knative.dev/parallelism: "10"
...
```
## Additional information
- For more samples visit the [`eventing-rabbitmq` Github repository samples directory](https://github.com/knative-extensions/eventing-rabbitmq/tree/main/samples)
- To report a bug or request a feature, open an issue in the [`eventing-rabbitmq` Github repository](https://github.com/knative-extensions/eventing-rabbitmq).

View File

@ -37,6 +37,7 @@ All Sources are part of the `sources` category.
| [GitLab](https://github.com/knative/docs/tree/main/code-samples/eventing/gitlab-source) | Beta | Knative | Registers for events of the specified types on the specified GitLab repository, and brings those events into Knative. The GitLabSource creates a webhooks for specified [event types](https://docs.gitlab.com/ee/user/project/integrations/webhooks.html#events), listens for incoming events, and passes them to a consumer. See the [GitLab Source](https://github.com/knative/docs/tree/main/code-samples/eventing/gitlab-source) example for more details. |
| [KogitoSource](https://github.com/knative-extensions/eventing-kogito) | Alpha | Knative | An implementation of the [Kogito Runtime](https://docs.jboss.org/kogito/release/latest/html_single/#proc-kogito-deploying-on-kubernetes_kogito-deploying-on-openshift) custom resource managed by the [Kogito Operator](https://github.com/kiegroup/kogito-operator). |
| [PingSource](ping-source/README.md) | Stable | Knative | Produces events with a fixed payload on a specified [Cron](https://en.wikipedia.org/wiki/Cron) schedule. See the [Ping Source](ping-source/README.md) example for more details. |
| [RabbitMQ](https://github.com/knative-extensions/eventing-rabbitmq) | Stable | Knative | Brings [RabbitMQ](https://www.rabbitmq.com/) messages into Knative.
[RedisSource](https://github.com/knative-extensions/eventing-redis/tree/{{version}}/source) | Alpha | Knative | Brings Redis Stream into Knative.
| [SinkBinding](../custom-event-source/sinkbinding/README.md) | Stable | Knative | The SinkBinding can be used to author new event sources using any of the familiar compute abstractions that Kubernetes makes available (e.g. Deployment, Job, DaemonSet, StatefulSet), or Knative abstractions (e.g. Service, Configuration). SinkBinding provides a framework for injecting `K_SINK` (destination address) and `K_CE_OVERRIDES` (JSON cloudevents attributes) environment variables into any Kubernetes resource which has a `spec.template` that looks like a Pod (aka PodSpecable). See the [SinkBinding](../custom-event-source/sinkbinding/README.md) example for more details. |

View File

@ -0,0 +1,132 @@
# Creating a RabbitMQSource
![stage](https://img.shields.io/badge/Stage-stable-green?style=flat-square)
![version](https://img.shields.io/badge/API_Version-v1alpha1-red?style=flat-square)
This topic describes how to create a RabbitMQSource.
## Prerequisites
1. You have installed [Knative Eventing](../../../install/yaml-install/eventing/install-eventing-with-yaml.md)
1. You have installed [CertManager v1.5.4](https://github.com/jetstack/cert-manager/releases/tag/v1.5.4) - easiest integration with RabbitMQ Messaging Topology Operator
1. You have installed [RabbitMQ Messaging Topology Operator](https://github.com/rabbitmq/messaging-topology-operator) - our recommendation is [latest release](https://github.com/rabbitmq/messaging-topology-operator/releases/latest) with CertManager
1. A working RabbitMQ Instance, we recommend to create one Using the [RabbitMQ Cluster Operator](https://github.com/rabbitmq/cluster-operator).
For more information about configuring the `RabbitmqCluster` CRD, see the [RabbitMQ website](https://www.rabbitmq.com/kubernetes/operator/using-operator.html)
## Install the RabbitMQ controller
1. Install the RabbitMQSource controller by running the command:
```bash
kubectl apply -f {{ artifact(org="knative-extensions", repo="eventing-rabbitmq", file="rabbitmq-source.yaml") }}
```
1. Verify that `rabbitmq-controller-manager` and `rabbitmq-webhook` are running:
```bash
kubectl get deployments.apps -n knative-sources
```
Example output:
```{ .bash .no-copy }
NAME READY UP-TO-DATE AVAILABLE AGE
rabbitmq-controller-manager 1/1 1 1 3s
rabbitmq-webhook 1/1 1 1 4s
```
{% include "event-display.md" %}
## Create a RabbitMQSource object
1. Create a YAML file using the following template:
```yaml
apiVersion: sources.knative.dev/v1alpha1
kind: RabbitmqSource
metadata:
name: <source-name>
spec:
rabbitmqClusterReference:
# Configure name if a RabbitMQ Cluster Operator is being used.
name: <cluster-name>
# Configure connectionSecret if an external RabbitMQ cluster is being used.
connectionSecret:
name: rabbitmq-secret-credentials
rabbitmqResourcesConfig:
parallelism: 10
exchangeName: "eventing-rabbitmq-source"
queueName: "eventing-rabbitmq-source"
delivery:
retry: 5
backoffPolicy: "linear"
backoffDelay: "PT1S"
sink:
ref:
apiVersion: serving.knative.dev/v1
kind: Service
name: event-display
```
Where:
- `<source-name>` is the name you want for your RabbitMQSource object.
- `<cluster-name>` is the name of the RabbitMQ cluster you created earlier.
!!! note
You cannot set `name` and `connectionSecret` at the same time, since `name` is for a RabbitMQ Cluster Operator instance running in the same cluster as the Source, and `connectionSecret` is for an external RabbitMQ server.
1. Apply the YAML file by running the command:
```bash
kubectl apply -f <filename>
```
Where `<filename>` is the name of the file you created in the previous step.
### Verify
Check the event-display Service to see if it is receiving events.
It might take a while for the Source to start sending events to the Sink.
```sh
kubectl -l='serving.knative.dev/service=event-display' logs -c user-container
☁️ cloudevents.Event
Context Attributes,
specversion: 1.0
type: dev.knative.rabbitmq.event
source: /apis/v1/namespaces/default/rabbitmqsources/<source-name>
subject: f147099d-c64d-41f7-b8eb-a2e53b228349
id: f147099d-c64d-41f7-b8eb-a2e53b228349
time: 2021-12-16T20:11:39.052276498Z
datacontenttype: application/json
Data,
{
...
Random Data
...
}
```
### Cleanup
1. Delete the RabbitMQSource:
```sh
kubectl delete -f <source-yaml-filename>
```
1. Delete the RabbitMQ credentials secret:
```sh
kubectl delete -f <secret-yaml-filename>
```
1. Delete the event display Service:
```sh
kubectl delete -f <service-yaml-filename>
```
## Additional information
- For more samples visit the [`eventing-rabbitmq` Github repository samples directory](https://github.com/knative-extensions/eventing-rabbitmq/tree/main/samples)
- To report a bug or request a feature, open an issue in the [`eventing-rabbitmq` Github repository](https://github.com/knative-extensions/eventing-rabbitmq).

View File

@ -218,6 +218,14 @@ see how you can configure Knative Eventing with different event sources:
kn operator enable eventing-source --kafka --namespace knative-eventing
```
=== "RabbitMQ"
1. To install the eventing source RabbitMQ, run the following command:
```bash
kn operator enable eventing-source --rabbitmq --namespace knative-eventing
```
=== "Redis"
1. To install the eventing source Redis, run the following command:

View File

@ -526,6 +526,33 @@ see how you can configure Knative Eventing with different event sources:
Where `<filename>` is the name of the file you created in the previous step.
=== "RabbitMQ"
To configure Knative Eventing to install RabbitMQ as the event source,
1. Add `spec.source.rabbitmq` to your Eventing CR YAML file as follows:
```yaml
apiVersion: operator.knative.dev/v1beta1
kind: KnativeEventing
metadata:
name: knative-eventing
namespace: knative-eventing
spec:
# ...
source:
rabbitmq:
enabled: true
```
1. Apply the YAML file by running the command:
```bash
kubectl apply -f <filename>.yaml
```
Where `<filename>` is the name of the file you created in the previous step.
=== "Redis"
To configure Knative Eventing to install Redis as the event source:

View File

@ -200,6 +200,13 @@ Follow the procedure for the Broker of your choice:
!!! warning
In order to use the KafkaChannel, ensure that it is installed on your cluster, as mentioned previously in this topic.
=== "RabbitMQ Broker"
* Install the RabbitMQ Broker by following the instructions in the
[RabbitMQ Knative Eventing Broker README](https://github.com/knative-extensions/eventing-rabbitmq/tree/main/broker).
For more information, see the [RabbitMQ Broker](https://github.com/knative-extensions/eventing-rabbitmq) in GitHub.
## Install optional Eventing extensions
The following tabs expand to show instructions for installing each Eventing extension.