如何在argo工作流的WorkflowTemplate中使用templateDefaults和模板?

huangapple go评论57阅读模式
英文:

How do I use templateDefaults with templates in an argo workslows WorkflowTemplate

问题

I'd like to use the templateDefaults feature to share common environment variables & images between a set of script templates defined in a WorkflowTemplate resource, something like this;

apiVersion: argoproj.io/v1alpha1
kind: WorkflowTemplate
spec:
  templateDefaults:
      script:
         image: someimage:v1.2.3

  templates:
    - name: foo
      script:
        name: 'foo'
      ...
    - name: bar
      script:
        name: 'bar'
      ...

this does not work for me when i reference the template in another workflow - the templateDefaults seem to get ignored & i get an error that the script image is not defined.

Is there an alternative way to accomplish this?

英文:

I'd like to use the templateDefaults feature to share common environment variables & images between a set of script templates defined in a WorkflowTemplate resource, something like this;

apiVersion: argoproj.io/v1alpha1
kind: WorkflowTemplate
spec:
  templateDefaults:
      script:
         image: someimage:v1.2.3

  templates:
    - name: foo
      script:
        name: 'foo'
      ...
    - name: bar
      script:
        name: 'bar'
      ...

this does not work for me when i reference the template in another workflow - the templateDefaults seem to get ignored & i get an error that the script image is not defined.

Is there an alternative way to accomplish this?

答案1

得分: 0

如在此 Ticket 中所述:

templateDefaulttemplateRef 场景中不起作用。因为 templateRef 只是引用模板,而不是整个 workflowSpecworkflowtemplate 中。您必须将 templateDefault 移动到调用者(Workflow)的规范中。

英文:

As stated in this Ticket:

> templatedefault will not work in templateRef scenario. Because templateRef is just referring the template not the entire workflowSpec in workflowtemplate. you have to move the templateDefault to caller (Workflow) spec.

huangapple
  • 本文由 发表于 2023年2月6日 06:11:28
  • 转载请务必保留本文链接:https://go.coder-hub.com/75355866.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定