diff --git a/docs/fields.md b/docs/fields.md index 6bf7e9f50c5e..3a247851f65b 100644 --- a/docs/fields.md +++ b/docs/fields.md @@ -246,6 +246,8 @@ Workflow is the definition of a workflow resource - [`work-avoidance.yaml`](https://github.com/argoproj/argo/blob/master/examples/work-avoidance.yaml) +- [`workflow-of-workflows.yaml`](https://github.com/argoproj/argo/blob/master/examples/workflow-of-workflows.yaml) + - [`dag.yaml`](https://github.com/argoproj/argo/blob/master/examples/workflow-template/dag.yaml) - [`hello-world.yaml`](https://github.com/argoproj/argo/blob/master/examples/workflow-template/hello-world.yaml) @@ -563,6 +565,8 @@ WorkflowSpec is the specification of a Workflow. - [`work-avoidance.yaml`](https://github.com/argoproj/argo/blob/master/examples/work-avoidance.yaml) +- [`workflow-of-workflows.yaml`](https://github.com/argoproj/argo/blob/master/examples/workflow-of-workflows.yaml) + - [`dag.yaml`](https://github.com/argoproj/argo/blob/master/examples/workflow-template/dag.yaml) - [`hello-world.yaml`](https://github.com/argoproj/argo/blob/master/examples/workflow-template/hello-world.yaml) @@ -891,6 +895,8 @@ CronWorkflowSpec is the specification of a CronWorkflow - [`work-avoidance.yaml`](https://github.com/argoproj/argo/blob/master/examples/work-avoidance.yaml) +- [`workflow-of-workflows.yaml`](https://github.com/argoproj/argo/blob/master/examples/workflow-of-workflows.yaml) + - [`dag.yaml`](https://github.com/argoproj/argo/blob/master/examples/workflow-template/dag.yaml) - [`hello-world.yaml`](https://github.com/argoproj/argo/blob/master/examples/workflow-template/hello-world.yaml) @@ -1182,6 +1188,8 @@ WorkflowTemplateSpec is a spec of WorkflowTemplate. - [`work-avoidance.yaml`](https://github.com/argoproj/argo/blob/master/examples/work-avoidance.yaml) +- [`workflow-of-workflows.yaml`](https://github.com/argoproj/argo/blob/master/examples/workflow-of-workflows.yaml) + - [`dag.yaml`](https://github.com/argoproj/argo/blob/master/examples/workflow-template/dag.yaml) - [`hello-world.yaml`](https://github.com/argoproj/argo/blob/master/examples/workflow-template/hello-world.yaml) @@ -1367,6 +1375,8 @@ Arguments to a template - [`work-avoidance.yaml`](https://github.com/argoproj/argo/blob/master/examples/work-avoidance.yaml) +- [`workflow-of-workflows.yaml`](https://github.com/argoproj/argo/blob/master/examples/workflow-of-workflows.yaml) + - [`dag.yaml`](https://github.com/argoproj/argo/blob/master/examples/workflow-template/dag.yaml) - [`hello-world.yaml`](https://github.com/argoproj/argo/blob/master/examples/workflow-template/hello-world.yaml) @@ -1706,6 +1716,8 @@ Template is a reusable and composable unit of execution in a workflow - [`work-avoidance.yaml`](https://github.com/argoproj/argo/blob/master/examples/work-avoidance.yaml) +- [`workflow-of-workflows.yaml`](https://github.com/argoproj/argo/blob/master/examples/workflow-of-workflows.yaml) + - [`dag.yaml`](https://github.com/argoproj/argo/blob/master/examples/workflow-template/dag.yaml) - [`hello-world.yaml`](https://github.com/argoproj/argo/blob/master/examples/workflow-template/hello-world.yaml) @@ -1789,6 +1801,8 @@ WorkflowTemplateRef is a reference to a WorkflowTemplate resource. - [`cron-backfill.yaml`](https://github.com/argoproj/argo/blob/master/examples/cron-backfill.yaml) +- [`workflow-of-workflows.yaml`](https://github.com/argoproj/argo/blob/master/examples/workflow-of-workflows.yaml) + - [`workflow-template-ref-with-entrypoint-arg-passing.yaml`](https://github.com/argoproj/argo/blob/master/examples/workflow-template/workflow-template-ref-with-entrypoint-arg-passing.yaml) - [`workflow-template-ref.yaml`](https://github.com/argoproj/argo/blob/master/examples/workflow-template/workflow-template-ref.yaml) @@ -2123,6 +2137,8 @@ Parameter indicate a passed string parameter to a service template with an optio - [`work-avoidance.yaml`](https://github.com/argoproj/argo/blob/master/examples/work-avoidance.yaml) +- [`workflow-of-workflows.yaml`](https://github.com/argoproj/argo/blob/master/examples/workflow-of-workflows.yaml) + - [`dag.yaml`](https://github.com/argoproj/argo/blob/master/examples/workflow-template/dag.yaml) - [`hello-world.yaml`](https://github.com/argoproj/argo/blob/master/examples/workflow-template/hello-world.yaml) @@ -2427,6 +2443,8 @@ Inputs are the mechanism for passing parameters, artifacts, volumes from one tem - [`work-avoidance.yaml`](https://github.com/argoproj/argo/blob/master/examples/work-avoidance.yaml) +- [`workflow-of-workflows.yaml`](https://github.com/argoproj/argo/blob/master/examples/workflow-of-workflows.yaml) + - [`templates.yaml`](https://github.com/argoproj/argo/blob/master/examples/workflow-template/templates.yaml) @@ -2688,6 +2706,8 @@ Pod metdata - [`work-avoidance.yaml`](https://github.com/argoproj/argo/blob/master/examples/work-avoidance.yaml) +- [`workflow-of-workflows.yaml`](https://github.com/argoproj/argo/blob/master/examples/workflow-of-workflows.yaml) + - [`dag.yaml`](https://github.com/argoproj/argo/blob/master/examples/workflow-template/dag.yaml) - [`hello-world.yaml`](https://github.com/argoproj/argo/blob/master/examples/workflow-template/hello-world.yaml) @@ -2734,6 +2754,8 @@ ResourceTemplate is a template subtype to manipulate kubernetes resources - [`resource-delete-with-flags.yaml`](https://github.com/argoproj/argo/blob/master/examples/resource-delete-with-flags.yaml) - [`resource-flags.yaml`](https://github.com/argoproj/argo/blob/master/examples/resource-flags.yaml) + +- [`workflow-of-workflows.yaml`](https://github.com/argoproj/argo/blob/master/examples/workflow-of-workflows.yaml) ### Fields @@ -2979,6 +3001,8 @@ WorkflowStep is a reference to a template to execute in a series of step - [`work-avoidance.yaml`](https://github.com/argoproj/argo/blob/master/examples/work-avoidance.yaml) +- [`workflow-of-workflows.yaml`](https://github.com/argoproj/argo/blob/master/examples/workflow-of-workflows.yaml) + - [`hello-world.yaml`](https://github.com/argoproj/argo/blob/master/examples/workflow-template/hello-world.yaml) - [`retry-with-steps.yaml`](https://github.com/argoproj/argo/blob/master/examples/workflow-template/retry-with-steps.yaml) @@ -3866,6 +3890,8 @@ ObjectMeta is metadata that all persisted resources must have, which includes al - [`work-avoidance.yaml`](https://github.com/argoproj/argo/blob/master/examples/work-avoidance.yaml) +- [`workflow-of-workflows.yaml`](https://github.com/argoproj/argo/blob/master/examples/workflow-of-workflows.yaml) + - [`dag.yaml`](https://github.com/argoproj/argo/blob/master/examples/workflow-template/dag.yaml) - [`hello-world.yaml`](https://github.com/argoproj/argo/blob/master/examples/workflow-template/hello-world.yaml) @@ -4998,6 +5024,8 @@ PersistentVolumeClaimSpec describes the common attributes of storage devices and - [`work-avoidance.yaml`](https://github.com/argoproj/argo/blob/master/examples/work-avoidance.yaml) +- [`workflow-of-workflows.yaml`](https://github.com/argoproj/argo/blob/master/examples/workflow-of-workflows.yaml) + - [`dag.yaml`](https://github.com/argoproj/argo/blob/master/examples/workflow-template/dag.yaml) - [`hello-world.yaml`](https://github.com/argoproj/argo/blob/master/examples/workflow-template/hello-world.yaml) @@ -5993,6 +6021,8 @@ ListMeta describes metadata that synthetic resources must have, including lists - [`work-avoidance.yaml`](https://github.com/argoproj/argo/blob/master/examples/work-avoidance.yaml) +- [`workflow-of-workflows.yaml`](https://github.com/argoproj/argo/blob/master/examples/workflow-of-workflows.yaml) + - [`dag.yaml`](https://github.com/argoproj/argo/blob/master/examples/workflow-template/dag.yaml) - [`hello-world.yaml`](https://github.com/argoproj/argo/blob/master/examples/workflow-template/hello-world.yaml) diff --git a/docs/workflow-of-workflows.md b/docs/workflow-of-workflows.md new file mode 100644 index 000000000000..17bd2196b5c5 --- /dev/null +++ b/docs/workflow-of-workflows.md @@ -0,0 +1,100 @@ +# Workflow of Workflows + +> v2.9 and after + +## Introduction +The Workflow of Workflows pattern involves a parent workflow triggering one or more child workflows, managing them, and acting their results. + +## Examples +You can use `workflowTemplateRef` to trigger a workflow inline. +1. Define your workflow as a `workflowtemplate`. + +```yaml +apiVersion: argoproj.io/v1alpha1 +kind: WorkflowTemplate +metadata: + name: workflow-template-submittable +spec: + entrypoint: whalesay-template + arguments: + parameters: + - name: message + value: hello world + templates: + - name: whalesay-template + inputs: + parameters: + - name: message + container: + image: docker/whalesay + command: [cowsay] + args: ["{{inputs.parameters.message}}"] +``` +2. Create the `Workflowtemplate` in cluster using `argo template create ` +3. Define the workflow of workflows. +```yaml +# This template demonstrates a workflow of workflows. +# Workflow triggers one or more workflow and manage it. +apiVersion: argoproj.io/v1alpha1 +kind: Workflow +metadata: + generateName: workflow-of-workflows- +spec: + entrypoint: main + templates: + - name: main + steps: + - - name: workflow1 + template: triggerWorkflowUsingResourceWithoutArgument + arguments: + parameters: + - name: workflowtemplate + value: "workflow-template-submittable" + - - name: workflow2 + template: triggerWorkflowUsingResourceWithArgument + arguments: + parameters: + - name: workflowtemplate + value: "workflow-template-submittable" + - name: message + value: "Welcome Argo" + + - name: triggerWorkflowUsingResourceWithoutArgument + inputs: + parameters: + - name: workflowtemplate + resource: + action: create + manifest: | + apiVersion: argoproj.io/v1alpha1 + kind: Workflow + metadata: + generateName: workflow-of-workflows-1- + spec: + workflowTemplateRef: + name: {{inputs.parameters.workflowtemplate}} + successCondition: status.phase == Succeeded + failureCondition: status.phase in (Failed, Error) + + - name: triggerWorkflowUsingResourceWithArgument + inputs: + parameters: + - name: workflowtemplate + - name: message + resource: + action: create + manifest: | + apiVersion: argoproj.io/v1alpha1 + kind: Workflow + metadata: + generateName: workflow-of-workflows-2- + spec: + arguments: + parameters: + - name: message + value: {{inputs.parameters.message}} + workflowTemplateRef: + name: {{inputs.parameters.workflowtemplate}} + successCondition: status.phase == Succeeded + failureCondition: status.phase in (Failed, Error) +``` diff --git a/examples/workflow-of-workflows.yaml b/examples/workflow-of-workflows.yaml new file mode 100644 index 000000000000..778336b0e8ae --- /dev/null +++ b/examples/workflow-of-workflows.yaml @@ -0,0 +1,63 @@ +# This template demonstrates a workflow of workflows. +# Workflow triggers one or more workflow and manage it. +apiVersion: argoproj.io/v1alpha1 +kind: Workflow +metadata: + generateName: workflow-of-workflows- +spec: + entrypoint: main + templates: + - name: main + steps: + - - name: workflow1 + template: triggerWorkflowUsingResourceWithoutArgument + arguments: + parameters: + - name: workflowtemplate + value: "workflow-template-submittable" + - - name: workflow2 + template: triggerWorkflowUsingResourceWithArgument + arguments: + parameters: + - name: workflowtemplate + value: "workflow-template-submittable" + - name: message + value: "Welcome Argo" + + - name: triggerWorkflowUsingResourceWithoutArgument + inputs: + parameters: + - name: workflowtemplate + resource: + action: create + manifest: | + apiVersion: argoproj.io/v1alpha1 + kind: Workflow + metadata: + generateName: workflow-of-workflows-1- + spec: + workflowTemplateRef: + name: {{inputs.parameters.workflowtemplate}} + successCondition: status.phase == Succeeded + failureCondition: status.phase in (Failed, Error) + - name: triggerWorkflowUsingResourceWithArgument + inputs: + parameters: + - name: workflowtemplate + - name: message + resource: + action: create + manifest: | + apiVersion: argoproj.io/v1alpha1 + kind: Workflow + metadata: + generateName: workflow-of-workflows-2- + spec: + arguments: + parameters: + - name: message + value: {{inputs.parameters.message}} + workflowTemplateRef: + name: {{inputs.parameters.workflowtemplate}} + successCondition: status.phase == Succeeded + failureCondition: status.phase in (Failed, Error)