From 101505ab222486015d42506b1a65274c3e09c87f Mon Sep 17 00:00:00 2001 From: Josh van Leeuwen Date: Sat, 17 Feb 2024 00:35:45 +0000 Subject: [PATCH 1/3] Hot reloading: add notes about the behaviour and exceptions (#4027) * Hot reloading: add notes about the behaviour and exceptions Moves hot reloading to a separate section in `component-updates.md`. Adds notes about the behaviour of hot reloading regarding downtime and respecting init errors. Adds exceptions to the component types ignored by hot reloading. Signed-off-by: joshvanl * Adds link ref to workflow backends in unsupported hot reload Signed-off-by: joshvanl * Update component-updates.md Edited "wills" to be present tense Signed-off-by: Mark Fussell --------- Signed-off-by: joshvanl Signed-off-by: Mark Fussell Co-authored-by: Mark Fussell --- .../components/component-updates.md | 42 +++++++++++++------ .../support/support-preview-features.md | 2 +- 2 files changed, 31 insertions(+), 13 deletions(-) diff --git a/daprdocs/content/en/operations/components/component-updates.md b/daprdocs/content/en/operations/components/component-updates.md index fb8a9313ce6..0c1f870c14a 100644 --- a/daprdocs/content/en/operations/components/component-updates.md +++ b/daprdocs/content/en/operations/components/component-updates.md @@ -6,27 +6,45 @@ weight: 300 description: "Updating deployed components used by applications" --- -When making an update to an existing deployed component used by an application, Dapr does not update the component automatically unless the `HotReload` feature gate is enabled. +When making an update to an existing deployed component used by an application, Dapr does not update the component automatically unless the [`HotReload`](#hot-reloading-preview-feature) feature gate is enabled. The Dapr sidecar needs to be restarted in order to pick up the latest version of the component. How this is done depends on the hosting environment. -{{% alert title="Note" color="primary" %}} -Dapr can be made to "hot reload" components, where updates are picked up automatically without needing a restart. -This is enabled by via the [`HotReload` feature gate]({{< ref "support-preview-features.md" >}}). -All component types are supported for hot reloading. -This feature is currently in preview. -{{% /alert %}} - -## Kubernetes +### Kubernetes When running in Kubernetes, the process of updating a component involves two steps: 1. Apply the new component YAML to the desired namespace -1. Unless the [`HotReload` feature gate is enabled]({{< ref "support-preview-features.md" >}}), perform a [rollout restart operation](https://kubernetes.io/docs/reference/kubectl/cheatsheet/#updating-resources) on your deployments to pick up the latest component +1. Unless the [`HotReload` feature gate is enabled](#hot-reloading-preview-feature), perform a [rollout restart operation](https://kubernetes.io/docs/reference/kubectl/cheatsheet/#updating-resources) on your deployments to pick up the latest component + +### Self Hosted + +Unless the [`HotReload` feature gate is enabled](#hot-reloading-preview-feature), the process of updating a component involves a single step of stopping and restarting the `daprd` process to pick up the latest component. + +## Hot Reloading (Preview Feature) -## Self Hosted +> This feature is currently in [preview]({{< ref "preview-features.md" >}}). +> Hot reloading is enabled by via the [`HotReload` feature gate]({{< ref "support-preview-features.md" >}}). + +Dapr can be made to "hot reload" components whereby component updates are picked up automatically without the need to restart the Dapr sidecar process or Kubernetes pod. +This means creating, updating, or deleting a component manifest will be reflected in the Dapr sidecar during runtime. + +{{% alert title="Updating Components" color="warning" %}} +When a component is updated it is first closed, and then re-initialized using the new configuration. +This causes the component to be unavailable for a short period of time during this process. +{{% /alert %}} + +{{% alert title="Initialization Errors" color="warning" %}} +If the initialization processes errors when a component is created or updated through hot reloading, the Dapr sidecar respects the component field [`spec.ignoreErrors`]({{< ref component-schema.md>}}). +That is, the behaviour is the same as when the sidecar loads components on boot. +- `spec.ignoreErrors=false` (*default*): the sidecar gracefully shuts down. +- `spec.ignoreErrors=true`: the sidecar continues to run with neither the old or new component configuration registered. +{{% /alert %}} -Unless the [`HotReload` feature gate is enabled]({{< ref "support-preview-features.md" >}}), the process of updating a component involves a single step of stopping and restarting the `daprd` process to pick up the latest component. +All components are supported for hot reloading except for the following types. +Any create, update, or deletion of these component types is ignored by the sidecar with a restart required to pick up changes. +- [Actor State Stores]({{< ref "state_api.md#configuring-state-store-for-actors" >}}) +- [Workflow Backends]({{< ref "workflow-architecture.md#workflow-backend" >}}) ## Further reading - [Components concept]({{< ref components-concept.md >}}) diff --git a/daprdocs/content/en/operations/support/support-preview-features.md b/daprdocs/content/en/operations/support/support-preview-features.md index cd7fa499181..1693971e44c 100644 --- a/daprdocs/content/en/operations/support/support-preview-features.md +++ b/daprdocs/content/en/operations/support/support-preview-features.md @@ -22,4 +22,4 @@ For CLI there is no explicit opt-in, just the version that this was first made a | **Service invocation for non-Dapr endpoints** | Allow the invocation of non-Dapr endpoints by Dapr using the [Service invocation API]({{< ref service_invocation_api.md >}}). Read ["How-To: Invoke Non-Dapr Endpoints using HTTP"]({{< ref howto-invoke-non-dapr-endpoints.md >}}) for more information. | N/A | [Service invocation API]({{< ref service_invocation_api.md >}}) | v1.11 | | **Actor State TTL** | Allow actors to save records to state stores with Time To Live (TTL) set to automatically clean up old data. In its current implementation, actor state with TTL may not be reflected correctly by clients, read [Actor State Transactions]({{< ref actors_api.md >}}) for more information. | `ActorStateTTL` | [Actor State Transactions]({{< ref actors_api.md >}}) | v1.11 | | **Transactional Outbox** | Allows state operations for inserts and updates to be published to a configured pub/sub topic using a single transaction across the state store and the pub/sub | N/A | [Transactional Outbox Feature]({{< ref howto-outbox.md >}}) | v1.12 | -| **Component Hot Reloading** | Allows for Dapr-loaded components to be "hot reloaded". A component spec is reloaded when it is created/updated/deleted in Kubernetes or on file when running in self-hosted mode.| `HotReload`| [Hot Reloading]({{< ref components-concept.md >}}) | v1.13 | +| **Component Hot Reloading** | Allows for Dapr-loaded components to be "hot reloaded". A component spec is reloaded when it is created/updated/deleted in Kubernetes or on file when running in self-hosted mode. Ignores changes to actor state stores and workflow backends. | `HotReload`| [Hot Reloading]({{< ref components-concept.md >}}) | v1.13 | From d9cbcbad3b7b4b5237d8e893bc24e46f6dd1288b Mon Sep 17 00:00:00 2001 From: Hannah Hunter <94493363+hhunter-ms@users.noreply.github.com> Date: Tue, 20 Feb 2024 08:55:21 -0500 Subject: [PATCH 2/3] Update daprdocs/content/en/developing-applications/building-blocks/workflow/howto-manage-workflow.md Co-authored-by: Marc Duiker Signed-off-by: Hannah Hunter <94493363+hhunter-ms@users.noreply.github.com> --- .../building-blocks/workflow/howto-manage-workflow.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/daprdocs/content/en/developing-applications/building-blocks/workflow/howto-manage-workflow.md b/daprdocs/content/en/developing-applications/building-blocks/workflow/howto-manage-workflow.md index ae779347ec8..07198da0975 100644 --- a/daprdocs/content/en/developing-applications/building-blocks/workflow/howto-manage-workflow.md +++ b/daprdocs/content/en/developing-applications/building-blocks/workflow/howto-manage-workflow.md @@ -394,6 +394,6 @@ Learn more about these HTTP calls in the [workflow API reference guide]({{< ref - [JavaScript example](https://github.com/dapr/js-sdk/tree/main/examples/workflow) - [.NET example](https://github.com/dapr/dotnet-sdk/tree/master/examples/Workflow) - [Java example](https://github.com/dapr/java-sdk/tree/master/examples/src/main/java/io/dapr/examples/workflows) - - [Go example](todo) + - [Go example](https://github.com/dapr/go-sdk/tree/main/examples/workflow) - [Workflow API reference]({{< ref workflow_api.md >}}) From e36ecc1715285f79a63dc0d68d2669a0a4d04743 Mon Sep 17 00:00:00 2001 From: Hannah Hunter <94493363+hhunter-ms@users.noreply.github.com> Date: Tue, 20 Feb 2024 09:49:41 -0500 Subject: [PATCH 3/3] Update daprdocs/content/en/developing-applications/building-blocks/workflow/howto-manage-workflow.md Co-authored-by: Mark Fussell Signed-off-by: Hannah Hunter <94493363+hhunter-ms@users.noreply.github.com> --- .../building-blocks/workflow/howto-manage-workflow.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/daprdocs/content/en/developing-applications/building-blocks/workflow/howto-manage-workflow.md b/daprdocs/content/en/developing-applications/building-blocks/workflow/howto-manage-workflow.md index 07198da0975..0b0bad38fc2 100644 --- a/daprdocs/content/en/developing-applications/building-blocks/workflow/howto-manage-workflow.md +++ b/daprdocs/content/en/developing-applications/building-blocks/workflow/howto-manage-workflow.md @@ -173,7 +173,7 @@ await daprClient.PurgeWorkflowAsync(orderId, workflowComponent); {{% codetab %}} -Manage your workflow within your code. [In the workflow example from the Java SDK](https://github.com/dapr/java-sdk/blob/master/examples/src/main/java/io/dapr/examples/workflows/DemoWorkflowClient.java), the workflow is registered in the code using the following APIs: +Manage your workflow within your code. [In the workflow example from the Java SDK](https://github.com/dapr/java-sdk/blob/master/examples/src/main/java/io/dapr/examples/workflows/), the workflow is registered in the code using the following APIs: - **scheduleNewWorkflow**: Starts a new workflow instance - **getInstanceState**: Get information on the status of the workflow