gpt4 book ai didi

Kubernetes Argo 提交参数的步骤

转载 作者:行者123 更新时间:2023-12-05 00:47:33 28 4
gpt4 key购买 nike

我正在关注 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}}"]

如果我使用以下命令提交工作流:

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

它仍然打印出 hello world 而不是 goodbye world。不知道为什么

最佳答案

-p 参数设置在工作流规范的 arguments 字段中定义的全局工作流参数。更多信息可用here .要使用全局参数,您的工作流程应进行如下更改:

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}}"]

关于Kubernetes Argo 提交参数的步骤,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56547512/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com