Skip to content

Commit 3353747

Browse files
Harwayneknative-prow-robot
authored andcommitted
Update the GcpPubSubSource example to use Broker, rather than Channel. (#1049)
* Update the GcpPubSubSource example to use Broker, rather than Channel. * Small updates. * Add a message for the updated ClusterRole. * Point to 0.5.0 URL, a not-yet-active URL.
1 parent 88f3afb commit 3353747

File tree

4 files changed

+14
-41
lines changed

4 files changed

+14
-41
lines changed

docs/eventing/samples/gcp-pubsub-source/README.md

Lines changed: 9 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ source is most useful as a bridge from other GCP services, such as
2020
PubSub event source from `release-gcppubsub.yaml`:
2121

2222
```shell
23-
kubectl apply --filename https://github.com/knative/eventing-sources/releases/download/v0.3.0/release-gcppubsub.yaml
23+
kubectl apply --filename https://github.com/knative/eventing-sources/releases/download/v0.5.0/gcppubsub.yaml
2424
```
2525

2626
1. Enable the `Cloud Pub/Sub API` on your project:
@@ -72,26 +72,11 @@ source is most useful as a bridge from other GCP services, such as
7272

7373
## Deployment
7474

75-
1. Create a Channel. This example creates a Channel called `pubsub-test` which
76-
uses the in-memory provisioner, with the following definition:
77-
78-
```yaml
79-
apiVersion: eventing.knative.dev/v1alpha1
80-
kind: Channel
81-
metadata:
82-
name: pubsub-test
83-
spec:
84-
provisioner:
85-
apiVersion: eventing.knative.dev/v1alpha1
86-
kind: ClusterChannelProvisioner
87-
name: in-memory-channel
88-
```
89-
90-
If you're in the samples directory, you can apply the `channel.yaml` file:
75+
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:
9176

92-
```shell
93-
kubectl apply --filename channel.yaml
94-
```
77+
```shell
78+
kubectl label namespace default knative-eventing-injection=enabled
79+
```
9580

9681
1. Create a GCP PubSub Topic. If you change its name (`testing`), you also need
9782
to update the `topic` in the
@@ -109,8 +94,8 @@ source is most useful as a bridge from other GCP services, such as
10994
apply in one command:
11095
11196
```shell
112-
sed "s/MY_GCP_PROJECT/$PROJECT_ID/g" gcp-pubsub-source.yaml | \
113-
kubectl apply --filename -
97+
sed "s/MY_GCP_PROJECT/$PROJECT_ID/g" gcp-pubsub-source.yaml | \
98+
kubectl apply --filename -
11499
```
115100
116101
If you are replacing `MY_GCP_PROJECT` manually, then make sure you apply the
@@ -120,10 +105,10 @@ source is most useful as a bridge from other GCP services, such as
120105
kubectl apply --filename gcp-pubsub-source.yaml
121106
```
122107
123-
1. Create a function and subscribe it to the `pubsub-test` channel:
108+
1. Create a function and create a Trigger that will send all events from the Broker to the function:
124109
125110
```shell
126-
kubectl apply --filename subscriber.yaml
111+
kubectl apply --filename trigger.yaml
127112
```
128113
129114
## Publish

docs/eventing/samples/gcp-pubsub-source/channel.yaml

Lines changed: 0 additions & 9 deletions
This file was deleted.

docs/eventing/samples/gcp-pubsub-source/gcp-pubsub-source.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@ spec:
1313
topic: testing
1414
sink:
1515
apiVersion: eventing.knative.dev/v1alpha1
16-
kind: Channel
17-
name: pubsub-test
16+
kind: Broker
17+
name: default

docs/eventing/samples/gcp-pubsub-source/subscriber.yaml renamed to docs/eventing/samples/gcp-pubsub-source/trigger.yaml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,14 @@ spec:
1616

1717
---
1818

19-
# Subscription from the GcpPubSubSource's output Channel to the Knative Service below.
19+
# The GcpPubSubSource's output goes to the default Broker. This Trigger subscribes to events in the
20+
# default Broker.
2021

2122
apiVersion: eventing.knative.dev/v1alpha1
22-
kind: Subscription
23+
kind: Trigger
2324
metadata:
2425
name: gcppubsub-source-sample
2526
spec:
26-
channel:
27-
apiVersion: eventing.knative.dev/v1alpha1
28-
kind: Channel
29-
name: pubsub-test
3027
subscriber:
3128
ref:
3229
apiVersion: serving.knative.dev/v1alpha1

0 commit comments

Comments
 (0)