New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement best-practice Source documentation #201
Implement best-practice Source documentation #201
Conversation
Codecov Report
@@ Coverage Diff @@
## master #201 +/- ##
=======================================
Coverage 72.01% 72.01%
=======================================
Files 28 28
Lines 1451 1451
=======================================
Hits 1045 1045
Misses 324 324
Partials 82 82 Continue to review full report at Codecov.
|
/assign @abrennan89 @n3wscott @lionelvillard /hold Want to give a chance to review and see if this provides the documentation level we expect before submitting. |
source/README.adoc
Outdated
|
||
| `type` | `dev.knative.rabbitmq.event` | | ||
| `source` | `/apis/v1/namespace/*$NS*/rabbitmqsources/*$NAME*#*$TOPIC*` | ||
| `NS`, `NAME` and `TOPIC` are derived from the Source configuration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One neat thing about Asciidoc is that I can split a table across multiple lines without having to pull out the <tr>
tags.
kind: RabbitmqSource | ||
metadata: | ||
name: rabbitmq-source | ||
spec: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that I omit fields from the sample deliberately, to show what sort of arguments are required vs optional.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd maybe put something like <optional>
or add call outs for optional fields?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done, not sure if that's what you were thinking of.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!!
source/README.adoc
Outdated
you can use | ||
https://www.rabbitmq.com/kubernetes/operator/operator-overview.html[the RabbitMQ | ||
operator] to set up a RabbitMQ installation. An understanding of RabbitMQ | ||
concepts like Brokers, Exchanges, and Queues will alos be helpful. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit s/alos/also/
source/README.adoc
Outdated
|
||
=== Samples | ||
|
||
(in CloudEvents JSON format): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since there's if/else in the payload (for example, subject is empty string if no message ID is present), I wonder if we should also include a RabbitMQ message as input and then showing how it gets transformed into a CloudEvent.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interestingly, it seems like the ability to publish a rabbitmq event from the command line is harder than I'd expect. I found a rabbitmqadmin
here that can do it: https://www.rabbitmq.com/management-cli.html
source/README.adoc
Outdated
The RabbitMQ source translates messages on a RabbitMQ exchange to CloudEvents | ||
over HTTP for use with Knative Eventing. The Source can bind to an existing | ||
exchange or create a new one, as needed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The RabbitMQ source translates messages on a RabbitMQ exchange to CloudEvents | |
over HTTP for use with Knative Eventing. The Source can bind to an existing | |
exchange or create a new one, as needed. | |
The RabbitMQ source translates messages from a RabbitMQ exchange to CloudEvents, which can then be used with Knative Eventing over HTTP. | |
The source can bind to an existing RabbitMQ exchange, or create a new exchange if required. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(This is suggesting sentence-per-line?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you look at it it's actually suggestions for slightly different wording and to make it more consistent, but yeah I'd format this as suggested to make it more readable. Up to you though.
source/README.adoc
Outdated
|
||
== Published Events | ||
|
||
All messages received by the Source will be published with the following schema: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All messages received by the Source will be published with the following schema: | |
All messages received by the source are published with the following schema: |
Use lowercase consistently for source IMHO
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done (lowercasing)
source/README.adoc
Outdated
|
||
All messages received by the Source will be published with the following schema: | ||
|
||
.Table Event Attributes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.Table Event Attributes | |
.Event attributes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ha! I mis-read the asciidoc cheat-sheet. Thanks!
source/README.adoc
Outdated
| `type` | `dev.knative.rabbitmq.event` | | ||
| `source` | `/apis/v1/namespace/*$NS*/rabbitmqsources/*$NAME*#*$TOPIC*` | ||
| `NS`, `NAME` and `TOPIC` are derived from the Source configuration. | ||
| `id` | a unique id | This uses the MessageId if available, and a UUID otherwise. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| `id` | a unique id | This uses the MessageId if available, and a UUID otherwise. | |
| `id` | A unique ID | This uses the `MessageId` if available, and a UUID otherwise. |
source/README.adoc
Outdated
| `source` | `/apis/v1/namespace/*$NS*/rabbitmqsources/*$NAME*#*$TOPIC*` | ||
| `NS`, `NAME` and `TOPIC` are derived from the Source configuration. | ||
| `id` | a unique id | This uses the MessageId if available, and a UUID otherwise. | ||
| `subject` | the message's id | empty string if no message ID is present. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| `subject` | the message's id | empty string if no message ID is present. | |
| `subject` | The ID of the message | Empty string if no message ID is present. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
source/README.adoc
Outdated
| `id` | a unique id | This uses the MessageId if available, and a UUID otherwise. | ||
| `subject` | the message's id | empty string if no message ID is present. | ||
| `datacontenttype` | `application/json` | Currently static. | ||
| `key` | the message's id | empty string if no message ID is present. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| `key` | the message's id | empty string if no message ID is present. | |
| `key` | The ID of the message | Empty string if no message ID is present. |
source/README.adoc
Outdated
| `key` | the message's id | empty string if no message ID is present. | ||
|=== | ||
|
||
The event's payload will be set to the data content of the message. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The event's payload will be set to the data content of the message. | |
The payload of the event is set to the data content of the message. |
Use present tense instead of future consistently, and avoid possessives, e.g. "event's" where possible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
source/README.adoc
Outdated
toc::[] | ||
|
||
|
||
== Published Events |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
== Published Events | |
== Published events |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be title case?
source/README.adoc
Outdated
|
||
=== Samples | ||
|
||
(in CloudEvents JSON format): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoid unnecessary parenthesis, suggest:
.CloudEvent JSON format
source/README.adoc
Outdated
} | ||
---- | ||
|
||
== Creating and Managing Sources |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
== Creating and Managing Sources | |
== Creating and managing sources |
Sentence case headings
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
---- | ||
|
||
== Creating and Managing Sources | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like there's an extra line here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a thin rule after each H2 section -- you can see the same thing at "Administration" and "Published events". Note that both of those have text immediately following, rather than a table.
source/README.adoc
Outdated
Note that not all parameters need to be specified; unspecified parameters will be | ||
defaulted false / empty. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that not all parameters need to be specified; unspecified parameters will be | |
defaulted false / empty. | |
Note that not all parameters must be specified. | |
Unspecified optional parameters default to `false` or empty. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I rewrote this a little more:
Note that many parameters do not need to be specified. Unspecified optional
parameters will be defaulted tofalse
/ or""
(empty string).
name: event-display | ||
---- | ||
|
||
== Administration |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure I like this in the one file, I think the idea was more that there would be an introduction "guide" with conceptual info etc and then an Admin guide with all of this info as a separate page. Also, I would avoid having any heading that is directly followed by another heading with nothing between; there should be some paragraph or something here explaining what this admin section is
source/README.adoc
Outdated
You will need a https://www.rabbitmq.com/[RabbitMQ] installation. On Kubernetes, | ||
you can use | ||
https://www.rabbitmq.com/kubernetes/operator/operator-overview.html[the RabbitMQ | ||
operator] to set up a RabbitMQ installation. An understanding of RabbitMQ | ||
concepts like Brokers, Exchanges, and Queues will alos be helpful. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You will need a https://www.rabbitmq.com/[RabbitMQ] installation. On Kubernetes, | |
you can use | |
https://www.rabbitmq.com/kubernetes/operator/operator-overview.html[the RabbitMQ | |
operator] to set up a RabbitMQ installation. An understanding of RabbitMQ | |
concepts like Brokers, Exchanges, and Queues will alos be helpful. | |
* A https://www.rabbitmq.com/[RabbitMQ] installation. On Kubernetes, you can use https://www.rabbitmq.com/kubernetes/operator/operator-overview.html[the RabbitMQ | |
operator] to set up a RabbitMQ installation. | |
* An understanding of RabbitMQ concepts like Brokers, Exchanges, and Queues. |
Heading prerequisites negates need for bits like "you will need", and the "helpful" bit etc should be removed - something's either needed and should be listed here or isn't IMHO
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
source/README.adoc
Outdated
Install from the nightly build: | ||
|
||
[source,sh] | ||
---- | ||
kubectl apply -f https://storage.googleapis.com/knative-nightly/eventing-rabbitmq/latest/rabbitmq-source.yaml | ||
---- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Install from the nightly build: | |
[source,sh] | |
---- | |
kubectl apply -f https://storage.googleapis.com/knative-nightly/eventing-rabbitmq/latest/rabbitmq-source.yaml | |
---- | |
* Install the source from the nightly build: | |
[source,sh] | |
---- | |
kubectl apply -f https://storage.googleapis.com/knative-nightly/eventing-rabbitmq/latest/rabbitmq-source.yaml | |
---- |
source/README.adoc
Outdated
The standard `config-observability`, `config-logging` et al ConfigMaps may be | ||
used to manage the logging and metrics configuration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No et al please :)
The standard `config-observability`, `config-logging` et al ConfigMaps may be | |
used to manage the logging and metrics configuration. | |
You can use the standard `config-observability` and `config-logging` ConfigMaps to manage the logging and metrics configuration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some samples or links here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure we have good ones right now, let me link the bad ones (the configmaps in the Eventing repo).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So far looks pretty good, added some minor suggestions. Not 100% happy with the layout re headings etc but we can revisit as part of evolving the template.
Updated. You can preview here: https://github.com/evankanderson/eventing-rabbitmq/tree/gold-star/source |
ec0760c
to
487d5b8
Compare
487d5b8
to
25cc6a2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
|
||
== Published events | ||
|
||
All messages received by the source are published with the following schema: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All messages received by the source are published with the following schema: | |
All messages received by the RabbitMQ source are published with the following schema: |
The RabbitMQ source translates messages on a RabbitMQ exchange to CloudEvents, | ||
which can then be used with Knative Eventing over HTTP. The source can bind to | ||
an existing RabbitMQ exchange, or create a new exchange if required. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The RabbitMQ source translates messages on a RabbitMQ exchange to CloudEvents, | |
which can then be used with Knative Eventing over HTTP. The source can bind to | |
an existing RabbitMQ exchange, or create a new exchange if required. | |
The RabbitMQ source translates messages on a RabbitMQ exchange to CloudEvents, | |
which can then be used with Knative Eventing over HTTP. The RabbitMQ source can bind to | |
an existing RabbitMQ exchange, or create a new exchange if required. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we clarify what's meant here by "can then be used with Knative Eventing over HTTP" - used with how?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added more detail linking to the eventing Addressable concept.
.Event attributes | ||
|=== | ||
| Attribute | Value | Notes | ||
|
||
| `type` | `dev.knative.rabbitmq.event` | | ||
| `source` | `/apis/v1/namespace/*$NS*/rabbitmqsources/*$NAME*#*$TOPIC*` | ||
| `NS`, `NAME` and `TOPIC` are derived from the source configuration | ||
| `id` | A unique ID | This uses the `MessageId` if available, and a UUID otherwise | ||
| `subject` | The ID of the message | Empty string if no message ID is present | ||
| `datacontenttype` | `application/json` | Currently static | ||
| `key` | The ID of the message | Empty string if no message ID is present | ||
|=== | ||
|
||
The payload of the event is set to the data content of the message. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.Event attributes | |
|=== | |
| Attribute | Value | Notes | |
| `type` | `dev.knative.rabbitmq.event` | | |
| `source` | `/apis/v1/namespace/*$NS*/rabbitmqsources/*$NAME*#*$TOPIC*` | |
| `NS`, `NAME` and `TOPIC` are derived from the source configuration | |
| `id` | A unique ID | This uses the `MessageId` if available, and a UUID otherwise | |
| `subject` | The ID of the message | Empty string if no message ID is present | |
| `datacontenttype` | `application/json` | Currently static | |
| `key` | The ID of the message | Empty string if no message ID is present | |
|=== | |
The payload of the event is set to the data content of the message. | |
[source,json] | |
---- | |
{ | |
"specversion": "1.0", | |
"type": "dev.knative.rabbitmq.event", | |
"source": "/apis/v1/namespaces/<namespace>/rabbitmqsources/<name>#<topic>", <1> | |
"id": "<unique_ID>", <2> | |
"time": "<timestamp>", | |
"subject": "", <3> | |
"datacontenttype": "application/json", | |
"key": "", <4> | |
"data": "Hello rabbitmq!" <5> | |
} | |
---- | |
<1> `<namespace>`, `<name>` and `<topic>` are derived from the source configuration. | |
<2> Uses the `MessageId` if available, and a UUID otherwise. | |
<3> The ID of the message, or an empty string if no message ID is present. | |
<4> The ID of the message, or an empty string if no message ID is present. | |
<5> The payload of the event is set to the data content of the message. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than the table, I'd suggest showing the actual schema as an example like this, where there are callouts describing any variables
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So no table at all? I have the actual schema in the example, though with values filled in.
|
||
The payload of the event is set to the data content of the message. | ||
|
||
=== Samples |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
=== Samples | |
=== Example |
Let's maybe change this in the template to example rather than samples
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RabbitMQ only has one type of event, but that might not be true of all sources. Do we still want an example in addition to the sample schema format instead of event attributes?
For a message published with the payload "Hello rabbitmq!", for example with | ||
https://www.rabbitmq.com/management-cli.html[`rabbitmqadmin`]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what does it mean here "with rabbitmqadmin
"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Using the rabbitmqadmin
tool to publish a message."
You can also send the same message by writing python, java, etc code, but having a CLI makes it easy to test out if things are working.
You will need a Kubernetes Secret to hold the RabbitMQ username and | ||
password. The following command is one way to create a secret with the username | ||
`rabbit-user` and the password taken from the `/tmp/password` file. | ||
---- | ||
kubectl create secret generic rabbitmq-secret \ | ||
--from-literal=user=rabbit-user \ | ||
--from-file=password=/tmp/password | ||
---- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is buried for something that looks important, I don't like the structure of this "Creating and managing sources" section, because a user will come here looking for a clear procedure and instead it's a lot of confusing reference type info
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Each source needs some credentials (username/password) for connecting to the RabbitMQ instance. Something along these lines will be pretty typical.
I can change the second sentence to "with kubectl
:" or "For example:"; there are a lot of different ways the secret could be populated, and we've got this in here simply to show an easy way to kick the tires.
I tried out a different arrangement here, but I think Ashleigh is also going to try out something more dramatic in the medium-term in parallel to this. Feel free to approve this PR or #217 as preferred. /hold cancel |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
/approve
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: abrennan89, evankanderson, n3wscott The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
We will have to add a linter to knobots that knows about asciidoc as this gains traction. |
See https://docs.google.com/document/d/1UKyjA0nfNyvDIiF86YEeskV5_pZ_kP07AoDHrDUq8Xo/edit#heading=h.los3tdhhh2fb for the general template, though I took a few liberties as I was actually writing it up.
Changes
Adds end-user documentation for the RabbitMQ Source.
DEVELOPMENT.md
/kind documentation
Release Note
Docs