2

我在下面为 Argo 编写了一个工作流程,其中包含一个(基于容器的)模板和一个 DAG。DAG 应该将可变数量的值传递给模板的输入参数。

这可能吗?

apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
  generateName: dag-
spec:
  entrypoint: do-something
  templates:
    - name: something
      inputs:
        parameters:
          - name: values
      container:
        image: some-image
        args: ["{{inputs.parameters.values}}"]  # This field must be converted to ["1", "3", "6", "9"]

    - name: do-something
      dag:
        tasks:
          - name: do-it
            template: something
            arguments:
              parameters:
                - name: values
                  value: [1, 3, 6, 9]

4

1 回答 1

0

我提出了一个问题,这是不可能的。建议的解决方法是创建一个将字符串解析为列表的层:

apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
  generateName: dag-
spec:
  entrypoint: do-something
  templates:
    - name: something
      inputs:
        parameters:
          - name: values
      container:
        image: alpine:latest
        command: [sh, -c]
        args: ["parselist {{inputs.parameters.values}}"]

    - name: do-something
      dag:
        tasks:
          - name: do-it
            template: something
            arguments:
              parameters:
                - name: values
                  value: '["1", "3", "6", "9"]'
于 2020-09-04T06:02:57.500 回答