@@ -24,7 +24,6 @@ export IOTCORE_PROJECT="s9-demo"
2424#### Variables you may Change
2525
2626``` shell
27- export CHANNEL_NAME=" iot-demo"
2827export IOTCORE_REGISTRY=" iot-demo"
2928export IOTCORE_DEVICE=" iot-demo-client"
3029export IOTCORE_REGION=" us-central1"
@@ -34,12 +33,6 @@ export IOTCORE_TOPIC_DEVICE="iot-demo-device-pubsub-topic"
3433
3534### Prerequisites
3635
37- #### Local
38-
39- 1 . Clone
40- [ Knative Eventing Sources] ( https://github.com/knative/eventing-sources )
41- locally.
42-
4336#### Kubernetes
4437
45381 . Have a running Kubernetes cluster with ` kubectl ` pointing at it.
@@ -67,13 +60,6 @@ export IOTCORE_TOPIC_DEVICE="iot-demo-device-pubsub-topic"
6760
68611. Setup [Knative Eventing](../../../eventing).
6962
70- 1. Install the
71- [in-memory ` ClusterChannelProvisioner` ](https://github.com/knative/eventing/tree/master/config/provisioners/in-memory-channel).
72-
73- - Note that you can skip this if you choose to use a different type of
74- ` Channel` . If so, you will need to modify ` channel.yaml` before deploying
75- it.
76-
7763# ### GCP PubSub Source
7864
79651. Create a GCP
@@ -94,44 +80,39 @@ export IOTCORE_TOPIC_DEVICE="iot-demo-device-pubsub-topic"
9480 controller.
9581
9682 ```shell
97- pushd $HOME/go/src/github.com/knative/eventing-sources
98- ko apply --filename config/default-gcppubsub.yaml
99- popd
83+ kubectl apply --filename https://github.com/knative/eventing-sources/releases/download/v0.5.0/gcppubsub.yaml
10084 ```
10185
10286### Deploying
10387
104- #### Channel
88+ #### Broker
10589
106- 1. Create a `Channel `.
90+ 1. Install the default `Broker `.
10791
10892 ```shell
109- sed "s/CHANNEL_NAME/$CHANNEL_NAME/" channel.yaml |
110- kubectl --namespace default apply --filename -
93+ kubectl label namespace default knative-eventing-injection=enabled
11194 ```
11295
11396#### GCP PubSub Source
11497
115981. Deploy `gcp-pubsub-source.yaml`.
11699
117100 ```shell
118- sed -e "s/MY_GCP_PROJECT /$IOTCORE_PROJECT/" \
101+ sed -e "s/PROJECT_ID /$IOTCORE_PROJECT/" \
119102 -e "s/TOPIC_NAME/$IOTCORE_TOPIC_DATA/" \
120- -e "s/CHANNEL_NAME/$CHANNEL_NAME/" \
121- gcp-pubsub-source.yaml |
103+ docs/eventing/samples/iot-core/gcp-pubsub-source.yaml |
122104 kubectl apply --filename -
123105 ```
124106
125- #### Subscription
107+ #### Trigger
126108
127109Even though the `Source` isn' t completely ready yet, we can setup the
128- ` Subscription ` for all events coming out of it.
110+ ` Trigger ` for all events coming out of it.
129111
130- 1. Deploy ` subscription .yaml` .
112+ 1. Deploy ` trigger .yaml` .
131113
132114 ` ` ` shell
133- sed " s/CHANNEL_NAME/$CHANNEL_NAME /" subscription.yaml |
134- ko apply --filename -
115+ kubectl apply --filename docs/eventing/samples/iot-core/trigger.yaml
135116 ` ` `
136117
137118 - This uses a very simple Knative Service to see that events are flowing.
@@ -178,14 +159,7 @@ Core.
178159We now have everything installed and ready to go. We will generate events and
179160see them in the subscriber.
180161
181- 1. Setup [` kail` ](https://github.com/boz/kail) to tail the logs of the
182- subscriber.
183-
184- ` ` ` shell
185- kail -d message-dumper -c user-container
186- ` ` `
187-
188- 1. In a separate terminal, run the following program to generate events.
162+ 1. Run the following program to generate events:
189163
190164 ` ` ` shell
191165 go run github.com/knative/docs/docs/eventing/samples/iot-core/generator \
@@ -199,37 +173,39 @@ see them in the subscriber.
199173 -events 10
200174 ` ` `
201175
176+ 1. Inspect the logs of the subscriber:
177+
178+ ` ` ` shell
179+ kubectl logs --selector serving.knative.dev/service=message-dumper -c user-container
180+ ` ` `
181+
182+ You should see something along the similar to:
183+
184+ ` ` ` shell
185+ {" ID" :" 481014114648052" ," Data" :" eyJzb3VyY2VfaWQiOiJpb3QtY29yZSBkZW1vIiwiZXZlbnRfaWQiOiJlaWQtMzI3MjJiMzItZWU5Mi00YzZlLWEzOTgtNDlmYjRkYWYyNGE1IiwiZXZlbnRfdHMiOjE1NTM3MTczOTYsIm1ldHJpYyI6MC4xMzY1MjI5OH0=" ," Attributes" :{" deviceId" :" iot-demo-client" ," deviceNumId" :" 2754785852315736" ," deviceRegistryId" :" iot-demo" ," deviceRegistryLocation" :" us-central1" ," projectId" :" s9-demo" ," subFolder" :" " }," PublishTime" :" 2019-03-27T20:09:56.685Z" }
186+
202187# ## Cleanup
203188
204189To cleanup the knative resources:
205190
206- 1. Remove the gcppubsub controller :
191+ 1. Remove the ` GcpPubSubSource ` :
207192
208193 ` ` ` shell
209- pushd $HOME /go/src/github.com/knative/eventing-sources
210- kubectl delete --filename config/default-gcppubsub.yaml
211- popd
194+ sed -e " s/PROJECT_ID/$IOTCORE_PROJECT /" \
195+ -e " s/TOPIC_NAME/$IOTCORE_TOPIC_DATA /" \
196+ docs/eventing/samples/iot-core/gcp-pubsub-source.yaml |
197+ kubectl delete --filename -
212198 ```
213-
214- 2 . Remove the channel :
199+
200+ 1 . Remove the Trigger :
215201
216202 ` ` ` shell
217- sed " s/CHANNEL_NAME/$CHANNEL_NAME /" channel.yaml |
218- kubectl --namespace default delete --filename -
203+ kubectl delete --filename docs/eventing/samples/iot-core/trigger.yaml
219204 ` ` `
220205
221- 3 . Remove the gcppubsub source :
206+ 1 . Remove the ` GcpPubSubSource ` controller :
222207
223208 ` ` ` shell
224- sed -e " s/MY_GCP_PROJECT/$IOTCORE_PROJECT /" \
225- -e " s/TOPIC_NAME/$IOTCORE_TOPIC_DATA /" \
226- -e " s/CHANNEL_NAME/$CHANNEL_NAME /" \
227- gcp-pubsub-source.yaml |
228- kubectl delete --filename -
209+ kubectl delete --filename https://github.com/knative/eventing-sources/releases/download/v0.5.0/gcppubsub.yaml
229210 ` ` `
230211
231- 4. Remove the subscription:
232- ` ` ` shell
233- sed " s/CHANNEL_NAME/$CHANNEL_NAME /" subscription.yaml |
234- kubectl delete --filename -
235- ` ` `
0 commit comments