Adding k8s-service-resource and k8s-routes-resource as tasks

and dependencies to the entry point template.
- Issue: Argo throws this error

Message:             invalid spec: templates.main.tasks.train-model.dependencies[1] dependency 'k8s-service-resource' not defined
This commit is contained in:
Aleksandr Melnikov
2020-11-04 14:56:29 -08:00
parent af361d5045
commit e5f2f3e937

View File

@@ -534,6 +534,32 @@ func (c *Client) createWorkflow(namespace string, workflowTemplateID uint64, wor
}
newTemplateOrder = append(newTemplateOrder, templateRouteResource)
}
for i2, t2 := range wf.Spec.Templates {
if t2.Name == wf.Spec.Entrypoint {
if t2.DAG != nil {
tasks := wf.Spec.Templates[i2].DAG.Tasks
for it, t := range tasks {
for _, d := range t.Dependencies {
if d == "sys-send-status" {
wf.Spec.Templates[i2].DAG.Tasks[it].Dependencies = []string{d, "k8s-service-resource", "k8s-routes-resource"}
}
}
}
wf.Spec.Templates[i2].DAG.Tasks = append(tasks, []wfv1.DAGTask{
{
Name: "k8s-services-resource",
Template: "k8s-services-resource",
},
{
Name: "k8s-routes-resource",
Template: "k8s-routes-resource",
},
}...)
}
}
}
newTemplateOrder = append(newTemplateOrder, wf.Spec.Templates[tIdx])
//Inject clean-up
}