Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions pkg/workflow_execution.go
Original file line number Diff line number Diff line change
Expand Up @@ -499,6 +499,10 @@ func (c *Client) createWorkflow(namespace string, workflowTemplateID uint64, wor
}
wf.Spec.Arguments.Parameters = newParameters

if err = injectFilesyncerSidecar(wf); err != nil {
return nil, err
}

if err = injectWorkflowExecutionStatusCaller(wf, wfv1.NodeRunning); err != nil {
return nil, err
}
Expand Down Expand Up @@ -2063,6 +2067,38 @@ func getCURLNodeTemplate(name, curlMethod, curlPath, curlBody string, inputs wfv
return
}

func injectFilesyncerSidecar(wf *wfv1.Workflow) error {
filesyncer := wfv1.UserContainer{
Container: corev1.Container{
Name: "sys-filesyncer",
Image: "onepanel/filesyncer:test-server-6",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commenting here so we don't forget to change this before merge

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Vafilor want to update this to onepanel/filesyncer:v0.19.0?

Args: []string{"server", "-server-prefix=/sys/filesyncer"},
Env: []corev1.EnvVar{
{
Name: "ONEPANEL_INTERACTIVE_SIDECAR",
Value: "true",
},
},
Ports: []corev1.ContainerPort{
{
ContainerPort: 8888,
},
},
},
}

for i := range wf.Spec.Templates {
template := &wf.Spec.Templates[i]

if (template.Container != nil && len(template.Container.VolumeMounts) != 0) ||
(template.Script != nil && len(template.Script.VolumeMounts) != 0) {
template.Sidecars = append(template.Sidecars, filesyncer)
}
}

return nil
}

func injectExitHandlerWorkflowExecutionStatistic(wf *wfv1.Workflow, workflowTemplateId *uint64) error {
curlPath := "/apis/v1beta1/{{workflow.namespace}}/workflow_executions/{{workflow.name}}/statistics"
statistics := map[string]interface{}{
Expand Down