From 34120341747e0261425b49a5600c42efbb1812a3 Mon Sep 17 00:00:00 2001 From: Deepen Mehta Date: Mon, 4 Nov 2019 13:16:33 -0800 Subject: [PATCH] example for pod spec from output of previous step (#1724) --- examples/pod-spec-from-previous-step.yaml | 42 +++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 examples/pod-spec-from-previous-step.yaml diff --git a/examples/pod-spec-from-previous-step.yaml b/examples/pod-spec-from-previous-step.yaml new file mode 100644 index 000000000000..7a683219c015 --- /dev/null +++ b/examples/pod-spec-from-previous-step.yaml @@ -0,0 +1,42 @@ +apiVersion: argoproj.io/v1alpha1 +kind: Workflow +metadata: + generateName: pod-spec-from-previous-step- +spec: + entrypoint: workflow + templates: + - name: workflow + dag: + tasks: + - name: parse-resources + template: parse-resources-tmpl + - name: setup-resources + dependencies: [parse-resources] + template: setup-resources-tmpl + arguments: + parameters: + - name: resources + value: "{{tasks.parse-resources.outputs.parameters.resources}}" + + - name: parse-resources-tmpl + outputs: + parameters: + - name: resources + valueFrom: + path: /tmp/resources.json + script: + image: alpine:latest + command: [sh] + source: | + echo '{"memory": "10Gi", "cpu": "2000m"}' > /tmp/resources.json && cat /tmp/resources.json + + - name: setup-resources-tmpl + inputs: + parameters: + - name: resources + podSpecPatch: '{"containers":[{"name":"main", "resources":{"limits": {{inputs.parameters.resources}}, "requests": {{inputs.parameters.resources}} }}]}' + script: + image: alpine:latest + command: [sh] + source: | + echo {{inputs.parameters.resources}}