Skip to content

Commit 9843e45

Browse files
committed
turn unversioned Deployment into versioned TemporalWorkerDeployment
1 parent 0279e61 commit 9843e45

5 files changed

Lines changed: 42 additions & 42 deletions

File tree

internal/demo/helloworld/temporal_worker_deployment.yaml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,8 @@ spec:
1616
rollout:
1717
strategy: Progressive
1818
steps:
19-
# Increase traffic from 1% to 10% over 15 seconds
2019
- rampPercentage: 1
21-
pauseDuration: 5s
22-
- rampPercentage: 5
23-
pauseDuration: 5s
24-
- rampPercentage: 10
25-
pauseDuration: 5s
26-
# Increase traffic to 50% and wait 1 minute
20+
pauseDuration: 30s
2721
- rampPercentage: 50
2822
pauseDuration: 1m
2923
gate:

internal/demo/helm/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ apiVersion: v1
22
name: demo-worker
33
description: A Helm Chart Deploying a Minimalist Temporal Worker
44
type: application
5-
version: 0.1.0
5+
version: 0.2.0
66
appVersion: "1.0.0"
Lines changed: 28 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,30 @@
1-
apiVersion: apps/v1
2-
kind: Deployment
1+
apiVersion: temporal.io/v1alpha1
2+
kind: TemporalWorkerDeployment
33
metadata:
44
name: worker
55
namespace: staging
66
labels:
77
app: worker
88
spec:
9+
# Configuration for connecting to Temporal
10+
workerOptions:
11+
connection: cloud-demo
12+
temporalNamespace: "{{ .Values.temporal.namespace }}"
13+
14+
# How to roll out new workflow executions to the latest worker version
15+
rollout:
16+
strategy: Progressive
17+
steps:
18+
- rampPercentage: 1
19+
pauseDuration: 30s
20+
- rampPercentage: 50
21+
pauseDuration: 1m
22+
gate:
23+
workflowType: "HelloWorld"
24+
sunset:
25+
scaledownDelay: 30s
26+
deleteDelay: 1m
927
replicas: 4
10-
selector:
11-
matchLabels:
12-
app: worker
1328
template:
1429
metadata:
1530
labels:
@@ -22,20 +37,11 @@ spec:
2237
env:
2338
- name: TEMPORAL_TASK_QUEUE
2439
value: "{{ .Values.temporal.taskQueue }}"
25-
- name: TEMPORAL_NAMESPACE
26-
value: "{{ .Values.temporal.namespace }}"
27-
- name: TEMPORAL_HOST_PORT
28-
value: "{{ .Values.temporal.namespace }}.tmprl.cloud:7233"
29-
- name: TEMPORAL_TLS_KEY_PATH
30-
value: /etc/temporal/tls/tls.key
31-
- name: TEMPORAL_TLS_CERT_PATH
32-
value: /etc/temporal/tls/tls.crt
33-
volumeMounts:
34-
- mountPath: /etc/temporal/tls
35-
name: temporal-tls
36-
readOnly: true
37-
volumes:
38-
- name: temporal-tls
39-
secret:
40-
secretName: "{{ .Values.temporal.mTLSSecret }}"
41-
defaultMode: 420
40+
---
41+
apiVersion: temporal.io/v1alpha1
42+
kind: TemporalConnection
43+
metadata:
44+
name: cloud-demo
45+
spec:
46+
hostPort: "{{ .Values.temporal.namespace }}.tmprl.cloud:7233"
47+
mutualTLSSecret: "{{ .Values.temporal.mTLSSecret }}"

internal/demo/helm/values.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
image:
22
repository: helloworld
3-
tag: v0.1.0 # unversioned worker, no DeploymentOptions
3+
tag: v0.2.0 # versioned worker with DeploymentOptions
44

55
temporal:
66
namespace: worker-controller-demo.a2dd6

internal/demo/util/worker.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
"time"
1010

1111
"go.temporal.io/sdk/worker"
12+
"go.temporal.io/sdk/workflow"
1213
)
1314

1415
func NewVersionedWorker(opts worker.Options) (w worker.Worker, stopFunc func()) {
@@ -25,17 +26,16 @@ func NewVersionedWorker(opts worker.Options) (w worker.Worker, stopFunc func())
2526
}
2627
}()
2728

28-
//opts.DeploymentOptions = worker.DeploymentOptions{
29-
// UseVersioning: true,
30-
// Version: worker.WorkerDeploymentVersion{
31-
// DeploymentName: mustGetEnv("TEMPORAL_DEPLOYMENT_NAME"),
32-
// BuildId: mustGetEnv("WORKER_BUILD_ID"),
33-
// },
34-
// DefaultVersioningBehavior: workflow.VersioningBehaviorPinned,
35-
//}
36-
37-
//c, stopClient := NewClient(mustGetEnv("WORKER_BUILD_ID"))
38-
c, stopClient := NewClient("")
29+
opts.DeploymentOptions = worker.DeploymentOptions{
30+
UseVersioning: true,
31+
Version: worker.WorkerDeploymentVersion{
32+
DeploymentName: mustGetEnv("TEMPORAL_DEPLOYMENT_NAME"),
33+
BuildId: mustGetEnv("WORKER_BUILD_ID"),
34+
},
35+
DefaultVersioningBehavior: workflow.VersioningBehaviorPinned,
36+
}
37+
38+
c, stopClient := NewClient(mustGetEnv("WORKER_BUILD_ID"))
3939

4040
w = worker.New(c, temporalTaskQueue, opts)
4141

0 commit comments

Comments
 (0)