使用YQ,我可以使用以下方法合并2个Kubernetes Helm图表yaml值文件:
yq '. *= load("values-prod.yaml")' ../web/values.yaml但是,使用值-prod.yaml,我需要在运行时动态生成内容。
我在努力:
yq '. *= load("<(helm template -f values-prod.yaml -s templates/web.yaml . | yq .spec.source.helm.values)")' ../web/values.yaml
Error: Failed to load <(helm template -f values-prod.yaml -s templates/web.yaml . | yq .spec.source.helm.values): open <(helm template -f values-prod.yaml -s templates/web.yaml . | yq .spec.source.helm.values): no such file or directory我试过多种不同的引文,但没有运气。
谢谢。
发布于 2022-11-04 12:39:25
load是yq的一个运算符。它接受文件名作为参数。您不能在这里使用进程替换,因为这是shell语法(错误由yq生成,而不是由shell生成)。您需要在yq之外创建动态内容并将其传递给yq。
也许您可以交换这两个输入:
yq '. *= load("../web/values.yaml")' <(helm template -f values-prod.yaml -s templates/web.yaml . | yq .spec.source.helm.values)我不能测试这段代码,但我希望这个想法能引导您找到解决方案。
https://stackoverflow.com/questions/73889602
复制相似问题