使用Helm模板上的多个值文件

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

Use multiple value files on helm template

问题

我陷入了这样的情境,需要创建一个部署模板,以便在不合并或覆盖的情况下依次使用多个值文件。这些值文件如在argoCD应用程序yaml文件中的valueFiles参数中指定。

有人可以帮助解决这个情况吗?我需要创建一个Helm模板,它应该使用一些范围函数之类的东西依次使用多个值文件。

谢谢提前帮助。

一个简单的Helm模板示例,以便依次传递多个值文件给一个Helm模板。

英文:

I got into a scenario where I need to create a deployment template to use multiple value files one after the another without merging or overriding.
The valueFiles as specified in argoCD application yaml file under valueFiles parameter.

Can someone help on how to overcome this situation. I need to create a helm template which should take value file one after another using some range function or so.

Thanks in advance

A simple helm template example to use pass multiple value files one after another to a helm template.

答案1

得分: 3

可以将两个值文件传递给您的ARGOCD应用程序。一些参考文档在此处

示例:

apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: argo-workflows
  namespace: argocd
  finalizers:
    - resources-finalizer.argocd.argoproj.io
  labels:
    cluster: dev
spec:
  project: foo
  source:
    repoURL: https://github.io/myorganization/myrepo'
    targetRevision: master
    helm:
      valueFiles:
        - values.yaml # 主值文件
        - some-extra-values-file.yaml # 这是您的额外值文件
    repoURL: 'https://github.io/myorganization/myrepo'
    targetRevision: master

还有一点很重要,确保第一个文件中的内容不会出现在第二个值文件中,以免在冲突中被覆盖。在一份文件中进行操作似乎对我来说更有逻辑,但我猜每个人都有独特有趣和不同的问题背景。

我不确定我的回答是否正确,但您还可以检查Helm依赖项。这也可能与您尝试实现的目标有关,只是一个猜测。链接在此

英文:

You can pass 2 values files to your ARGOCD app. Some reference docs here.

example:

apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: argo-workflows
  namespace: argocd
  finalizers:
    - resources-finalizer.argocd.argoproj.io
  labels:
    cluster: dev
spec:
  project: foo

  source: 
    repoURL: https://github.io/myorganization/myrepo'
    targetRevision: master
    helm:
      valueFiles:
        - values.yaml # the main values file
        - some-extra-values-file.yaml # this is your extra values file
    repoURL: 'https://github.io/myorganization/myrepo'
    targetRevision: master

...
It is also important to make sure content in 1st file does not occur in 2nd values file to be overwritten in the conflict. It would make logical sense to me to just do it in one file, but I guess everyone has uniquely interesting and different problem context.

I don't know if my answer to this problem is correct, but you can also check helm dependancies. This can also be related to what you are trying to achieve, just a guess. Link here.

huangapple
  • 本文由 发表于 2023年2月7日 00:48:35
  • 转载请务必保留本文链接:https://go.coder-hub.com/75364239.html
匿名

发表评论

匿名网友

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

确定