From c1c04dfe1f4277e743c2f37cc2f3fdef7b1092f4 Mon Sep 17 00:00:00 2001 From: novahe Date: Thu, 27 May 2021 22:19:34 +0800 Subject: [PATCH 1/2] fix helloworld-python add note and annotations fix link (#3679) --- .../helloworld/helloworld-go/sample-app.yaml | 28 +++++++----- .../helloworld-python/sample-app.yaml | 44 ++++++++++++------- 2 files changed, 44 insertions(+), 28 deletions(-) diff --git a/docs/eventing/samples/helloworld/helloworld-go/sample-app.yaml b/docs/eventing/samples/helloworld/helloworld-go/sample-app.yaml index 1eba73b86c2..02c816f8f49 100644 --- a/docs/eventing/samples/helloworld/helloworld-go/sample-app.yaml +++ b/docs/eventing/samples/helloworld/helloworld-go/sample-app.yaml @@ -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,18 +37,18 @@ 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: - - protocol: TCP - port: 80 - targetPort: 8080 +apiVersion: v1 +kind: Service +metadata: + name: helloworld-go + namespace: knative-samples +spec: + selector: + app: helloworld-go + ports: + - protocol: TCP + port: 80 + targetPort: 8080 --- # Knative Eventing Trigger to trigger the helloworld-go service apiVersion: eventing.knative.dev/v1 diff --git a/docs/eventing/samples/helloworld/helloworld-python/sample-app.yaml b/docs/eventing/samples/helloworld/helloworld-python/sample-app.yaml index 18fdcb95548..d2b5fe460b9 100644 --- a/docs/eventing/samples/helloworld/helloworld-python/sample-app.yaml +++ b/docs/eventing/samples/helloworld/helloworld-python/sample-app.yaml @@ -6,7 +6,19 @@ metadata: labels: 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: - - 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-go service +# Knative Eventing Trigger to trigger the helloworld-python service apiVersion: eventing.knative.dev/v1 kind: Trigger metadata: From 9495c4b6a9caed5bc781fe883e91e309bd8af6aa Mon Sep 17 00:00:00 2001 From: novahe Date: Sat, 5 Jun 2021 22:54:27 +0800 Subject: [PATCH 2/2] fix helloworld-python (#3679) --- .../helloworld/helloworld-go/README.md | 10 +++-- .../helloworld/helloworld-go/sample-app.yaml | 6 +-- .../helloworld/helloworld-python/README.md | 42 ++++++++++++------- .../helloworld-python/sample-app.yaml | 8 ++-- 4 files changed, 41 insertions(+), 25 deletions(-) diff --git a/docs/eventing/samples/helloworld/helloworld-go/README.md b/docs/eventing/samples/helloworld/helloworld-go/README.md index 2f7ad7c6a8b..59b79f74e96 100644 --- a/docs/eventing/samples/helloworld/helloworld-go/README.md +++ b/docs/eventing/samples/helloworld/helloworld-go/README.md @@ -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: diff --git a/docs/eventing/samples/helloworld/helloworld-go/sample-app.yaml b/docs/eventing/samples/helloworld/helloworld-go/sample-app.yaml index 02c816f8f49..542642ebe19 100644 --- a/docs/eventing/samples/helloworld/helloworld-go/sample-app.yaml +++ b/docs/eventing/samples/helloworld/helloworld-go/sample-app.yaml @@ -46,9 +46,9 @@ spec: selector: app: helloworld-go ports: - - protocol: TCP - port: 80 - targetPort: 8080 + - protocol: TCP + port: 80 + targetPort: 8080 --- # Knative Eventing Trigger to trigger the helloworld-go service apiVersion: eventing.knative.dev/v1 diff --git a/docs/eventing/samples/helloworld/helloworld-python/README.md b/docs/eventing/samples/helloworld/helloworld-python/README.md index f95f18e1a6d..4db2d807e94 100644 --- a/docs/eventing/samples/helloworld/helloworld-python/README.md +++ b/docs/eventing/samples/helloworld/helloworld-python/README.md @@ -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: diff --git a/docs/eventing/samples/helloworld/helloworld-python/sample-app.yaml b/docs/eventing/samples/helloworld/helloworld-python/sample-app.yaml index d2b5fe460b9..a932d8faf0a 100644 --- a/docs/eventing/samples/helloworld/helloworld-python/sample-app.yaml +++ b/docs/eventing/samples/helloworld/helloworld-python/sample-app.yaml @@ -4,7 +4,7 @@ kind: Namespace metadata: name: knative-samples labels: - eventing.knative.dev/injection: enabled + eventing.knative.dev/injection: enabled --- # A default broker apiVersion: eventing.knative.dev/v1 @@ -49,9 +49,9 @@ spec: selector: app: helloworld-python ports: - - protocol: TCP - port: 80 - targetPort: 8080 + - protocol: TCP + port: 80 + targetPort: 8080 --- # Knative Eventing Trigger to trigger the helloworld-python service apiVersion: eventing.knative.dev/v1