fix eventing/samples/helloworld-python (#3682)

* fix helloworld-python

add note and annotations

fix link (#3679)

* fix helloworld-python (#3679)
This commit is contained in:
NovaHe 2021-06-08 00:28:48 +08:00 committed by GitHub
parent d1905300bd
commit 76e8f4e11a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 73 additions and 41 deletions

View File

@ -157,9 +157,13 @@ cd knative-docs/docs/eventing/samples/helloworld/helloworld-go
metadata:
name: default
namespace: knative-samples
annotations:
# Note: you can set the eventing.knative.dev/broker.class annotation to change the class of the broker.
# The default broker class is MTChannelBasedBroker, but Knative also supports use of the other class.
eventing.knative.dev/broker.class: MTChannelBasedBroker
spec: {}
---
# Helloworld-go app deploment
# Helloworld-go app deployment
apiVersion: apps/v1
kind: Deployment
metadata:
@ -303,7 +307,7 @@ with correct CloudEvent headers set.
-X POST \
-H "Ce-Id: 536808d3-88be-4077-9d7a-a3f162705f79" \
-H "Ce-Specversion: 1.0" \
-H "Ce-Type: dev.knative.samples.helloworld" \
-H "Ce-Type: dev.knative.samples.hifromknative" \
-H "Ce-Source: dev.knative.samples/helloworldsource" \
-H "Content-Type: application/json" \
-d '{"msg":"Hello World from the curl pod."}'
@ -427,7 +431,7 @@ mesh via the Broker and can be delivered to other services using a Trigger
EOF
```
1. [Send a CloudEvent to the Broker](#send-cloudevent-to-the-broker)
1. [Send a CloudEvent to the Broker](#send-and-verify-cloudevents)
1. Check the logs of `event-display` service:

View File

@ -10,6 +10,10 @@ kind: Broker
metadata:
name: default
namespace: knative-samples
annotations:
# Note: you can set the eventing.knative.dev/broker.class annotation to change the class of the broker.
# The default broker class is MTChannelBasedBroker, but Knative also supports use of the other class.
eventing.knative.dev/broker.class: MTChannelBasedBroker
spec: {}
---
# Helloworld-go app deployment
@ -33,15 +37,15 @@ spec:
---
# Service that exposes helloworld-go app.
# This will be the subscriber for the Trigger
kind: Service
apiVersion: v1
metadata:
name: helloworld-go
namespace: knative-samples
spec:
selector:
app: helloworld-go
ports:
apiVersion: v1
kind: Service
metadata:
name: helloworld-go
namespace: knative-samples
spec:
selector:
app: helloworld-go
ports:
- protocol: TCP
port: 80
targetPort: 8080

View File

@ -87,7 +87,19 @@ cd knative-docs/docs/eventing/samples/helloworld/helloworld-python
labels:
eventing.knative.dev/injection: enabled
---
# Helloworld-python app deploment
# A default broker
apiVersion: eventing.knative.dev/v1
kind: Broker
metadata:
name: default
namespace: knative-samples
annotations:
# Note: you can set the eventing.knative.dev/broker.class annotation to change the class of the broker.
# The default broker class is MTChannelBasedBroker, but Knative also supports use of the other class.
eventing.knative.dev/broker.class: MTChannelBasedBroker
spec: {}
---
# Helloworld-python app deployment
apiVersion: apps/v1
kind: Deployment
metadata:
@ -109,18 +121,18 @@ cd knative-docs/docs/eventing/samples/helloworld/helloworld-python
---
# Service that exposes helloworld-python app.
# This will be the subscriber for the Trigger
kind: Service
apiVersion: v1
metadata:
name: helloworld-python
namespace: knative-samples
spec:
selector:
app: helloworld-python
ports:
- protocol: TCP
port: 80
targetPort: 8080
apiVersion: v1
kind: Service
metadata:
name: helloworld-python
namespace: knative-samples
spec:
selector:
app: helloworld-python
ports:
- protocol: TCP
port: 80
targetPort: 8080
---
# Knative Eventing Trigger to trigger the helloworld-python service
apiVersion: eventing.knative.dev/v1
@ -198,7 +210,7 @@ You can send an HTTP request directly to the Knative [broker](../../../broker) i
1. Run the following command in the SSH terminal:
```bash
curl -v "default-broker.knative-samples.svc.cluster.local" \
curl -v "broker-ingress.knative-eventing.svc.cluster.local/knative-samples/default" \
-X POST \
-H "Ce-Id: 536808d3-88be-4077-9d7a-a3f162705f79" \
-H "Ce-specversion: 0.3" \
@ -310,7 +322,7 @@ The `helloworld-python` app replies with an event type `type= dev.knative.sample
EOF
```
1. [Send a CloudEvent to the Broker](#send-cloudevent-to-the-broker)
1. [Send a CloudEvent to the Broker](#send-and-verify-cloudevents)
1. Check the logs of `event-display` Service:

View File

@ -4,9 +4,21 @@ kind: Namespace
metadata:
name: knative-samples
labels:
eventing.knative.dev/injection: enabled
eventing.knative.dev/injection: enabled
---
# Helloworld-go app deploment
# A default broker
apiVersion: eventing.knative.dev/v1
kind: Broker
metadata:
name: default
namespace: knative-samples
annotations:
# Note: you can set the eventing.knative.dev/broker.class annotation to change the class of the broker.
# The default broker class is MTChannelBasedBroker, but Knative also supports use of the other class.
eventing.knative.dev/broker.class: MTChannelBasedBroker
spec: {}
---
# helloworld-python app deployment
apiVersion: apps/v1
kind: Deployment
metadata:
@ -23,25 +35,25 @@ spec:
spec:
containers:
- name: helloworld-python
image: docker.io/axsauze/helloworld-python
image: docker.io/{username}/helloworld-python
imagePullPolicy: IfNotPresent
---
# Service that exposes helloworld-go app.
# Service that exposes helloworld-python app.
# This will be the subscriber for the Trigger
kind: Service
apiVersion: v1
metadata:
name: helloworld-python
namespace: knative-samples
spec:
selector:
app: helloworld-python
ports:
apiVersion: v1
kind: Service
metadata:
name: helloworld-python
namespace: knative-samples
spec:
selector:
app: helloworld-python
ports:
- protocol: TCP
port: 80
targetPort: 8080
---
# Knative Eventing Trigger to trigger the helloworld-go service
# Knative Eventing Trigger to trigger the helloworld-python service
apiVersion: eventing.knative.dev/v1
kind: Trigger
metadata: