Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions docs/eventing/sources/sinkbinding/getting-started.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Create a SinkBinding object
# Creating a SinkBinding object

![API version v1](https://img.shields.io/badge/API_Version-v1-red?style=flat-square)
Comment thread
abrennan89 marked this conversation as resolved.

Expand Down Expand Up @@ -88,7 +88,7 @@ create a Knative service.
For example:

```bash
$ kn service create hello --image gcr.io/knative-releases/knative.dev/eventing-contrib/cmd/event_display
$ kn service create event-display --image gcr.io/knative-releases/knative.dev/eventing-contrib/cmd/event_display
```

=== "YAML"
Expand Down Expand Up @@ -224,11 +224,11 @@ Create a `SinkBinding` object that directs events from your subject to the sink.
selector:
matchLabels:
<label-key>: <label-value>
sink:
ref:
apiVersion: serving.knative.dev/v1
kind: Service
name: <sink>
sink:
ref:
apiVersion: serving.knative.dev/v1
kind: Service
name: <sink>
EOF
```
Where:
Expand Down
73 changes: 52 additions & 21 deletions docs/eventing/sources/sinkbinding/reference.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# SinkBinding reference

![API version v1](https://img.shields.io/badge/API_Version-v1-red?style=flat-square)

This topic provides reference information about the configurable fields for the
SinkBinding object.

Expand Down Expand Up @@ -47,13 +49,19 @@ resulting in `"http://mysink.default.svc.cluster.local/extra/path"`.
<!-- TODO we should have a page to point to describing the ref+uri destinations and the rules we use to resolve those and reuse the page. -->

```yaml
sink:
ref:
apiVersion: v1
kind: Service
namespace: default
name: mysink
uri: /extra/path
apiVersion: sources.knative.dev/v1
kind: SinkBinding
metadata:
name: bind-heartbeat
spec:
...
sink:
ref:
apiVersion: v1
kind: Service
namespace: default
name: mysink
uri: /extra/path
```

!!! contract
Expand Down Expand Up @@ -86,35 +94,52 @@ A `subject` definition supports the following fields:
Given the following YAML, the `Deployment` named `mysubject` in the `default`
namespace is selected:

```yaml
```yaml
apiVersion: sources.knative.dev/v1
kind: SinkBinding
metadata:
name: bind-heartbeat
spec:
subject:
apiVersion: apps/v1
kind: Deployment
namespace: default
name: mysubject
```
...
```

#### Example: Subject parameter using matchLabels

Given the following YAML, any `Job` with the label `working=example` in the
`default` namespace is selected:

```yaml
```yaml
apiVersion: sources.knative.dev/v1
kind: SinkBinding
metadata:
name: bind-heartbeat
spec:
subject:
apiVersion: batch/v1beta1
kind: Job
namespace: default
selector:
matchLabels:
working: example
```
...
```

#### Example: Subject parameter using matchExpression

Given the following YAML, any `Pod` with the label `working=example` OR
`working=sample` in the ` default` namespace is selected:

```yaml
```yaml
apiVersion: sources.knative.dev/v1
kind: SinkBinding
metadata:
name: bind-heartbeat
spec:
subject:
apiVersion: v1
kind: Pod
Expand All @@ -126,7 +151,8 @@ Given the following YAML, any `Pod` with the label `working=example` OR
values:
- example
- sample
```
...
```


### CloudEvent Overrides
Expand All @@ -149,19 +175,24 @@ A `ceOverrides` definition supports the following fields:
#### Example: CloudEvent Overrides

```yaml
ceOverrides:
extensions:
extra: this is an extra attribute
additional: 42
apiVersion: sources.knative.dev/v1
kind: SinkBinding
metadata:
name: bind-heartbeat
spec:
...
ceOverrides:
extensions:
extra: this is an extra attribute
additional: 42
```

!!! contract
This results in the `K_CE_OVERRIDES` environment variable being set on the
`subject` as follows:

```json
{ "extensions": { "extra": "this is an extra attribute", "additional": "42" } }
```
```{ .json .no-copy }
{ "extensions": { "extra": "this is an extra attribute", "additional": "42" } }
```

[kubernetes-overview]:
https://kubernetes.io/docs/concepts/overview/working-with-objects/kubernetes-objects/#required-fields
Expand Down
2 changes: 1 addition & 1 deletion mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ nav:
- PingSource: eventing/sources/ping-source/README.md
- SinkBinding:
- Overview: eventing/sources/sinkbinding/README.md
- Create a SinkBinding object: eventing/sources/sinkbinding/getting-started.md
- Creating a SinkBinding object: eventing/sources/sinkbinding/getting-started.md
- SinkBinding reference: eventing/sources/sinkbinding/reference.md
- Camel source: eventing/sources/apache-camel-source/README.md
- Kafka source: eventing/sources/kafka-source/README.md
Expand Down