You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Helm:如何在Umbrella Chart的ConfigMap中展示子Chart版本

How to Pull Subchart Versions from Their Chart.yaml in an Umbrella Chart ConfigMap

Great question – I’ve run into this exact scenario before. The good news is you don’t need to duplicate version info in values files. You can access the actual version from each subchart’s Chart.yaml directly using Helm’s .Subcharts object.

Here’s what you need to replace those ??? with:

  • For microservice1Chart: {{ index .Subcharts "microservice1Chart".Chart.Version | default "unknown" }}
  • For microservice2Chart: {{ index .Subcharts "microservice2Chart".Chart.Version | default "unknown" }}

Full Updated ConfigMap

apiVersion: v1
kind: ConfigMap
metadata:
  name: versionInfo
data:
  versionInfo.js: |
    window.versionInfo = {
      app: '{{ .Chart.Version | default "unknown" }}',
      service1: '{{ index .Subcharts "microservice1Chart".Chart.Version | default "unknown" }}',
      service2: '{{ index .Subcharts "microservice2Chart".Chart.Version | default "unknown" }}',
    };

Why This Works

Helm exposes all loaded subcharts through the .Subcharts object, which gives you full access to each subchart’s context – including its Chart.yaml values. The key here is using the exact name of the subchart as defined in your umbrella chart’s Chart.yaml dependencies list (case-sensitive).

You’re right that .Chart.Dependencies only gives you the version constraints you defined in the umbrella chart (like >=1.2.0), not the actual resolved version of the subchart. .Subcharts bypasses this by pulling the real version directly from the subchart’s own Chart.yaml.

Quick Notes

  • Ensure the subchart name in the index call matches exactly what’s defined in your umbrella chart’s dependencies section (typos and case sensitivity matter).
  • The default "unknown" fallback prevents rendering errors if a subchart is disabled or fails to load.

内容的提问来源于stack exchange,提问作者dargolith

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.28 20:17:44