Skip to content

Commit fd9cbb2

Browse files
Joibelusulkies
andauthored
fix: Add instanceID label to WorkflowTaskSet. Fixes #15219 (cherry-pick #15220 for 3.7) (#15496)
Signed-off-by: Uziel Sulkies <[email protected]> Signed-off-by: Alan Clucas <[email protected]> Co-authored-by: Uziel David Sulkies <[email protected]>
1 parent 4c8fff2 commit fd9cbb2

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

workflow/controller/taskset.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,10 @@ func (woc *wfOperationCtx) createTaskSet(ctx context.Context) error {
173173
}
174174

175175
woc.log.Info("Creating TaskSet")
176+
labels := map[string]string{}
177+
if woc.controller.Config.InstanceID != "" {
178+
labels[common.LabelKeyControllerInstanceID] = woc.controller.Config.InstanceID
179+
}
176180
taskSet := wfv1.WorkflowTaskSet{
177181
TypeMeta: metav1.TypeMeta{
178182
Kind: workflow.WorkflowTaskSetKind,
@@ -181,6 +185,7 @@ func (woc *wfOperationCtx) createTaskSet(ctx context.Context) error {
181185
ObjectMeta: metav1.ObjectMeta{
182186
Namespace: woc.wf.Namespace,
183187
Name: woc.wf.Name,
188+
Labels: labels,
184189
OwnerReferences: []metav1.OwnerReference{
185190
{
186191
APIVersion: woc.wf.APIVersion,

workflow/controller/taskset_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ spec:
102102
assert.Equal(t, ts.Name, wf.Name)
103103
assert.Equal(t, ts.Namespace, wf.Namespace)
104104
assert.Len(t, ts.Spec.Tasks, 1)
105+
assert.Equal(t, "testID", ts.Labels[common.LabelKeyControllerInstanceID], "WorkflowTaskSet should have instanceID label")
105106
}
106107
pods, err := woc.controller.kubeclientset.CoreV1().Pods("default").List(ctx, v1.ListOptions{})
107108
require.NoError(t, err)

0 commit comments

Comments
 (0)