【发布时间】:2021-11-09 18:52:59
【问题描述】:
我想使用 argo 模板在一个循环中传递多个列表的元素
我有 3 个如下列表
effect = ["Allow", "Allow", "Allow"]
resource = ["*", "*", "*"]
action = ["ec2:CreateTags", "ec2:DescribeInstances", "ec2:AuthorizeSecurityGroupIngress"]
我有一个需要使用 argo 模板构建的 IAM 策略。以下 IAM 策略从每个循环中的 3 个列表中获取元素。我们如何在一个循环中传递这三个列表元素?
我参考了 argo 文档,只有 withItems/withParams 循环可用,一次只需要一个列表
我尝试了下面的方法,但它不起作用
- name: policy
value: |-
<<-EOP
{
"Effect": "{{item.1}}",
"Action": "{{item.2}}",
"Resource": "{{item.3}}"
}
EOP
withTogether:
- "{{inputs.parameters.effect}}"
- "{{inputs.parameters.actions}}"
- "{{inputs.parameters.resources}}"
如果 argo 不支持,有没有其他方法可以实现?
【问题讨论】:
-
你能发布你期望给定输入的确切 JSON 吗?
-
和这个JSON一样
[{"action":"ec2:CreateTags","effect":"Allow","resource":"*"},{"action":"ec2:DescribeInstances","effect":"Allow","resource":"*"},{"action":"ec2:AuthorizeSecurityGroupIngress","effect":"Allow","resource":"*"}]
标签: argo-workflows