Skip to content

Commit c922b70

Browse files
authored
Merge pull request #953 from Vafilor/fix/workflow.volumes
fix: workflow volumes don't delete on failed workflow
2 parents 8eeb90d + fc9669d commit c922b70

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

pkg/workflow_execution.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -929,7 +929,14 @@ func (c *Client) CreateWorkflowExecution(namespace string, workflow *WorkflowExe
929929
return nil, fmt.Errorf("workflow Template contained more than 1 workflow execution")
930930
}
931931

932-
createdWorkflow, err := c.createWorkflow(namespace, workflowTemplate.ID, workflowTemplate.WorkflowTemplateVersionID, &workflows[0], opts, workflow.Labels)
932+
wf := &workflows[0]
933+
if wf.Spec.VolumeClaimGC == nil {
934+
wf.Spec.VolumeClaimGC = &wfv1.VolumeClaimGC{
935+
Strategy: wfv1.VolumeClaimGCOnCompletion,
936+
}
937+
}
938+
939+
createdWorkflow, err := c.createWorkflow(namespace, workflowTemplate.ID, workflowTemplate.WorkflowTemplateVersionID, wf, opts, workflow.Labels)
933940
if err != nil {
934941
log.WithFields(log.Fields{
935942
"Namespace": namespace,

0 commit comments

Comments
 (0)