头盔依赖条件

Helm dependency condition

有没有办法根据变量的存在性在 Chart.yaml 文件中设置条件?我想在未设置变量 SERVICE_A_URL 时安装依赖项。我尝试了这些,但 helm 总是尝试安装依赖项。

condition: "not SERVICE_A_URL"
condition: "not defined SERVICE_A_URL"

谢谢!

所写in documentation:

All charts are loaded by default. If tags or condition fields are present, they will be evaluated and used to control loading for the chart(s) they are applied to.

Condition - The condition field holds one or more YAML paths (delimited by commas). If this path exists in the top parent's values and resolves to a boolean value, the chart will be enabled or disabled based on that boolean value. Only the first valid path found in the list is evaluated and if no paths exist then the condition has no effect.

如果没有指定路径或没有任何与路径相关联的条件,则该条件无效。您可以在 values.yaml 文件中禁用安装依赖项。

例如,如果您有以下 Chart.yaml 文件:

dependencies:
  - name: subchart1
    condition: subchart1.enabled
    tags:
      - front-end
      - subchart1

并且您想禁用标记为 back-end 的图表,在 values.yaml 中您必须为其分配 false 值:

subchart1:
  enabled: true
tags:
  front-end: false
  back-end: true