-
Notifications
You must be signed in to change notification settings - Fork 21
Add docs for how users can go from versioned -> unversioned workers. #172
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 4 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
ae2b54d
add migration-to-unversioned docs
Shivs11 c8be3e0
cleanup
Shivs11 6bb6cae
comments
Shivs11 3c09ca5
address more comments
Shivs11 2636e99
Update docs/migration-to-unversioned.md
Shivs11 305170b
address more comments
Shivs11 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,122 @@ | ||
| # Migrating from Versioned to Unversioned Workflows | ||
|
|
||
| This guide walks you through reverting from versioned workers to unversioned workers. It assumes you have enabled worker versioning and currently have (or previously had) versioned workers polling the Temporal Server. | ||
|
|
||
| --- | ||
|
|
||
| ## Important Note | ||
|
|
||
| This guide uses specific terminology that is defined in the [Concepts](concepts.md) document. Please review the concepts document first to understand key terms like **Temporal Worker Deployment**, **`TemporalWorkerDeployment` CRD**, and **Kubernetes `Deployment`**, as well as the relationship between them. | ||
|
|
||
| ## Table of Contents | ||
|
|
||
| - [Prerequisites](#prerequisites) | ||
| - [Migration Steps](#migration-steps) | ||
| - [Step 1: Update Worker Code](#step-1-update-worker-code) | ||
| - [Step 2: Deploy the Unversioned Worker](#step-2-deploy-the-unversioned-worker) | ||
| - [Step 3: Set Current Version to Unversioned](#step-3-set-current-version-to-unversioned) | ||
| - [Monitoring the Migration](#monitoring-the-migration) | ||
| - [Cleanup and Garbage Collection](#cleanup-and-garbage-collection) | ||
|
|
||
| --- | ||
|
|
||
| ## Prerequisites | ||
|
|
||
| Before starting the migration, ensure you have: | ||
|
|
||
| - ✅ **Temporal CLI** version >= 1.5.0 | ||
|
|
||
| --- | ||
|
|
||
| ## Migration Steps | ||
|
|
||
| ### Step 1: Update Worker Code | ||
|
|
||
| Update your worker initialization code to remove versioning configuration. | ||
|
|
||
| **Before (Versioned):** | ||
|
|
||
| ```go | ||
| // Worker must use the build ID and deployment name from environment variables. | ||
| // These are set on the deployment by the controller. | ||
| buildID := os.Getenv("TEMPORAL_WORKER_BUILD_ID") | ||
| deploymentName := os.Getenv("TEMPORAL_DEPLOYMENT_NAME") | ||
| if buildID == "" || deploymentName == "" { | ||
| // exit with an error | ||
| } | ||
|
|
||
| workerOptions := worker.Options{ | ||
| DeploymentOptions: worker.DeploymentOptions{ | ||
| UseVersioning: true, | ||
| Version: worker.WorkerDeploymentVersion{ | ||
| DeploymentName: deploymentName, | ||
| BuildID: buildID, | ||
| }, | ||
| }, | ||
| } | ||
| worker := worker.New(client, "my-task-queue", workerOptions) | ||
| ``` | ||
|
|
||
| **After (Unversioned):** | ||
|
|
||
| ```go | ||
| // Worker connects without versioning | ||
| worker := worker.New(client, "my-task-queue", worker.Options{}) | ||
| ``` | ||
|
|
||
| ### Step 2: Deploy the Unversioned Worker | ||
|
|
||
| Deploy your unversioned workers, using a manner of your choice, and ensure they are polling all of the Task Queues in your Worker Deployment. This can be done by verifying their presence on the Task Queues page (https://cloud.temporal.io/namespaces/<your-namespace>/task-queues/<your-task-queue>) | ||
Shivs11 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ### Step 3: Set Current Version to Unversioned | ||
|
|
||
| Run the following Temporal CLI command to set the current version of the Worker Deployment to *unversioned*: | ||
|
|
||
| ```bash | ||
| temporal worker deployment set-current-version \ | ||
| --deployment-name <your-deployment-name> \ | ||
| --build-id "" | ||
| ``` | ||
|
|
||
| --- | ||
|
|
||
| ## Monitoring the Migration | ||
|
|
||
| After completing the migration steps: | ||
|
|
||
| 1. **Verify in the Temporal UI** that traffic is gradually shifting from versioned workers to unversioned workers. | ||
Shivs11 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| 2. **AutoUpgrade workflows** will eventually move onto the unversioned worker(s). | ||
| 3. **Pinned workflows** that were started on versioned workers will continue and complete execution on those pinned workers. | ||
Shivs11 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| 4. **New executions** of workflows, regardless of them being *Pinned* or *AutoUpgrade*, will start on the deployed unversioned workers (unless they have a versioning-override set.) | ||
Shivs11 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| --- | ||
|
|
||
| ## Cleanup and Garbage Collection | ||
|
|
||
| **NOTE**: The cleanup steps below are optional as it is not required to garbage collect the Worker Versions or Worker Deployment resources from the Temporal Server while migrating to unversioned workers. | ||
Shivs11 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ### Deleting Kubernetes Deployments created with the Worker-Controller: | ||
|
|
||
| The Worker Controller will delete Kubernetes Deployments, which represent versioned workers, based on your configured Sunset Strategy. Specifically, the Controller deletes Kubernetes Deployments for a version once the time since it became drained exceeds the combined `Scaledown` and `Delete` delay. Deleting these deployments stops the workers from polling the Temporal Server, which is a pre-requisite for deleting a Worker-Version. | ||
Shivs11 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ### Deleting Worker Versions | ||
|
|
||
| A Worker Version can be deleted once it has been drained and has no active pollers. | ||
| Once it's drained and is without active pollers, delete the Worker Version using: | ||
|
|
||
| ```bash | ||
| temporal worker deployment delete-version \ | ||
| --deployment-name <your-deployment-name> \ | ||
| --build-id <your-build-id> | ||
| ``` | ||
|
|
||
| ### Deleting the Worker Deployment | ||
|
|
||
| To delete a Worker Deployment: | ||
|
|
||
| 1. First, ensure all its Worker Versions have been deleted. | ||
| 2. Then run: | ||
|
|
||
| ```bash | ||
| temporal worker deployment delete --name <your-deployment-name> | ||
| ``` | ||
File renamed without changes.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.