Skip to content

Commit 80ab0ac

Browse files
Format markdown (#1518)
Produced via: `prettier --write --prose-wrap=always $(find -name '*.md' | grep -v vendor | grep -v .github)` /assign @samodell
1 parent 5f44369 commit 80ab0ac

File tree

1 file changed

+30
-29
lines changed
  • docs/eventing/samples/kubernetes-event-source

1 file changed

+30
-29
lines changed

docs/eventing/samples/kubernetes-event-source/README.md

Lines changed: 30 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
Kubernetes Event Source example shows how to wire kubernetes cluster events for
2-
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.
2+
consumption by a function that has been implemented as a Knative Service. The
3+
code for the following files can be found in the
4+
[/kubernetes-event-source/](https://github.com/knative/docs/tree/master/docs/eventing/samples/kubernetes-event-source)
5+
directory.
36

47
## Deployment Steps
58

@@ -23,9 +26,8 @@ kubectl label namespace default knative-eventing-injection=enabled
2326

2427
1. Create a Service Account that the `ApiServerSource` runs as. The
2528
`ApiServerSource` watches for Kubernetes events and forwards them to the
26-
Knative Eventing Broker.
27-
Create a file named `serviceaccount.yaml` and copy the code block
28-
below into it.
29+
Knative Eventing Broker. Create a file named `serviceaccount.yaml` and copy
30+
the code block below into it.
2931

3032
```yaml
3133
apiVersion: v1
@@ -35,23 +37,21 @@ metadata:
3537
namespace: default
3638

3739
---
38-
3940
apiVersion: rbac.authorization.k8s.io/v1
4041
kind: ClusterRole
4142
metadata:
4243
name: event-watcher
4344
rules:
44-
- apiGroups:
45-
- ""
46-
resources:
47-
- events
48-
verbs:
49-
- get
50-
- list
51-
- watch
45+
- apiGroups:
46+
- ""
47+
resources:
48+
- events
49+
verbs:
50+
- get
51+
- list
52+
- watch
5253

5354
---
54-
5555
apiVersion: rbac.authorization.k8s.io/v1
5656
kind: ClusterRoleBinding
5757
metadata:
@@ -61,14 +61,16 @@ roleRef:
6161
kind: ClusterRole
6262
name: event-watcher
6363
subjects:
64-
- kind: ServiceAccount
65-
name: events-sa
66-
namespace: default
64+
- kind: ServiceAccount
65+
name: events-sa
66+
namespace: default
6767
```
6868
69-
If you want to re-use an existing Service Account with the appropriate permissions, you need to modify the `serviceaccount.yaml`.
69+
If you want to re-use an existing Service Account with the appropriate
70+
permissions, you need to modify the `serviceaccount.yaml`.
7071

71-
Enter the following command to create the service account from `serviceaccount.yaml`:
72+
Enter the following command to create the service account from
73+
`serviceaccount.yaml`:
7274

7375
```shell
7476
kubectl apply --filename serviceaccount.yaml
@@ -77,7 +79,7 @@ kubectl apply --filename serviceaccount.yaml
7779
### Create Event Source for Kubernetes Events
7880

7981
1. In order to receive events, you have to create a concrete Event Source for a
80-
specific namespace. Create a file named `k8s-events.yaml` and copy the code
82+
specific namespace. Create a file named `k8s-events.yaml` and copy the code
8183
block below into it.
8284

8385
```yaml
@@ -90,16 +92,16 @@ spec:
9092
serviceAccountName: events-sa
9193
mode: Resource
9294
resources:
93-
- apiVersion: v1
94-
kind: Event
95+
- apiVersion: v1
96+
kind: Event
9597
sink:
9698
apiVersion: eventing.knative.dev/v1alpha1
9799
kind: Broker
98100
name: default
99101
```
100102

101-
If you want to consume events from a different namespace or use a different
102-
`Service Account`, you need to modify `k8s-events.yaml` accordingly.
103+
If you want to consume events from a different namespace or use a different
104+
`Service Account`, you need to modify `k8s-events.yaml` accordingly.
103105

104106
Enter the following command to create the event source:
105107

@@ -111,7 +113,7 @@ kubectl apply --filename k8s-events.yaml
111113

112114
In order to check the `ApiServerSource` is fully working, we will create a
113115
simple Knative Service that dumps incoming messages to its log and creates a
114-
`Trigger` from the `Broker` to that Knative Service.
116+
`Trigger` from the `Broker` to that Knative Service.
115117

116118
Create a file named `trigger.yaml` and copy the code block below into it.
117119

@@ -129,7 +131,6 @@ spec:
129131
name: event-display
130132
131133
---
132-
133134
# This is a very simple Knative Service that writes the input request to its log.
134135
135136
apiVersion: serving.knative.dev/v1beta1
@@ -141,9 +142,9 @@ spec:
141142
template:
142143
spec:
143144
containers:
144-
- # This corresponds to
145-
# https://github.com/knative/eventing-contrib/blob/release-0.5/cmd/event_display/main.go
146-
image: gcr.io/knative-releases/github.com/knative/eventing-sources/cmd/event_display@sha256:bf45b3eb1e7fc4cb63d6a5a6416cf696295484a7662e0cf9ccdf5c080542c21d
145+
- # This corresponds to
146+
# https://github.com/knative/eventing-contrib/blob/release-0.5/cmd/event_display/main.go
147+
image: gcr.io/knative-releases/github.com/knative/eventing-sources/cmd/event_display@sha256:bf45b3eb1e7fc4cb63d6a5a6416cf696295484a7662e0cf9ccdf5c080542c21d
147148
```
148149

149150
1. If the deployed `ApiServerSource` is pointing at a `Broker` other than

0 commit comments

Comments
 (0)