From 0a76949328c10cfa4fb265abfd0cead8eb4ac8e0 Mon Sep 17 00:00:00 2001 From: Samia Nneji Date: Mon, 14 Jun 2021 12:50:43 +0100 Subject: [PATCH 1/5] Add context to code snippets --- .../eventing/sources/sinkbinding/reference.md | 50 ++++++++++++++----- 1 file changed, 37 insertions(+), 13 deletions(-) diff --git a/docs/eventing/sources/sinkbinding/reference.md b/docs/eventing/sources/sinkbinding/reference.md index 9b82167d12c..978ddf6358e 100644 --- a/docs/eventing/sources/sinkbinding/reference.md +++ b/docs/eventing/sources/sinkbinding/reference.md @@ -47,13 +47,19 @@ resulting in `"http://mysink.default.svc.cluster.local/extra/path"`. ```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 @@ -86,20 +92,31 @@ 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 @@ -107,14 +124,20 @@ Given the following YAML, any `Job` with the label `working=example` in the 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 @@ -126,7 +149,8 @@ Given the following YAML, any `Pod` with the label `working=example` OR values: - example - sample - ``` + ... +``` ### CloudEvent Overrides From 4c4953d2f5374ba628c5d8f69de520bbd5da223a Mon Sep 17 00:00:00 2001 From: Samia Nneji Date: Mon, 14 Jun 2021 12:51:10 +0100 Subject: [PATCH 2/5] A few other tweaks --- .../sources/sinkbinding/getting-started.md | 14 ++++++------- .../eventing/sources/sinkbinding/reference.md | 21 ++++++++++++------- mkdocs.yml | 2 +- 3 files changed, 21 insertions(+), 16 deletions(-) diff --git a/docs/eventing/sources/sinkbinding/getting-started.md b/docs/eventing/sources/sinkbinding/getting-started.md index 0468f3bc2af..faac94feea1 100644 --- a/docs/eventing/sources/sinkbinding/getting-started.md +++ b/docs/eventing/sources/sinkbinding/getting-started.md @@ -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) @@ -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" @@ -224,11 +224,11 @@ Create a `SinkBinding` object that directs events from your subject to the sink. selector: matchLabels: : - sink: - ref: - apiVersion: serving.knative.dev/v1 - kind: Service - name: + sink: + ref: + apiVersion: serving.knative.dev/v1 + kind: Service + name: EOF ``` Where: diff --git a/docs/eventing/sources/sinkbinding/reference.md b/docs/eventing/sources/sinkbinding/reference.md index 978ddf6358e..09c2a51f4fe 100644 --- a/docs/eventing/sources/sinkbinding/reference.md +++ b/docs/eventing/sources/sinkbinding/reference.md @@ -173,19 +173,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 diff --git a/mkdocs.yml b/mkdocs.yml index 854fd2fe872..419cc6a6ed2 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -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 From 1900d0e6af0d24c14e8d1fec4edfb561115f38c7 Mon Sep 17 00:00:00 2001 From: Samia Nneji Date: Mon, 14 Jun 2021 13:13:48 +0100 Subject: [PATCH 3/5] Remove duplicate API label --- docs/eventing/sources/sinkbinding/getting-started.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/docs/eventing/sources/sinkbinding/getting-started.md b/docs/eventing/sources/sinkbinding/getting-started.md index faac94feea1..0afcd500f6d 100644 --- a/docs/eventing/sources/sinkbinding/getting-started.md +++ b/docs/eventing/sources/sinkbinding/getting-started.md @@ -1,7 +1,5 @@ # Creating a SinkBinding object -![API version v1](https://img.shields.io/badge/API_Version-v1-red?style=flat-square) - This topic describes how to create a SinkBinding object. SinkBinding resolves a sink as a URI, sets the URI in the environment variable `K_SINK`, and adds the URI to a subject using `K_SINK`. From 51fb9f8e934ae2cf6c15e5680c5345dbdcc49400 Mon Sep 17 00:00:00 2001 From: Samia Nneji Date: Wed, 16 Jun 2021 14:22:43 +0100 Subject: [PATCH 4/5] Add back API label --- docs/eventing/sources/sinkbinding/getting-started.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/eventing/sources/sinkbinding/getting-started.md b/docs/eventing/sources/sinkbinding/getting-started.md index 0afcd500f6d..faac94feea1 100644 --- a/docs/eventing/sources/sinkbinding/getting-started.md +++ b/docs/eventing/sources/sinkbinding/getting-started.md @@ -1,5 +1,7 @@ # Creating a SinkBinding object +![API version v1](https://img.shields.io/badge/API_Version-v1-red?style=flat-square) + This topic describes how to create a SinkBinding object. SinkBinding resolves a sink as a URI, sets the URI in the environment variable `K_SINK`, and adds the URI to a subject using `K_SINK`. From 14ebf8d0bfbaabb87be45b8ee9110a265a0e5076 Mon Sep 17 00:00:00 2001 From: Samia Nneji Date: Wed, 16 Jun 2021 14:23:16 +0100 Subject: [PATCH 5/5] Add API version label --- docs/eventing/sources/sinkbinding/reference.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/eventing/sources/sinkbinding/reference.md b/docs/eventing/sources/sinkbinding/reference.md index 09c2a51f4fe..58bd07ba9e0 100644 --- a/docs/eventing/sources/sinkbinding/reference.md +++ b/docs/eventing/sources/sinkbinding/reference.md @@ -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.