简体   繁体   English

Kubernetes Argo 将参数提交到步骤中

[英]Kubernetes Argo submit parameter into steps

I'm following the examples on the Argo GitHub but I am unable to change the parameter of message when I move the template into steps.我正在关注 Argo GitHub 上的示例,但是当我将模板移动到步骤中时,我无法更改消息的参数。

apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
  generateName: hello-world-parameters-
spec:
 # invoke the whalesay template with
 # "hello world" as the argument
 # to the message parameter
 entrypoint: entry-point

  templates:
  - name: entry-point
  steps:
    - - name: print-message
        template: whalesay
        arguments:
          parameters:
          - name: message
            value: hello world



 - name: whalesay
   inputs:
     parameters:
     - name: message       # parameter declaration
    container:
    # run cowsay with that message input parameter as args
    image: docker/whalesay
    command: [cowsay]
    args: ["{{inputs.parameters.message}}"]

If I submit the workflow using the following command:如果我使用以下命令提交工作流程:

argo submit .\workflow.yml -p message="goodbye world"

It still prints out hello world and not goodbye world.它仍然打印出 hello world 而不是 goodbye world。 Not sure why不知道为什么

The -p argument sets the global workflow parameters defined in the arguments field of workflow spec. -p参数设置在工作流规范的arguments字段中定义的全局工作流参数。 More information is available here .在此处获得更多信息。 To use global parameters your workflow should be changed are the following:要使用全局参数,您的工作流程应更改如下:

apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
  generateName: hello-world-parameters-
spec:
  # invoke the whalesay template with
  # "hello world" as the argument
  # to the message parameter
  entrypoint: entry-point
  arguments:
    parameters:
    - name: message
      value: hello world

  templates:
  - name: entry-point
    steps:
    - - name: print-message
        template: whalesay
        arguments:
          parameters:
          - name: message
            value: "{{workflow.parameters.message}}"
  - name: whalesay
    inputs:
      parameters:
       - name: message       # parameter declaration
    container:
      # run cowsay with that message input parameter as args
      image: docker/whalesay
      command: [cowsay]
      args: ["{{inputs.parameters.message}}"]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM