argoproj / argo-workflows

Workflow Engine for Kubernetes
https://argo-workflows.readthedocs.io/
Apache License 2.0
15.09k stars 3.2k forks source link

WorkflowTemplates shouldn't have an "Arguments" field #2559

Closed simster7 closed 4 years ago

simster7 commented 4 years ago

A WorkflowTemplate is a definition of a Workflow that lives in the cluster; it is only instantiated once it is submitted. In Argo, the term "Arguments" refers to live arguments being passed by an instantiator (such as a dag or steps or even a Workflow). It follows that if a WorkflowTemplate is a definition and not an instantiator, then it shouldn't support "Arguments".

Arguments to a WorkflowTempalte should be the responsibility of its instantiator, currently only the CLI (but perhaps others as suggested in #2556).

I suggest that we remove support for WorkflowTempalte.Arguments ASAP.

Note that this does not mean removing the ability to call WorkflowTemplates with arguments, it simply states that the Arguments shouldn't be defined with the WorkflowTemplate, but when it is called.

danxmoran commented 4 years ago

@simster7 just so I understand, it would still be possible for the template referred to by the entrypoint of a WorkflowTemplate to require inputs under this change, correct?

simster7 commented 4 years ago

@simster7 just so I understand, it would still be possible for the template referred to by the entrypoint of a WorkflowTemplate to require inputs under this change, correct?

Correct. Whomever calls your WorkflowTemplate (and by extension its entrypoint) would still be able to pass in any arguments that are defined as inputs in the entrypoint of the template.

salanki commented 4 years ago

This would then invalidate https://github.com/argoproj/argo/issues/2590. The downside of not not allowing Arguments is that any Worfklow cannot be a WorkflowTemplate. Workflow level arguments are practical to decrease the amount of arg-passing inside the workflow, when using multiple nested steps etc.

In https://github.com/argoproj/argo/issues/2556#issuecomment-607452619 you have a templateRef reference without pointing to a specific template inside the WorkflowTemplate. In that case, you can use the entrypoint and Workflow level arguments? This ensures that any Workflow can be used as a WorkflowTemplate and executed just as a normal Workflow would even from another Workflow / WorkflowTemplate. The traditional behavior of referencing a template within the WorkflowTemplate still works, and will then not be able to use Workflow level parameters.

I think that allowing for an entrypoint but not allowing for Arguments kills the greatness of being able to store any Workflow as WorkflowTemplate.

simster7 commented 4 years ago

Hi @salanki. We actually had this discussion last week and came to the exact same conclusion:

This would then invalidate #2590. The downside of not not allowing Arguments is that any Worfklow cannot be a WorkflowTemplate. Workflow level arguments are practical to decrease the amount of arg-passing inside the workflow, when using multiple nested steps etc.

Global Workflow parameters are the bottleneck in removing the Workflow.spec.arguments field. If the fields were separate (something like Workflow.spec.globalArguments and Workflow.spec.arguments), then we could remove it. But that is not the case, as you pointed out 🙂

Closing this.