Skip to content

Commit 7de351c

Browse files
committed
updated bandaid
1 parent 8b01be7 commit 7de351c

File tree

4 files changed

+104
-26
lines changed

4 files changed

+104
-26
lines changed

config/rbac/role.yaml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
---
2+
apiVersion: rbac.authorization.k8s.io/v1
3+
kind: ClusterRole
4+
metadata:
5+
name: manager-role
6+
rules:
7+
- apiGroups:
8+
- ""
9+
resources:
10+
- secrets
11+
verbs:
12+
- get
13+
- list
14+
- watch
15+
- apiGroups:
16+
- apps
17+
resources:
18+
- deployments
19+
verbs:
20+
- create
21+
- delete
22+
- get
23+
- list
24+
- patch
25+
- update
26+
- watch
27+
- apiGroups:
28+
- apps
29+
resources:
30+
- deployments/scale
31+
verbs:
32+
- update
33+
- apiGroups:
34+
- temporal.io
35+
resources:
36+
- temporalconnections
37+
verbs:
38+
- get
39+
- list
40+
- watch
41+
- apiGroups:
42+
- temporal.io
43+
resources:
44+
- temporalworkerdeployments
45+
verbs:
46+
- create
47+
- delete
48+
- get
49+
- list
50+
- patch
51+
- update
52+
- watch
53+
- apiGroups:
54+
- temporal.io
55+
resources:
56+
- temporalworkerdeployments/finalizers
57+
verbs:
58+
- update
59+
- apiGroups:
60+
- temporal.io
61+
resources:
62+
- temporalworkerdeployments/status
63+
verbs:
64+
- get
65+
- patch
66+
- update

config/webhook/manifests.yaml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
---
2+
apiVersion: admissionregistration.k8s.io/v1
3+
kind: MutatingWebhookConfiguration
4+
metadata:
5+
name: mutating-webhook-configuration
6+
webhooks:
7+
- admissionReviewVersions:
8+
- v1
9+
clientConfig:
10+
service:
11+
name: webhook-service
12+
namespace: system
13+
path: /mutate-temporal-io-temporal-io-v1alpha1-temporalworkerdeployment
14+
failurePolicy: Fail
15+
name: mtemporalworker.kb.io
16+
rules:
17+
- apiGroups:
18+
- temporal.io.temporal.io
19+
apiVersions:
20+
- v1alpha1
21+
operations:
22+
- CREATE
23+
- UPDATE
24+
resources:
25+
- temporalworkers
26+
sideEffects: None

internal/planner/planner.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -339,8 +339,7 @@ func getTestWorkflows(
339339
// Skip if there's no gate workflow defined, if the target version is already the current, or if the target
340340
// version is not yet registered in temporal
341341
if config.RolloutStrategy.Gate == nil ||
342-
status.CurrentVersion == nil ||
343-
status.CurrentVersion.BuildID == status.TargetVersion.BuildID ||
342+
(status.CurrentVersion != nil && status.CurrentVersion.BuildID == status.TargetVersion.BuildID) ||
344343
status.TargetVersion.Status == temporaliov1alpha1.VersionStatusNotRegistered {
345344
return nil
346345
}
@@ -390,7 +389,7 @@ func getVersionConfigDiff(
390389
}
391390

392391
// Do nothing if the test workflows have not completed successfully
393-
if strategy.Gate != nil && status.CurrentVersion != nil {
392+
if strategy.Gate != nil {
394393
if len(status.TargetVersion.TaskQueues) == 0 {
395394
return nil
396395
}

internal/planner/planner_test.go

Lines changed: 10 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1014,28 +1014,6 @@ func TestGetTestWorkflows(t *testing.T) {
10141014
},
10151015
expectWorkflows: 0,
10161016
},
1017-
{
1018-
name: "gate workflow without current version",
1019-
status: &temporaliov1alpha1.TemporalWorkerDeploymentStatus{
1020-
TargetVersion: temporaliov1alpha1.TargetWorkerDeploymentVersion{
1021-
BaseWorkerDeploymentVersion: temporaliov1alpha1.BaseWorkerDeploymentVersion{
1022-
BuildID: "123",
1023-
Status: temporaliov1alpha1.VersionStatusInactive,
1024-
TaskQueues: []temporaliov1alpha1.TaskQueue{
1025-
{Name: "queue1"},
1026-
},
1027-
},
1028-
},
1029-
CurrentVersion: nil,
1030-
},
1031-
config: &Config{
1032-
RolloutStrategy: temporaliov1alpha1.RolloutStrategy{
1033-
Gate: &temporaliov1alpha1.GateWorkflowConfig{WorkflowType: "TestWorkflow"},
1034-
},
1035-
},
1036-
// should not start gate workflows if current version is not set. This happens when there is no initial deployment version present.
1037-
expectWorkflows: 0,
1038-
},
10391017
{
10401018
name: "all test workflows already running",
10411019
status: &temporaliov1alpha1.TemporalWorkerDeploymentStatus{
@@ -1241,9 +1219,18 @@ func TestGetVersionConfigDiff(t *testing.T) {
12411219
BuildID: "123",
12421220
Status: temporaliov1alpha1.VersionStatusInactive,
12431221
HealthySince: &metav1.Time{Time: time.Now()},
1222+
TaskQueues: []temporaliov1alpha1.TaskQueue{
1223+
{Name: "queue1"},
1224+
},
1225+
},
1226+
TestWorkflows: []temporaliov1alpha1.WorkflowExecution{
1227+
{
1228+
TaskQueue: "queue1",
1229+
Status: temporaliov1alpha1.WorkflowExecutionStatusCompleted,
1230+
},
12441231
},
12451232
},
1246-
// CurrentVersion intentionally nil to simulate bootstrap
1233+
CurrentVersion: nil,
12471234
},
12481235
state: &temporal.TemporalWorkerState{
12491236
Versions: map[string]*temporal.VersionInfo{

0 commit comments

Comments
 (0)