【问题标题】:how to pass array in helmfile如何在helmfile中传递数组
【发布时间】:2021-12-08 18:02:24
【问题描述】:

我有 helmfile

releases:
  - name: controller
    values:    
      - values/valuedata.yaml
    hooks:
      {{ toYaml .Values.hooks }}

带有值的文件

hooks:
  - events: [ "presync" ]
    showlogs: true
    command: "bash"
    args: [ "args"]

我想从值中传递钩子,我该怎么做? 我尝试了很多方法,我得到了一个错误 这是命令

helmfile --file ./myhelmfile.yaml sync   
 failed to read myhelmfile.yaml: reading document at index 1: yaml: line 26: did not find expected '-' indicator

【问题讨论】:

    标签: kubernetes-helm helmfile helm3


    【解决方案1】:

    您尝试做的是将values.yaml 的一部分内联到您的模板中。因此,您需要妥善处理缩进。

    在你的情况下,我认为它会是这样的:

    releases:
      - name: controller
        values:    
          - values/valuedata.yaml
        hooks:
    {{ toYaml .Values.hooks | indent 6 }}
    

    您可以找到类似案例的工作示例here

    【讨论】:

    • 为什么缩进是 6 ?
    • 我认为是6,但你可以检查它是否正确。我认为是 6,因为您希望在 hooks: 之后的行中有 6 个规范字符
    猜你喜欢
    • 1970-01-01
    • 2018-08-25
    • 2018-04-07
    • 1970-01-01
    • 1970-01-01
    • 2010-09-12
    • 2018-05-01
    • 2020-04-29
    • 1970-01-01
    相关资源
    最近更新 更多