Skip to content
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

Merged
merged 7 commits into from Jan 30, 2021

Conversation

evankanderson
Copy link
Contributor

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.

  • 📖 End user documentation
  • 📖 Moved contributor documentation to DEVELOPMENT.md

/kind documentation

Release Note

Added user-facing documentation for the RabbitMQ source

Docs

Will update the sources docs to point to this page once merged.

@knative-prow-robot knative-prow-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Jan 15, 2021
@google-cla google-cla bot added the cla: yes Indicates the PR's author has signed the CLA. label Jan 15, 2021
@codecov
Copy link

codecov bot commented Jan 15, 2021

Codecov Report

Merging #201 (25cc6a2) into master (abdfa85) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           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.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update abdfa85...25cc6a2. Read the comment docs.

@evankanderson
Copy link
Contributor Author

/assign @abrennan89 @n3wscott @lionelvillard

/hold

Want to give a chance to review and see if this provides the documentation level we expect before submitting.

@knative-prow-robot knative-prow-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jan 16, 2021

| `type` | `dev.knative.rabbitmq.event` |
| `source` | `/apis/v1/namespace/*$NS*/rabbitmqsources/*$NAME*#*$TOPIC*`
| `NS`, `NAME` and `TOPIC` are derived from the Source configuration.
Copy link
Contributor Author

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:
Copy link
Contributor Author

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.

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?

Copy link
Contributor Author

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.

Copy link
Contributor

@vaikas vaikas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!!

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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit s/alos/also/


=== Samples

(in CloudEvents JSON format):
Copy link
Contributor

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.

Copy link
Contributor Author

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

Comment on lines 6 to 8
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.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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.

Copy link
Contributor Author

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?)

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.


== Published Events

All messages received by the Source will be published with the following schema:
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done (lowercasing)


All messages received by the Source will be published with the following schema:

.Table Event Attributes

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
.Table Event Attributes
.Event attributes

Copy link
Contributor Author

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!

| `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.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
| `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` | `/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.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
| `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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

| `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.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
| `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.

| `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.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

toc::[]


== Published Events

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
== Published Events
== Published events

Copy link
Contributor Author

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?


=== Samples

(in CloudEvents JSON format):

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

}
----

== Creating and Managing Sources

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
== Creating and Managing Sources
== Creating and managing sources

Sentence case headings

Copy link
Contributor Author

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

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

Copy link
Contributor Author

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.

Comment on lines 84 to 85
Note that not all parameters need to be specified; unspecified parameters will be
defaulted false / empty.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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.

Copy link
Contributor Author

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 to false / or "" (empty string).

name: event-display
----

== Administration

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

Comment on lines 118 to 122
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.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Comment on lines 126 to 131
Install from the nightly build:

[source,sh]
----
kubectl apply -f https://storage.googleapis.com/knative-nightly/eventing-rabbitmq/latest/rabbitmq-source.yaml
----

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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
----

Comment on lines 135 to 136
The standard `config-observability`, `config-logging` et al ConfigMaps may be
used to manage the logging and metrics configuration.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No et al please :)

Suggested change
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.

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?

Copy link
Contributor Author

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).

Copy link

@abrennan89 abrennan89 left a 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.

@evankanderson
Copy link
Contributor Author

@evankanderson evankanderson force-pushed the gold-star branch 4 times, most recently from ec0760c to 487d5b8 Compare January 26, 2021 23:03
Copy link

@abrennan89 abrennan89 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@knative-prow-robot knative-prow-robot added the lgtm Indicates that a PR is ready to be merged. label Jan 27, 2021

== Published events

All messages received by the source are published with the following schema:
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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:

Comment on lines +6 to +8
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.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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.

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?

Copy link
Contributor Author

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.

Comment on lines +17 to +30
.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.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
.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.

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

Copy link
Contributor Author

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
=== Samples
=== Example

Let's maybe change this in the template to example rather than samples

Copy link
Contributor Author

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?

Comment on lines +34 to +35
For a message published with the payload "Hello rabbitmq!", for example with
https://www.rabbitmq.com/management-cli.html[`rabbitmqadmin`]:

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"?

Copy link
Contributor Author

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.

Comment on lines +93 to +100
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
----

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

Copy link
Contributor Author

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.

@evankanderson
Copy link
Contributor Author

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

@knative-prow-robot knative-prow-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jan 28, 2021
Copy link

@n3wscott n3wscott left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm
/approve

@knative-prow-robot
Copy link

[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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@knative-prow-robot knative-prow-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jan 30, 2021
@n3wscott
Copy link

We will have to add a linter to knobots that knows about asciidoc as this gains traction.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cla: yes Indicates the PR's author has signed the CLA. kind/documentation lgtm Indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants