diff --git a/docs/eventing/samples/kubernetes-event-source/README.md b/docs/eventing/samples/kubernetes-event-source/README.md index 1cc46113d43..a37206bb575 100644 --- a/docs/eventing/samples/kubernetes-event-source/README.md +++ b/docs/eventing/samples/kubernetes-event-source/README.md @@ -10,22 +10,19 @@ consumption by a function that has been implemented as a Knative Service. 1. Setup [Knative Eventing](../../../eventing). -### Channel +### Broker -1. Create a `Channel`. You can use your own `Channel` or use the provided - sample, which creates a channel called `testchannel`. If you use your own - `Channel` with a different name, then you will need to alter other commands - later. +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. If you use a different namespace, you will need to modify all the YAML files deployed in this sample to point at that namespace. ```shell -kubectl --namespace default apply --filename channel.yaml +kubectl label namespace default knative-eventing-injection=enabled ``` ### Service Account 1. Create a Service Account that the `Receive Adapter` runs as. The `Receive Adapater` watches for Kubernetes events and forwards them to the - Knative Eventing Framework. If you want to re-use an existing Service Account + Knative Eventing Broker. If you want to re-use an existing Service Account with the appropriate permissions, you need to modify the `serviceaccount.yaml`. @@ -36,49 +33,44 @@ kubectl apply --filename serviceaccount.yaml ### Create Event Source for Kubernetes Events 1. In order to receive events, you have to create a concrete Event Source for a - specific namespace. If you are wanting to consume events from a different - namespace or using a different `Service Account`, you need to modify the yaml - accordingly. + specific namespace. If you want to consume events from a different + namespace or use a different `Service Account`, you need to modify + `k8s-events.yaml` accordingly. ```shell kubectl apply --filename k8s-events.yaml ``` -### Subscriber +### Trigger In order to check the `KubernetesEventSource` is fully working, we will create a -simple Knative Service that dumps incoming messages to its log and create a -`Subscription` from the `Channel` to that Knative Service. +simple Knative Service that dumps incoming messages to its log and creates a +`Trigger` from the `Broker` to that Knative Service. -1. If the deployed `KubernetesEventSource` is pointing at a `Channel` other than - `testchannel`, modify `subscription.yaml` by replacing `testchannel` with - that `Channel`'s name. -1. Deploy `subscription.yaml`. +1. If the deployed `KubernetesEventSource` is pointing at a `Broker` other than + `default`, modify `trigger.yaml` by adding `spec.broker` with the `Broker`'s name. + +1. Deploy `trigger.yaml`. ```shell -kubectl apply --filename subscription.yaml +kubectl apply --filename trigger.yaml ``` ### Create Events Create events by launching a pod in the default namespace. Create a busybox -container - -```shell -kubectl run -i --tty busybox --image=busybox --restart=Never -- sh -``` - -Once the shell comes up, just exit it and kill the pod. +container and immediately delete it. ```shell +kubectl run busybox --image=busybox --restart=Never -- ls kubectl delete pod busybox ``` ### Verify -We will verify that the kubernetes events were sent into the Knative eventing +We will verify that the Kubernetes events were sent into the Knative eventing system by looking at our message dumper function logs. If you deployed the -[Subscriber](#subscriber), then continue using this section. If not, then you +[Trigger](#trigger), then continue using this section. If not, then you will need to look downstream yourself. ```shell diff --git a/docs/eventing/samples/kubernetes-event-source/channel.yaml b/docs/eventing/samples/kubernetes-event-source/channel.yaml deleted file mode 100644 index 2941574511c..00000000000 --- a/docs/eventing/samples/kubernetes-event-source/channel.yaml +++ /dev/null @@ -1,9 +0,0 @@ -apiVersion: eventing.knative.dev/v1alpha1 -kind: Channel -metadata: - name: testchannel -spec: - provisioner: - apiVersion: eventing.knative.dev/v1alpha1 - kind: ClusterChannelProvisioner - name: in-memory-channel diff --git a/docs/eventing/samples/kubernetes-event-source/k8s-events.yaml b/docs/eventing/samples/kubernetes-event-source/k8s-events.yaml index 70ffa1c5cba..43da2e7c62f 100644 --- a/docs/eventing/samples/kubernetes-event-source/k8s-events.yaml +++ b/docs/eventing/samples/kubernetes-event-source/k8s-events.yaml @@ -7,5 +7,5 @@ spec: serviceAccountName: events-sa sink: apiVersion: eventing.knative.dev/v1alpha1 - kind: Channel - name: testchannel + kind: Broker + name: default diff --git a/docs/eventing/samples/kubernetes-event-source/serviceaccount.yaml b/docs/eventing/samples/kubernetes-event-source/serviceaccount.yaml index b0658392e82..53749a55a93 100644 --- a/docs/eventing/samples/kubernetes-event-source/serviceaccount.yaml +++ b/docs/eventing/samples/kubernetes-event-source/serviceaccount.yaml @@ -3,7 +3,9 @@ kind: ServiceAccount metadata: name: events-sa namespace: default + --- + apiVersion: rbac.authorization.k8s.io/v1 kind: Role metadata: @@ -18,7 +20,9 @@ rules: - get - list - watch + --- + apiVersion: rbac.authorization.k8s.io/v1 kind: RoleBinding metadata: diff --git a/docs/eventing/samples/kubernetes-event-source/subscription.yaml b/docs/eventing/samples/kubernetes-event-source/trigger.yaml similarity index 66% rename from docs/eventing/samples/kubernetes-event-source/subscription.yaml rename to docs/eventing/samples/kubernetes-event-source/trigger.yaml index 91f0320ee43..cfcf062faf6 100644 --- a/docs/eventing/samples/kubernetes-event-source/subscription.yaml +++ b/docs/eventing/samples/kubernetes-event-source/trigger.yaml @@ -1,13 +1,9 @@ apiVersion: eventing.knative.dev/v1alpha1 -kind: Subscription +kind: Trigger metadata: - name: testevents-subscription + name: testevents-trigger namespace: default spec: - channel: - apiVersion: eventing.knative.dev/v1alpha1 - kind: Channel - name: testchannel subscriber: ref: apiVersion: serving.knative.dev/v1alpha1 @@ -28,4 +24,6 @@ spec: revisionTemplate: spec: container: - image: gcr.io/knative-releases/github.com/knative/eventing-sources/cmd/message_dumper@sha256:73a95b05b5b937544af7c514c3116479fa5b6acf7771604b313cfc1587bf0940 + # This corresponds to + # https://github.com/knative/eventing-sources/blob/release-0.3/cmd/message_dumper/dumper.go + image: gcr.io/knative-releases/github.com/knative/eventing-sources/cmd/message_dumper@sha256:8423232db7a7b4010c0cfbfaef95745efe962631af9b7456903825801a7893f7