From fc9669d757828b0b832781fbdc27d68f367d6ee0 Mon Sep 17 00:00:00 2001 From: Andrey Melnikov Date: Wed, 8 Sep 2021 12:47:23 -0700 Subject: [PATCH] fix: add PodCompletion volume claim gc by default to workflows. This will clean up the volumes if the workflow fails --- pkg/workflow_execution.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/pkg/workflow_execution.go b/pkg/workflow_execution.go index 462d26e..e2133b3 100644 --- a/pkg/workflow_execution.go +++ b/pkg/workflow_execution.go @@ -929,7 +929,14 @@ func (c *Client) CreateWorkflowExecution(namespace string, workflow *WorkflowExe return nil, fmt.Errorf("workflow Template contained more than 1 workflow execution") } - createdWorkflow, err := c.createWorkflow(namespace, workflowTemplate.ID, workflowTemplate.WorkflowTemplateVersionID, &workflows[0], opts, workflow.Labels) + wf := &workflows[0] + if wf.Spec.VolumeClaimGC == nil { + wf.Spec.VolumeClaimGC = &wfv1.VolumeClaimGC{ + Strategy: wfv1.VolumeClaimGCOnCompletion, + } + } + + createdWorkflow, err := c.createWorkflow(namespace, workflowTemplate.ID, workflowTemplate.WorkflowTemplateVersionID, wf, opts, workflow.Labels) if err != nil { log.WithFields(log.Fields{ "Namespace": namespace,