diff --git a/docs/eventing/samples/kubernetes-event-source/README.md b/docs/eventing/samples/kubernetes-event-source/README.md index b634d32bffd..2a64e2cd9c2 100644 --- a/docs/eventing/samples/kubernetes-event-source/README.md +++ b/docs/eventing/samples/kubernetes-event-source/README.md @@ -1,5 +1,8 @@ Kubernetes Event Source example shows how to wire kubernetes cluster events for -consumption by a function that has been implemented as a Knative Service. The code for the following files can be found in the [/kubernetes-event-source/](https://github.com/knative/docs/tree/master/docs/eventing/samples/kubernetes-event-source) directory. +consumption by a function that has been implemented as a Knative Service. The +code for the following files can be found in the +[/kubernetes-event-source/](https://github.com/knative/docs/tree/master/docs/eventing/samples/kubernetes-event-source) +directory. ## Deployment Steps @@ -23,9 +26,8 @@ kubectl label namespace default knative-eventing-injection=enabled 1. Create a Service Account that the `ApiServerSource` runs as. The `ApiServerSource` watches for Kubernetes events and forwards them to the - Knative Eventing Broker. - Create a file named `serviceaccount.yaml` and copy the code block - below into it. + Knative Eventing Broker. Create a file named `serviceaccount.yaml` and copy + the code block below into it. ```yaml apiVersion: v1 @@ -35,23 +37,21 @@ metadata: namespace: default --- - apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: name: event-watcher rules: -- apiGroups: - - "" - resources: - - events - verbs: - - get - - list - - watch + - apiGroups: + - "" + resources: + - events + verbs: + - get + - list + - watch --- - apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRoleBinding metadata: @@ -61,14 +61,16 @@ roleRef: kind: ClusterRole name: event-watcher subjects: -- kind: ServiceAccount - name: events-sa - namespace: default + - kind: ServiceAccount + name: events-sa + namespace: default ``` -If you want to re-use an existing Service Account with the appropriate permissions, you need to modify the `serviceaccount.yaml`. +If you want to re-use an existing Service Account with the appropriate +permissions, you need to modify the `serviceaccount.yaml`. -Enter the following command to create the service account from `serviceaccount.yaml`: +Enter the following command to create the service account from +`serviceaccount.yaml`: ```shell kubectl apply --filename serviceaccount.yaml @@ -77,7 +79,7 @@ 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. Create a file named `k8s-events.yaml` and copy the code + specific namespace. Create a file named `k8s-events.yaml` and copy the code block below into it. ```yaml @@ -90,16 +92,16 @@ spec: serviceAccountName: events-sa mode: Resource resources: - - apiVersion: v1 - kind: Event + - apiVersion: v1 + kind: Event sink: apiVersion: eventing.knative.dev/v1alpha1 kind: Broker name: default ``` - If you want to consume events from a different namespace or use a different - `Service Account`, you need to modify `k8s-events.yaml` accordingly. +If you want to consume events from a different namespace or use a different +`Service Account`, you need to modify `k8s-events.yaml` accordingly. Enter the following command to create the event source: @@ -111,7 +113,7 @@ kubectl apply --filename k8s-events.yaml In order to check the `ApiServerSource` is fully working, we will create a simple Knative Service that dumps incoming messages to its log and creates a -`Trigger` from the `Broker` to that Knative Service. +`Trigger` from the `Broker` to that Knative Service. Create a file named `trigger.yaml` and copy the code block below into it. @@ -129,7 +131,6 @@ spec: name: event-display --- - # This is a very simple Knative Service that writes the input request to its log. apiVersion: serving.knative.dev/v1beta1 @@ -141,9 +142,9 @@ spec: template: spec: containers: - - # This corresponds to - # https://github.com/knative/eventing-contrib/blob/release-0.5/cmd/event_display/main.go - image: gcr.io/knative-releases/github.com/knative/eventing-sources/cmd/event_display@sha256:bf45b3eb1e7fc4cb63d6a5a6416cf696295484a7662e0cf9ccdf5c080542c21d + - # This corresponds to + # https://github.com/knative/eventing-contrib/blob/release-0.5/cmd/event_display/main.go + image: gcr.io/knative-releases/github.com/knative/eventing-sources/cmd/event_display@sha256:bf45b3eb1e7fc4cb63d6a5a6416cf696295484a7662e0cf9ccdf5c080542c21d ``` 1. If the deployed `ApiServerSource` is pointing at a `Broker` other than