From 5000c3160407f5fef8b224e1f565664a21bcb764 Mon Sep 17 00:00:00 2001 From: Adam Harwayne Date: Thu, 21 Mar 2019 09:38:20 -0700 Subject: [PATCH 1/4] Update the GcpPubSubSource example to use Broker, rather than Channel. --- .../samples/gcp-pubsub-source/README.md | 25 ++++--------------- .../samples/gcp-pubsub-source/channel.yaml | 9 ------- .../gcp-pubsub-source/gcp-pubsub-source.yaml | 4 +-- .../{subscriber.yaml => trigger.yaml} | 9 +++---- 4 files changed, 10 insertions(+), 37 deletions(-) delete mode 100644 docs/eventing/samples/gcp-pubsub-source/channel.yaml rename docs/eventing/samples/gcp-pubsub-source/{subscriber.yaml => trigger.yaml} (79%) diff --git a/docs/eventing/samples/gcp-pubsub-source/README.md b/docs/eventing/samples/gcp-pubsub-source/README.md index f186182457e..37912ca4906 100644 --- a/docs/eventing/samples/gcp-pubsub-source/README.md +++ b/docs/eventing/samples/gcp-pubsub-source/README.md @@ -74,26 +74,11 @@ source is most useful as a bridge from other GCP services, such as ## Deployment -1. Create a Channel. This example creates a Channel called `pubsub-test` which - uses the in-memory provisioner, with the following definition: - - ```yaml - apiVersion: eventing.knative.dev/v1alpha1 - kind: Channel - metadata: - name: pubsub-test - spec: - provisioner: - apiVersion: eventing.knative.dev/v1alpha1 - kind: ClusterChannelProvisioner - name: in-memory-channel - ``` - - If you're in the samples directory, you can apply the `channel.yaml` file: +1. Create the `default` Broker in your namespace. These instructions assume the namespace `default`, feel free to change to any other namespace you would like to use instead: - ```shell - kubectl apply --filename channel.yaml - ``` + ```shell + kubectl label namespace default knative-eventing-injection=enabled + ``` 1. Create a GCP PubSub Topic. If you change its name (`testing`), you also need to update the `topic` in the @@ -122,7 +107,7 @@ source is most useful as a bridge from other GCP services, such as kubectl apply --filename gcp-pubsub-source.yaml ``` -1. Create a function and subscribe it to the `pubsub-test` channel: +1. Create a function and create a Trigger that will send all events from the Broker to the function: ```shell kubectl apply --filename subscriber.yaml diff --git a/docs/eventing/samples/gcp-pubsub-source/channel.yaml b/docs/eventing/samples/gcp-pubsub-source/channel.yaml deleted file mode 100644 index 37a5b0e3c9e..00000000000 --- a/docs/eventing/samples/gcp-pubsub-source/channel.yaml +++ /dev/null @@ -1,9 +0,0 @@ -apiVersion: eventing.knative.dev/v1alpha1 -kind: Channel -metadata: - name: pubsub-test -spec: - provisioner: - apiVersion: eventing.knative.dev/v1alpha1 - kind: ClusterChannelProvisioner - name: in-memory-channel diff --git a/docs/eventing/samples/gcp-pubsub-source/gcp-pubsub-source.yaml b/docs/eventing/samples/gcp-pubsub-source/gcp-pubsub-source.yaml index cd990cb520b..53775059f46 100644 --- a/docs/eventing/samples/gcp-pubsub-source/gcp-pubsub-source.yaml +++ b/docs/eventing/samples/gcp-pubsub-source/gcp-pubsub-source.yaml @@ -13,5 +13,5 @@ spec: topic: testing sink: apiVersion: eventing.knative.dev/v1alpha1 - kind: Channel - name: pubsub-test + kind: Broker + name: default diff --git a/docs/eventing/samples/gcp-pubsub-source/subscriber.yaml b/docs/eventing/samples/gcp-pubsub-source/trigger.yaml similarity index 79% rename from docs/eventing/samples/gcp-pubsub-source/subscriber.yaml rename to docs/eventing/samples/gcp-pubsub-source/trigger.yaml index 4d30405cfde..688b02297fd 100644 --- a/docs/eventing/samples/gcp-pubsub-source/subscriber.yaml +++ b/docs/eventing/samples/gcp-pubsub-source/trigger.yaml @@ -16,17 +16,14 @@ spec: --- -# Subscription from the GcpPubSubSource's output Channel to the Knative Service below. +# The GcpPubSubSource's output goes to the default Broker. This Trigger subscribes to events in the +# default Broker. apiVersion: eventing.knative.dev/v1alpha1 -kind: Subscription +kind: Trigger metadata: name: gcppubsub-source-sample spec: - channel: - apiVersion: eventing.knative.dev/v1alpha1 - kind: Channel - name: pubsub-test subscriber: ref: apiVersion: serving.knative.dev/v1alpha1 From 2945e1d9e4123bcf08597d3adddea487d622b6c2 Mon Sep 17 00:00:00 2001 From: Adam Harwayne Date: Thu, 21 Mar 2019 09:56:41 -0700 Subject: [PATCH 2/4] Small updates. --- docs/eventing/samples/gcp-pubsub-source/README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/eventing/samples/gcp-pubsub-source/README.md b/docs/eventing/samples/gcp-pubsub-source/README.md index 37912ca4906..d640228b788 100644 --- a/docs/eventing/samples/gcp-pubsub-source/README.md +++ b/docs/eventing/samples/gcp-pubsub-source/README.md @@ -22,7 +22,7 @@ source is most useful as a bridge from other GCP services, such as addition, install the GCP PubSub event source from `release-gcppubsub.yaml`: ```shell - kubectl apply --filename https://github.com/knative/eventing-sources/releases/download/v0.3.0/release-gcppubsub.yaml + kubectl apply --filename https://github.com/knative/eventing-sources/releases/download/v0.4.1/gcppubsub.yaml ``` 1. Enable the `Cloud Pub/Sub API` on your project: @@ -96,8 +96,8 @@ source is most useful as a bridge from other GCP services, such as apply in one command: ```shell - sed "s/MY_GCP_PROJECT/$PROJECT_ID/g" gcp-pubsub-source.yaml | \ - kubectl apply --filename - + sed "s/MY_GCP_PROJECT/$PROJECT_ID/g" gcp-pubsub-source.yaml | \ + kubectl apply --filename - ``` If you are replacing `MY_GCP_PROJECT` manually, then make sure you apply the @@ -110,7 +110,7 @@ source is most useful as a bridge from other GCP services, such as 1. Create a function and create a Trigger that will send all events from the Broker to the function: ```shell - kubectl apply --filename subscriber.yaml + kubectl apply --filename trigger.yaml ``` ## Publish From fb03ddefd85e267056be1dbcdc93c4d8d0b8122c Mon Sep 17 00:00:00 2001 From: Adam Harwayne Date: Tue, 26 Mar 2019 11:21:26 -0700 Subject: [PATCH 3/4] Add a message for the updated ClusterRole. --- docs/eventing/samples/gcp-pubsub-source/README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docs/eventing/samples/gcp-pubsub-source/README.md b/docs/eventing/samples/gcp-pubsub-source/README.md index d640228b788..1d2de127462 100644 --- a/docs/eventing/samples/gcp-pubsub-source/README.md +++ b/docs/eventing/samples/gcp-pubsub-source/README.md @@ -25,6 +25,12 @@ source is most useful as a bridge from other GCP services, such as kubectl apply --filename https://github.com/knative/eventing-sources/releases/download/v0.4.1/gcppubsub.yaml ``` + Until 0.5.0 is released (and the previous URL is updated to point at it), you will need to have a copy of the `knative/eventing-sources` repo locally and from its root: + + ```shell + kubectl apply --filename contrib/gcppubsub/config/201-clusterrole.yaml + ``` + 1. Enable the `Cloud Pub/Sub API` on your project: ```shell From e8e44089cdabc65ab3f443bb2d0ed07e9ebeca2a Mon Sep 17 00:00:00 2001 From: Adam Harwayne Date: Tue, 26 Mar 2019 14:13:44 -0700 Subject: [PATCH 4/4] Point to 0.5.0 URL, a not-yet-active URL. --- docs/eventing/samples/gcp-pubsub-source/README.md | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/docs/eventing/samples/gcp-pubsub-source/README.md b/docs/eventing/samples/gcp-pubsub-source/README.md index 1d2de127462..2f05f6b1f53 100644 --- a/docs/eventing/samples/gcp-pubsub-source/README.md +++ b/docs/eventing/samples/gcp-pubsub-source/README.md @@ -22,13 +22,7 @@ source is most useful as a bridge from other GCP services, such as addition, install the GCP PubSub event source from `release-gcppubsub.yaml`: ```shell - kubectl apply --filename https://github.com/knative/eventing-sources/releases/download/v0.4.1/gcppubsub.yaml - ``` - - Until 0.5.0 is released (and the previous URL is updated to point at it), you will need to have a copy of the `knative/eventing-sources` repo locally and from its root: - - ```shell - kubectl apply --filename contrib/gcppubsub/config/201-clusterrole.yaml + kubectl apply --filename https://github.com/knative/eventing-sources/releases/download/v0.5.0/gcppubsub.yaml ``` 1. Enable the `Cloud Pub/Sub API` on your project: