RabbitMQ Source docs (#5137)

* finished rabbitmq source readme and corrected some minor rabbitmq broker typos

* fixed code style

* Update docs/eventing/sources/rabbitmq-source/README.md

Co-authored-by: Samia Nneji <snneji@vmware.com>

* Update docs/eventing/broker/rabbitmq-broker/README.md

Co-authored-by: Samia Nneji <snneji@vmware.com>

* Update docs/eventing/sources/rabbitmq-source/README.md

Co-authored-by: Samia Nneji <snneji@vmware.com>

* Update docs/eventing/sources/rabbitmq-source/README.md

Co-authored-by: Samia Nneji <snneji@vmware.com>

* fixed pr comments

* Update docs/eventing/broker/rabbitmq-broker/README.md

Co-authored-by: Ashleigh Brennan <abrennan@redhat.com>

* Update docs/eventing/sources/rabbitmq-source/README.md

Co-authored-by: Ashleigh Brennan <abrennan@redhat.com>

* Update docs/eventing/sources/rabbitmq-source/README.md

Co-authored-by: Ashleigh Brennan <abrennan@redhat.com>

* removed duplicated sections + created snippet for service section + removed external cluster docs and pointed to the right pages that explain so

* added whitespace in prereqs

* removed trailing whitespace

* Update docs/eventing/broker/rabbitmq-broker/README.md

* Update docs/eventing/broker/rabbitmq-broker/README.md

* Update docs/eventing/broker/rabbitmq-broker/README.md

* Update docs/eventing/broker/rabbitmq-broker/README.md

* Update docs/eventing/broker/rabbitmq-broker/README.md

Co-authored-by: Samia Nneji <snneji@vmware.com>
Co-authored-by: Ashleigh Brennan <abrennan@redhat.com>
This commit is contained in:
Gabriel Freites 2022-08-02 13:27:23 -05:00 committed by GitHub
parent 14b43e01bf
commit afc2015250
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 192 additions and 54 deletions

View File

@ -156,6 +156,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
# BYO event source
- Custom event sources:
- Custom event sources overview: eventing/custom-event-source/README.md

View File

@ -4,12 +4,10 @@ This topic describes how to create a RabbitMQ Broker.
## Prerequisites
To use the RabbitMQ Broker, you must have the following installed:
1. [Knative Eventing](../../../install/yaml-install/eventing/install-eventing-with-yaml.md)
1. [RabbitMQ Cluster Operator](https://github.com/rabbitmq/cluster-operator) - our recommendation is [latest release](https://github.com/rabbitmq/cluster-operator/releases/latest)
1. [CertManager v1.5.4](https://github.com/jetstack/cert-manager/releases/tag/v1.5.4) - easiest integration with RabbitMQ Messaging Topology Operator
1. [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 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. 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
@ -35,50 +33,7 @@ To use the RabbitMQ Broker, you must have the following installed:
rabbitmq-broker-webhook 1/1 1 1 4s
```
## Create a RabbitMQ cluster
1. Deploy a RabbitMQ cluster:
1. Create a YAML file using the following template:
```yaml
apiVersion: rabbitmq.com/v1beta1
kind: RabbitmqCluster
metadata:
name: <cluster-name>
annotations:
# A single RabbitMQ cluster per Knative Eventing installation
rabbitmq.com/topology-allowed-namespaces: "*"
```
Where `<cluster-name>` is the name you want for your RabbitMQ cluster,
for example, `rabbitmq`.
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.
1. Wait for the cluster to become ready. When the cluster is ready, `ALLREPLICASREADY`
will be `true` in the output of the following command:
```bash
kubectl get rmq <cluster-name>
```
Where `<cluster-name>` is the name you gave your cluster in the step above.
Example output:
```{ .bash .no-copy }
NAME ALLREPLICASREADY RECONCILESUCCESS AGE
rabbitmq True True 38s
```
For more information about configuring the `RabbitmqCluster` CRD, see the
[RabbitMQ website](https://www.rabbitmq.com/kubernetes/operator/using-operator.html).
## Create a RabbitMQ broker config object
## Create a RabbitMQBrokerConfig object
1. Create a YAML file using the following template:
```yaml
@ -88,10 +43,20 @@ For more information about configuring the `RabbitmqCluster` CRD, see the
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 <cluster-name> is the name of the RabbitMQ cluster created in the step above.
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:
@ -100,7 +65,7 @@ For more information about configuring the `RabbitmqCluster` CRD, see the
```
Where `<filename>` is the name of the file you created in the previous step.
## Create a RabbitMQ broker object
## Create a RabbitMQBroker object
1. Create a YAML file using the following template:
@ -117,7 +82,7 @@ For more information about configuring the `RabbitmqCluster` CRD, see the
kind: RabbitmqBrokerConfig
name: <rabbitmq-broker-config-name>
```
Where `<rabbitmq-broker-config-name>` is the name you gave your RabbitMQ Broker config in the step above.
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:
@ -144,4 +109,5 @@ metadata:
## Additional information
To report a bug or request a feature, open an issue in the [eventing-rabbitmq repository](https://github.com/knative-sandbox/eventing-rabbitmq).
- For more samples visit the [`eventing-rabbitmq` Github repository samples directory](https://github.com/knative-sandbox/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-sandbox/eventing-rabbitmq).

View File

@ -0,0 +1,129 @@
# Creating a RabbitMQSource
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-sandbox", 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-sandbox/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-sandbox/eventing-rabbitmq).

View File

@ -0,0 +1,42 @@
## Create a Service
1. Create the `event-display` Service as a YAML file:
```yaml
apiVersion: serving.knative.dev/v1
kind: Service
metadata:
name: event-display
namespace: default
spec:
template:
spec:
containers:
- # This corresponds to
# https://github.com/knative/eventing/tree/main/cmd/event_display/main.go
image: gcr.io/knative-releases/knative.dev/eventing/cmd/event_display
```
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.
Example output:
```{ .bash .no-copy }
service.serving.knative.dev/event-display created
```
1. Ensure that the Service Pod is running, by running the command:
```bash
kubectl get pods
```
The Pod name is prefixed with `event-display`:
```{ .bash .no-copy }
NAME READY STATUS RESTARTS AGE
event-display-00001-deployment-5d5df6c7-gv2j4 2/2 Running 0 72s
```