Skip to content

Conversation

@axsaucedo
Copy link
Contributor

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.

@googlebot googlebot added the cla: yes Indicates the PR's author has signed the CLA. label Mar 11, 2020
@knative-prow-robot
Copy link
Contributor

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 /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

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.

@knative-prow-robot knative-prow-robot added needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Mar 11, 2020
@axsaucedo axsaucedo force-pushed the added_knative_eventing_example branch from 42ffb13 to 68ddf1b Compare March 11, 2020 15:14
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>
@axsaucedo
Copy link
Contributor Author

Thanks @mattmoor - I've approved all requested changes

@carieshmarie carieshmarie added the ok-to-test Indicates a non-member PR verified by an org member that is safe to test. label Mar 13, 2020
@axsaucedo
Copy link
Contributor Author

@mattmoor just wanted to see if there are still any other changes required

@mattmoor
Copy link
Member

Ha, sorry those comments were all automated.

/assign @n3wscott

I think @n3wscott is probably a good set of eyeballs for this.

@axsaucedo
Copy link
Contributor Author

Haha ok thanks for the heads up @mattmoor! @n3wscott let me know if there are any questions to merge

Copy link
Member

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

@axsaucedo
Copy link
Contributor Author

Ok sounds good - @abrennan89 let me know if there are any changes required

Copy link
Contributor

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

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

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

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

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

Copy link
Contributor

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

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

Copy link
Contributor

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

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

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

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

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

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.

Copy link
Contributor

Choose a reason for hiding this comment

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

Use "through", not "via"

@axsaucedo
Copy link
Contributor Author

@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 requirements.txt issue

@evankanderson
Copy link
Member

/ok-to-test

@knative-prow-robot knative-prow-robot removed the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Apr 10, 2020
@abrennan89
Copy link
Contributor

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

@abrennan89 abrennan89 mentioned this pull request Jun 11, 2020
3 tasks
@abrennan89
Copy link
Contributor

@axsaucedo is this PR still WIP?

@axsaucedo
Copy link
Contributor Author

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

@abrennan89
Copy link
Contributor

/lgtm
/approve

@knative-prow-robot knative-prow-robot added the lgtm Indicates that a PR is ready to be merged. label Jul 28, 2020
@knative-prow-robot
Copy link
Contributor

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

@knative-prow-robot knative-prow-robot merged commit 0b86a4a into knative:master Jul 28, 2020
@vmexalien
Copy link
Contributor

working on this as part of #2704

@vmexalien
Copy link
Contributor

vmexalien commented Sep 28, 2020

line 148 - add comma for readability sample folder), you're ready
line 150 - reword Use Docker to build a container from the sample code.
line 162 - correct capitalization for consistency Docker Hub
line 170 - edit for readability; The above command
line 174 - another reference to "it"; The command deployed and change names to named

(these will be added in a new issue based on best practice)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla: yes Indicates the PR's author has signed the CLA. lgtm Indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. 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.

9 participants