-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Added Python Example for Knative Eventing #2299
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
Added Python Example for Knative Eventing #2299
Conversation
|
Hi @axsaucedo. Thanks for your PR. I'm waiting for a knative member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
42ffb13 to
68ddf1b
Compare
Co-Authored-By: Matt Moore <mattmoor@vmware.com>
Co-Authored-By: Matt Moore <mattmoor@vmware.com>
Co-Authored-By: Matt Moore <mattmoor@vmware.com>
Co-Authored-By: Matt Moore <mattmoor@vmware.com>
|
Thanks @mattmoor - I've approved all requested changes |
|
@mattmoor just wanted to see if there are still any other changes required |
evankanderson
left a comment
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.
/assign @abrennan89
If she's still available to take a pass over this as it's a complete new doc, and I don't recall where our best practices have stabilized.
|
Ok sounds good - @abrennan89 let me know if there are any changes required |
abrennan89
left a comment
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 initial review comments, mostly around tone and structure.
| @@ -0,0 +1,338 @@ | |||
| A simple web app written in Python that you can use to test knative eventing. It shows how to consume a [CloudEvent](https://cloudevents.io/) in Knative eventing, and optionally how to respond back with another CloudEvent in the http response, by adding the Cloud Eventing headers outlined in the Cloud Events standard definition. | |||
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 guide provides an example of a simple web application, written in Python, that can be used to test Knative Eventing."
We capitalize 'Eventing' throughout the site, so please capitalize all instances. @carieshmarie do we have any official guidelines for Knative about capitalization?
| @@ -0,0 +1,338 @@ | |||
| A simple web app written in Python that you can use to test knative eventing. It shows how to consume a [CloudEvent](https://cloudevents.io/) in Knative eventing, and optionally how to respond back with another CloudEvent in the http response, by adding the Cloud Eventing headers outlined in the Cloud Events standard definition. | |||
|
|
|||
| We will deploy the app as a [Kubernetes Deployment](https://kubernetes.io/docs/concepts/workloads/controllers/deployment/) along with a [Kubernetes Service](https://kubernetes.io/docs/concepts/services-networking/service/). | |||
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 example deploys..."
Don't use language like "we will" - see https://developers.google.com/style/tone for guidance on tone.
| A simple web app written in Python that you can use to test knative eventing. It shows how to consume a [CloudEvent](https://cloudevents.io/) in Knative eventing, and optionally how to respond back with another CloudEvent in the http response, by adding the Cloud Eventing headers outlined in the Cloud Events standard definition. | ||
|
|
||
| We will deploy the app as a [Kubernetes Deployment](https://kubernetes.io/docs/concepts/workloads/controllers/deployment/) along with a [Kubernetes Service](https://kubernetes.io/docs/concepts/services-networking/service/). | ||
| However, you can also deploy the app as a [Knative Serving Service](../../../../serving/README.md). |
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.
Remove 'however'
| ``` | ||
|
|
||
| ## Before you begin | ||
|
|
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.
Add a line to say something like "To follow this example guide, you will need:"
Also, change "we'll use it"
I'd list the Docker Hub a/c as a separate point, e.g.
- A configured Docker Hub account to use as a container registry.
|
|
||
| ``` | ||
|
|
||
| 1. Add a requirements.txt file containing the following contents: |
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.
Where is this txt file added? Also, use backticks for literals? e.g. requirements.txt
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.
still need to determine where the requirements.txt file is added
| kubectl --namespace knative-samples get deployments helloworld-python | ||
| kubectl --namespace knative-samples get svc helloworld-python | ||
| ``` | ||
| 1. It created a Knative Eventing Trigger to route certain events to the helloworld-python application. Make sure that Ready=true |
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.
Again, what is 'it'? Please modify the structure of these steps as mentioned in previous comment.
| kubectl --namespace knative-samples get trigger helloworld-python | ||
| ``` | ||
| ## Send and verify CloudEvents | ||
| Once you have deployed the application and verified that the namespace, sample application and trigger are ready, let's send 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.
Once -> After
Let's -> you can
| Once you have deployed the application and verified that the namespace, sample application and trigger are ready, let's send a CloudEvent. | ||
|
|
||
| ### Send CloudEvent to the Broker | ||
| We can send an http request directly to the [Broker](../../../broker-trigger.md) with correct CloudEvent headers set. |
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 we.....
"You can...using the correct..."
| exit | ||
| ``` | ||
| ### Verify that event is received by helloworld-python app | ||
| Helloworld-python app logs the context and the msg of the above event, and replies back with another event. |
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.
msg -> message, do not abbreviate
"The...app"
| Play around with the CloudEvent attributes in the curl command and the trigger specification to understand how [Triggers work](../../../broker-trigger.md#trigger). | ||
|
|
||
| ## Verify reply from helloworld-python app | ||
| `helloworld-python` app replies back with an event of `type= dev.knative.samples.hifromknative`, and `source=knative/eventing/samples/hello-world`. This event enters the eventing mesh via the Broker and can be delivered to other services using a Trigger |
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.
Again, "The...app"
Also, be consistent when using backticks, formatting, capitalization for all naming. The app is referred to in different ways throughout the doc.
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.
Use "through", not "via"
|
@abrennan89 thank you for the comments! Before diving into changing them I just want to point out that the actual content/writing is almost exactly the same as the current Golang example. There's seems to be a lot of wording / tone specific changes required here, but just want to confirm for concistency as all the comments provided here apply to your existing Golang helloworld example https://knative.dev/docs/eventing/samples/helloworld/helloworld-go/ What would be the best way forward here? Would it make sense to update the consistency of writing once there is guidelines for terminology? I can for the meantime apply the changes specific to the example such as the |
|
/ok-to-test |
|
@axsaucedo I think having some sections as close to correct as we can for now is more important than trying to have consistency across everything. We're in the process of figuring out things like style guides / glossaries for docs, so they won't be consistent for a while, but we can start with small improvements like these 🙂 |
|
@axsaucedo is this PR still WIP? |
|
@abrennan89 sorry for the radio silence, I don't think I'll be able to get around this unfortunately, would still be worth haivng a python example tho - thanks for the comments tho @abrennan89! |
|
/lgtm |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: abrennan89, axsaucedo 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 |
|
working on this as part of #2704 |
|
line 148 - add comma for readability (these will be added in a new issue based on best practice) |
Fixes #issue-number or description of the problem the PR solves
Proposed Changes
Added Python Example for Knative Eventing
The example has the exact same contents than the go example.