有没有办法根据输入参数为容器模板动态提供图像名称?
我们有 30 多个不同的任务,每个任务都有自己的图像,并且应该在工作流中以相同的方式调用。根据前一个任务的输出,每次运行的数量可能会有所不同。所以我们不想甚至不能在工作流 YAML 中硬编码它们。
一个简单的解决方案是根据输入参数为容器提供图像字段,并为每个任务提供相同的模板。但看起来这是不可能的。此工作流程不起作用:
apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
generateName: hello-world-
spec:
entrypoint: whalesay
templates:
- name: whalesay
inputs:
parameters:
- name: image
default: whalesay:latest
container:
image: "docker/{{image}}"
command: [cowsay]
args: ["hello world"]
这种特殊情况有一些解决方法吗?
还有一个文档描述了可以在哪些字段中使用工作流变量?文档页面仅显示:
工作流规范中的某些字段允许由 Argo 自动替换的变量引用。