use*_*526 7 kubernetes argoproj argo-workflows
我正在尝试 Argo 工作流程,想了解如何冻结步骤。假设我有 3 步工作流程,而工作流程在第 2 步失败。因此,我想使用第 1 步成功的工件重新提交第 2 步中的工作流程。我怎样才能实现这个目标?我在文档的任何地方都找不到指导。
条件提供了一种在运行时影响工作流控制流的方法,具体取决于参数。在此示例中,“print-hello”模板可能会也可能不会执行,具体取决于输入参数“should-print”。当提交时
$ argo submit examples/conditionals.yaml
该步骤将被跳过,因为“should-print”将评估为 false。提交时:
$ argo submit examples/conditionals.yaml -p should-print=true
该步骤将被执行,因为“should-print”将评估为 true。
apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
generateName: conditional-
spec:
entrypoint: conditional-example
arguments:
parameters:
- name: should-print
value: "false"
templates:
- name: conditional-example
inputs:
parameters:
- name: should-print
steps:
- - name: print-hello
template: whalesay
when: "{{inputs.parameters.should-print}} == true"
- name: whalesay
container:
image: docker/whalesay:latest
command: [sh, -c]
args: ["cowsay hello"]
Run Code Online (Sandbox Code Playgroud)
如果您在每个步骤中使用条件,您将能够从您喜欢的具有适当条件的步骤开始。
还可以阅读这篇文章《Argo:Kubernetes 的工作流引擎》 ,作者解释了coinflip 示例中条件的使用。您可以在他们的GitHub 页面上看到许多示例。
| 归档时间: |
|
| 查看次数: |
7689 次 |
| 最近记录: |