Skip to content

Commit 4e67acc

Browse files
authored
Update local README + demo (#94)
<!--- Note to EXTERNAL Contributors --> <!-- Thanks for opening a PR! If it is a significant code change, please **make sure there is an open issue** for this. We work best with you when we have accepted the idea first before you code. --> <!--- For ALL Contributors 👇 --> ## What was changed - updated the README so that folks can follow these instructions and test out our worker-controller! - also updated the skaffold file so that building the controller image and deploying to a local k8s cluster is pain-free. ## Why? - to partially solve #88; the first half where I clean up the conceptual overview (README present in the root of this repo) shall be coming out soon! ## Checklist <!--- add/delete as needed ---> 1. Closes <!-- add issue number here --> - fixes #88 3. How was this tested: - ran all these commands locally and they work 4. Any docs updates needed? <!--- update README if applicable or point out where to update docs.temporal.io -->
1 parent fc3f632 commit 4e67acc

File tree

6 files changed

+142
-151
lines changed

6 files changed

+142
-151
lines changed

internal/README.md

Lines changed: 0 additions & 71 deletions
This file was deleted.

internal/demo/README.md

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
# Local Development Setup
2+
3+
This guide will help you set up and run the Temporal Worker Controller locally using Minikube.
4+
5+
### Prerequisites
6+
7+
- [Minikube](https://minikube.sigs.k8s.io/docs/start/)
8+
- [Helm](https://helm.sh/docs/intro/install/)
9+
- [Skaffold](https://skaffold.dev/docs/install/)
10+
- [kubectl](https://kubernetes.io/docs/tasks/tools/install-kubectl/)
11+
- Temporal Cloud account with mTLS certificates
12+
- Understanding of [Worker Versioning concepts](https://docs.temporal.io/production-deployment/worker-deployments/worker-versioning) (Pinned and Auto-Upgrade versioning behaviors)
13+
14+
> **Note**: This demo specifically showcases **Pinned** workflow behavior. All workflows in the demo will remain on the worker version where they started, demonstrating how the controller safely manages multiple worker versions simultaneously during deployments.
15+
16+
### Running the Local Demo
17+
18+
1. Start a local Minikube cluster:
19+
```bash
20+
minikube start
21+
```
22+
23+
2. Set up Temporal Cloud mTLS certificates:
24+
- Create a `certs` directory in the project root
25+
- Save your Temporal Cloud mTLS client certificates as:
26+
- `certs/client.pem`
27+
- `certs/client.key`
28+
- Create the Kubernetes secret:
29+
```bash
30+
make create-cloud-mtls-secret
31+
```
32+
33+
3. Build and deploy the Controller image to the local k8s cluster:
34+
```bash
35+
skaffold dev --profile worker-controller
36+
```
37+
38+
### Testing Progressive Deployments
39+
40+
4. **Deploy the v1 worker**:
41+
```bash
42+
skaffold dev --profile helloworld-worker
43+
```
44+
This deploys a TemporalWorkerDeployment and TemporalConnection Custom Resource using the **Progressive strategy**. Note that when there is no current version (as in an initial versioned worker deployment), the progressive steps are skipped and v1 becomes the current version immediately. All new workflow executions will now start on v1.
45+
46+
5. Watch the deployment status:
47+
```bash
48+
watch kubectl get twd
49+
```
50+
51+
6. **Apply load** to the v1 worker to simulate production traffic:
52+
```bash
53+
make apply-load-sample-workflow
54+
```
55+
56+
#### **Progressive Rollout of v2** (Non-Replay-Safe Change)
57+
58+
7. **Deploy a non-replay-safe workflow change**:
59+
```bash
60+
git apply internal/demo/helloworld/changes/no-version-gate.patch
61+
```
62+
This applies a **non-replay-safe change** (switching from custom Sleep activity to built-in `workflow.Sleep`).
63+
Skaffold automatically detects the change and deploys worker v2.
64+
65+
8. **Observe the progressive rollout managing incompatible versions**:
66+
- New workflow executions gradually shift from v1 to v2 following the configured rollout steps (1% → 5% → 10% → 50% → 100%)
67+
- **Both worker versions run simultaneously** - this is critical since the code changes are incompatible
68+
- v1 workers continue serving existing workflows (which would fail to replay on v2)
69+
- v2 workers handle new workflow executions with the updated code
70+
- This demonstrates how **Progressive rollout** safely handles breaking changes when you have existing traffic
71+
72+
### Monitoring
73+
74+
You can monitor the controller's logs and the worker's status using:
75+
```bash
76+
# Fetch the controller pod name
77+
minikube kubectl -- get pods -n temporal-worker-controller -w
78+
79+
# Describe the controller pod's status
80+
minikube kubectl -- describe pod <pod-name> -n temporal-worker-controller
81+
82+
# View TemporalWorkerDeployment status
83+
kubectl get twd
84+
```
85+
86+
### Cleanup
87+
88+
To clean up the demo:
89+
```bash
90+
# Delete the Helm release
91+
helm uninstall temporal-worker-controller -n temporal-system
92+
93+
# Stop Minikube
94+
minikube stop
95+
```
96+
97+
### Additional Operational commands
98+
99+
Complete cleanup (removes all clusters, cached images, and config):
100+
```
101+
minikube delete --all --purge
102+
```
103+
104+
**What `minikube delete --all --purge` does:**
105+
- `--all`: Deletes ALL minikube clusters (not just the default one)
106+
- `--purge`: Completely removes all minikube data, cached images, and configuration files from your machine
107+
108+
This gives you a completely fresh start and frees up disk space used by minikube.
109+

internal/demo/helloworld/README.md

Lines changed: 0 additions & 49 deletions
This file was deleted.

internal/demo/helloworld/changes/progressive-rollout.patch

Lines changed: 0 additions & 26 deletions
This file was deleted.

internal/demo/helloworld/temporal_worker_deployment.yaml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,16 @@ spec:
1616
rollout:
1717
strategy: Progressive
1818
steps:
19+
# Increase traffic from 1% to 10% over 15 seconds
1920
- rampPercentage: 1
20-
pauseDuration: 30s
21+
pauseDuration: 5s
2122
- rampPercentage: 5
22-
pauseDuration: 30s
23+
pauseDuration: 5s
2324
- rampPercentage: 10
24-
pauseDuration: 30s
25+
pauseDuration: 5s
2526
# Increase traffic to 50% and wait 1 minute
2627
- rampPercentage: 50
27-
pauseDuration: 30s
28+
pauseDuration: 1m
2829
gate:
2930
workflowType: "HelloWorld"
3031
sunset:

skaffold.yaml

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,34 @@ build:
88
variant: CommitSha
99
ignoreChanges: true
1010
profiles:
11-
- name: helloworld
11+
# Build and deploy the controller to the local k8s cluster
12+
- name: worker-controller
13+
build:
14+
tagPolicy:
15+
envTemplate:
16+
template: "latest"
17+
artifacts:
18+
- image: temporal-worker-controller
19+
context: .
20+
docker:
21+
dockerfile: Dockerfile
22+
manifests:
23+
helm:
24+
releases:
25+
- name: temporal-worker-controller
26+
chartPath: helm/temporal-worker-controller
27+
namespace: temporal-worker-controller
28+
createNamespace: true
29+
setValues:
30+
image.repository: temporal-worker-controller
31+
image.tag: latest
32+
image.pullPolicy: IfNotPresent
33+
namespace.create: true
34+
valuesFiles:
35+
- helm/temporal-worker-controller/values.yaml
36+
37+
# Build and deploy the helloworld Custom Resource to the local k8s cluster
38+
- name: helloworld-worker
1239
build:
1340
artifacts:
1441
- image: helloworld

0 commit comments

Comments
 (0)