allow inputs for curlNodeTemplate

This commit is contained in:
rushtehrani
2020-05-06 10:44:40 -07:00
parent 1f98997bb3
commit 7ca68b6dfa
2 changed files with 11 additions and 5 deletions

View File

@@ -1293,7 +1293,7 @@ func (c *Client) GetWorkflowExecutionStatisticsForTemplates(workflowTemplates ..
Will build a template that makes a CURL request to the onepanel-core API,
with statistics about the workflow that was just executed.
*/
func getCURLNodeTemplate(name, curlMethod, curlPath, curlBody string) (template *wfv1.Template, err error) {
func getCURLNodeTemplate(name, curlMethod, curlPath, curlBody string, inputs wfv1.Inputs) (template *wfv1.Template, err error) {
host := env.GetEnv("ONEPANEL_CORE_SERVICE_HOST", "onepanel-core.onepanel.svc.cluster.local")
if host == "" {
err = errors.New("ONEPANEL_CORE_SERVICE_HOST is empty.")
@@ -1306,7 +1306,8 @@ func getCURLNodeTemplate(name, curlMethod, curlPath, curlBody string) (template
}
endpoint := fmt.Sprintf("http://%s:%s%s", host, port, curlPath)
template = &wfv1.Template{
Name: name,
Name: name,
Inputs: inputs,
Container: &corev1.Container{
Name: "curl",
Image: "curlimages/curl",
@@ -1332,7 +1333,7 @@ func injectExitHandlerWorkflowExecutionStatistic(wf *wfv1.Workflow, namespace st
if err != nil {
return err
}
statsTemplate, err := getCURLNodeTemplate("sys-send-exit-stats", http.MethodPost, curlPath, string(statisticsBytes))
statsTemplate, err := getCURLNodeTemplate("sys-send-exit-stats", http.MethodPost, curlPath, string(statisticsBytes), wfv1.Inputs{})
if err != nil {
return err
}
@@ -1378,7 +1379,7 @@ func injectInitHandlerWorkflowExecutionStatistic(wf *wfv1.Workflow, namespace st
if err != nil {
return err
}
containerTemplate, err := getCURLNodeTemplate("sys-send-init-stats", http.MethodPost, curlPath, string(statisticsBytes))
containerTemplate, err := getCURLNodeTemplate("sys-send-init-stats", http.MethodPost, curlPath, string(statisticsBytes), wfv1.Inputs{})
if err != nil {
return err
}