From 6de1cbccf54e8d8afb6797d823ca9c96f15cb57a Mon Sep 17 00:00:00 2001 From: Roberto Rojas Date: Wed, 28 Jun 2023 19:06:28 -0400 Subject: [PATCH 1/6] documents Bindings direction metadata field Signed-off-by: Roberto Rojas --- .../content/en/reference/api/bindings_api.md | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/daprdocs/content/en/reference/api/bindings_api.md b/daprdocs/content/en/reference/api/bindings_api.md index d0981de2bbb..cdd858642d9 100644 --- a/daprdocs/content/en/reference/api/bindings_api.md +++ b/daprdocs/content/en/reference/api/bindings_api.md @@ -37,6 +37,42 @@ If running on kubernetes apply the component to your cluster. > **Note:** In production never place passwords or secrets within Dapr component files. For information on securely storing and retrieving secrets using secret stores refer to [Setup Secret Store]({{< ref setup-secret-store >}}) +### Binding direction (optional) + +There are scenarios where it would be useful to provide additional information to Dapr to indicate the direction supported by the Binding Component. +This should help Dapr avoid situations where the Dapr sidecar stays in the `"wait for the app to become ready"` state waiting indefinetely for the application to become available. + +The `direction` field can be specified as part of the component's metadata. The valid values for this field are: `"input"`, `"output"`, or `"input, output"` + +Here a few scenarios when the `"direction"` metadata field could help: + +- When an application (detached from the sidecar) runs as a serverless workload and its scaled to 0, the check done by the dapr sidecar to wait for the app to become ready becomes pointless. + +- If the detached dapr sidecar is what is scaled to 0 and the first thing the application does (before even start an http server) is reaching the sidecar the "wait for the app to become ready" gets the app and the sidecar into a dead lock of both ends waiting for each other. + +### Example + +```yaml +apiVersion: dapr.io/v1alpha1 +kind: Component +metadata: + name: kafkaevent +spec: + type: bindings.kafka + version: v1 + metadata: + - name: brokers + value: "http://localhost:5050" + - name: topics + value: "someTopic" + - name: publishTopic + value: "someTopic2" + - name: consumerGroup + value: "group1" + - name: "direction" + value: "input, output" +``` + ## Invoking Service Code Through Input Bindings A developer who wants to trigger their app using an input binding can listen on a `POST` http endpoint with the route name being the same as `metadata.name`. From 317c2a1b3a90ada6f6e0387a9f59008704ffa928 Mon Sep 17 00:00:00 2001 From: Roberto Rojas Date: Thu, 29 Jun 2023 14:43:03 -0400 Subject: [PATCH 2/6] Update daprdocs/content/en/reference/api/bindings_api.md Co-authored-by: Hannah Hunter <94493363+hhunter-ms@users.noreply.github.com> Signed-off-by: Roberto Rojas --- daprdocs/content/en/reference/api/bindings_api.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/daprdocs/content/en/reference/api/bindings_api.md b/daprdocs/content/en/reference/api/bindings_api.md index cdd858642d9..e1a95cd4568 100644 --- a/daprdocs/content/en/reference/api/bindings_api.md +++ b/daprdocs/content/en/reference/api/bindings_api.md @@ -39,7 +39,7 @@ If running on kubernetes apply the component to your cluster. ### Binding direction (optional) -There are scenarios where it would be useful to provide additional information to Dapr to indicate the direction supported by the Binding Component. +In some scenarios, it would be useful to provide additional information to Dapr to indicate the direction supported by the binding component. This should help Dapr avoid situations where the Dapr sidecar stays in the `"wait for the app to become ready"` state waiting indefinetely for the application to become available. The `direction` field can be specified as part of the component's metadata. The valid values for this field are: `"input"`, `"output"`, or `"input, output"` From cd30098a5ab2343eb38b0ef13e7fda81f76ea979 Mon Sep 17 00:00:00 2001 From: Roberto Rojas Date: Thu, 29 Jun 2023 14:43:09 -0400 Subject: [PATCH 3/6] Update daprdocs/content/en/reference/api/bindings_api.md Co-authored-by: Hannah Hunter <94493363+hhunter-ms@users.noreply.github.com> Signed-off-by: Roberto Rojas --- daprdocs/content/en/reference/api/bindings_api.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/daprdocs/content/en/reference/api/bindings_api.md b/daprdocs/content/en/reference/api/bindings_api.md index e1a95cd4568..f8de3afff06 100644 --- a/daprdocs/content/en/reference/api/bindings_api.md +++ b/daprdocs/content/en/reference/api/bindings_api.md @@ -40,7 +40,7 @@ If running on kubernetes apply the component to your cluster. ### Binding direction (optional) In some scenarios, it would be useful to provide additional information to Dapr to indicate the direction supported by the binding component. -This should help Dapr avoid situations where the Dapr sidecar stays in the `"wait for the app to become ready"` state waiting indefinetely for the application to become available. +Providing the supported binding direction helps the Dapr sidecar avoid the `"wait for the app to become ready"` state, where it waits indefinitely for the application to become available. The `direction` field can be specified as part of the component's metadata. The valid values for this field are: `"input"`, `"output"`, or `"input, output"` From 4c28dcbf6c48f28115102824e9c62e5040b1115e Mon Sep 17 00:00:00 2001 From: Roberto Rojas Date: Thu, 29 Jun 2023 14:43:14 -0400 Subject: [PATCH 4/6] Update daprdocs/content/en/reference/api/bindings_api.md Co-authored-by: Hannah Hunter <94493363+hhunter-ms@users.noreply.github.com> Signed-off-by: Roberto Rojas --- daprdocs/content/en/reference/api/bindings_api.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/daprdocs/content/en/reference/api/bindings_api.md b/daprdocs/content/en/reference/api/bindings_api.md index f8de3afff06..016240984ca 100644 --- a/daprdocs/content/en/reference/api/bindings_api.md +++ b/daprdocs/content/en/reference/api/bindings_api.md @@ -42,7 +42,10 @@ If running on kubernetes apply the component to your cluster. In some scenarios, it would be useful to provide additional information to Dapr to indicate the direction supported by the binding component. Providing the supported binding direction helps the Dapr sidecar avoid the `"wait for the app to become ready"` state, where it waits indefinitely for the application to become available. -The `direction` field can be specified as part of the component's metadata. The valid values for this field are: `"input"`, `"output"`, or `"input, output"` +You can specify the `direction` field as part of the component's metadata. The valid values for this field are: +- `"input"` +- `"output"` +- `"input, output"` Here a few scenarios when the `"direction"` metadata field could help: From 2f5a895729ebcd1cff7677a142dab79bee792c7d Mon Sep 17 00:00:00 2001 From: Roberto Rojas Date: Thu, 29 Jun 2023 14:43:19 -0400 Subject: [PATCH 5/6] Update daprdocs/content/en/reference/api/bindings_api.md Co-authored-by: Hannah Hunter <94493363+hhunter-ms@users.noreply.github.com> Signed-off-by: Roberto Rojas --- daprdocs/content/en/reference/api/bindings_api.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/daprdocs/content/en/reference/api/bindings_api.md b/daprdocs/content/en/reference/api/bindings_api.md index 016240984ca..0754479ac2f 100644 --- a/daprdocs/content/en/reference/api/bindings_api.md +++ b/daprdocs/content/en/reference/api/bindings_api.md @@ -49,7 +49,7 @@ You can specify the `direction` field as part of the component's metadata. The v Here a few scenarios when the `"direction"` metadata field could help: -- When an application (detached from the sidecar) runs as a serverless workload and its scaled to 0, the check done by the dapr sidecar to wait for the app to become ready becomes pointless. +- When an application (detached from the sidecar) runs as a serverless workload and is scaled to zero, the `"wait for the app to become ready"` check done by the Dapr sidecar becomes pointless. - If the detached dapr sidecar is what is scaled to 0 and the first thing the application does (before even start an http server) is reaching the sidecar the "wait for the app to become ready" gets the app and the sidecar into a dead lock of both ends waiting for each other. From 85a59ea8e67ec212cc79d2c5376e7461f71cc4b9 Mon Sep 17 00:00:00 2001 From: Roberto Rojas Date: Thu, 29 Jun 2023 14:43:25 -0400 Subject: [PATCH 6/6] Update daprdocs/content/en/reference/api/bindings_api.md Co-authored-by: Hannah Hunter <94493363+hhunter-ms@users.noreply.github.com> Signed-off-by: Roberto Rojas --- daprdocs/content/en/reference/api/bindings_api.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/daprdocs/content/en/reference/api/bindings_api.md b/daprdocs/content/en/reference/api/bindings_api.md index 0754479ac2f..d7170ff7b44 100644 --- a/daprdocs/content/en/reference/api/bindings_api.md +++ b/daprdocs/content/en/reference/api/bindings_api.md @@ -51,7 +51,7 @@ Here a few scenarios when the `"direction"` metadata field could help: - When an application (detached from the sidecar) runs as a serverless workload and is scaled to zero, the `"wait for the app to become ready"` check done by the Dapr sidecar becomes pointless. -- If the detached dapr sidecar is what is scaled to 0 and the first thing the application does (before even start an http server) is reaching the sidecar the "wait for the app to become ready" gets the app and the sidecar into a dead lock of both ends waiting for each other. +- If the detached Dapr sidecar is scaled to zero and the application reaches the sidecar (before even starting an HTTP server), the `"wait for the app to become ready"` deadlocks the app and the sidecar into waiting for each other. ### Example