Skip to content

Commit

Permalink
Revert "drop eventing-rabbitmq (knative#5861)" (knative#5910)
Browse files Browse the repository at this point in the history
This reverts commit a0d137b.
  • Loading branch information
ikavgo authored Mar 15, 2024
1 parent 5e09459 commit d8d932b
Show file tree
Hide file tree
Showing 11 changed files with 299 additions and 2 deletions.
2 changes: 2 additions & 0 deletions config/nav.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand Down
1 change: 1 addition & 0 deletions config/redirects.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion docs/eventing/brokers/broker-developer-config-options.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).
5 changes: 5 additions & 0 deletions docs/eventing/brokers/broker-types/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
114 changes: 114 additions & 0 deletions docs/eventing/brokers/broker-types/rabbitmq-broker/README.md
Original file line number Diff line number Diff line change
@@ -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).
1 change: 1 addition & 0 deletions docs/eventing/sources/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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. |

Expand Down
132 changes: 132 additions & 0 deletions docs/eventing/sources/rabbitmq-source/README.md
Original file line number Diff line number Diff line change
@@ -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).
8 changes: 8 additions & 0 deletions docs/install/operator/knative-with-operator-cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
27 changes: 27 additions & 0 deletions docs/install/operator/knative-with-operators.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit d8d932b

Please sign in to comment.