<p>From the <a href="https://helm.sh/docs/chart_template_guide/subcharts_and_globals/" rel="nofollow noreferrer">docs</a></p>
<blockquote>
<p>A subchart is considered &quot;stand-alone&quot;, which means a subchart can
never explicitly depend on its parent chart. For that reason, a
subchart cannot access the values of its parent. A parent chart can
override values for subcharts. Helm has a concept of global values
that can be accessed by all charts.</p>
</blockquote>
<p>I believe the best approach will be to maintain any shared values under the <code>global</code> section</p>

CC BY-SA 4.0
2022-07-15T06:30:58.483Z
2022-07-15T06:30:58.483Z
Yuri G.
<p>I have this tree:</p>
<pre><code> environments
 ┣ staging
 ┃ ┣ Chart.yaml
 ┃ ┗ values.yaml
 services
 ┣ my-service
 ┃ ┣ helm
 ┃ ┃ ┣ templates
 ┃ ┃ ┃ ┣ deployment.yaml
 ┃ ┃ ┣ Chart.yaml
 ┃ ┃ ┗ values.yaml
</code></pre>
<p><code>environments/staging/Chart.yaml</code> look like this:</p>
<pre><code>apiVersion: v2
name: staging
description: A Helm chart for Kubernetes
type: application
version: 0.1.0
appVersion: &quot;1.0.0&quot;
dependencies:
  - name: my-service
    repository: file://../../services/my-service/helm
    version: 79947968d75f9b728b321b070d12eaacd12636ca-SNAPSHOT
</code></pre>
<p><code>environments/staging/values.yaml</code> look like this:</p>
<pre><code>my-service:
  image:
    tag: 79947968d75f9b728b321b070d12eaacd12636ca-SNAPSHOT
</code></pre>
<p><code>services/my-service/helm/templates/deployment.yaml</code> look like this:</p>
<pre><code>...
    spec:
      containers:
      - name: {{ .Chart.Name }}
        image: &quot;{{ .Values.image.repository }}:{{ .Values.image.tag }}&quot;
...
</code></pre>
<p>There is a way to access to <code>dependencies.my-service.version</code> from my &quot;child&quot; deployment template, with something like this ?</p>
<pre><code>        image: &quot;{{ .Values.image.repository }}:{{ .Chart.Dependencies.my-service.version }}&quot;
</code></pre>
<p>If not (what I guess), do you please have tips to achieve this ?</p>

<helm><kubernetes-helm>
Can I get dependencies.child-chart.version from Helm template?
benCat
# Can I get dependencies.child-chart.version from Helm template?

(Asked by: username_0 on 2022-02-11)

I have this tree:
 environments
 ┣ staging
 ┃ ┣ Chart.yaml
 ┃ ┗ values.yaml
 services
 ┣ my-service
 ┃ ┣ helm
 ┃ ┃ ┣ templates
 ┃ ┃ ┃ ┣ deployment.yaml
 ┃ ┃ ┣ Chart.yaml
 ┃ ┃ ┗ values.yaml

environments/staging/Chart.yaml look like this:
apiVersion: v2
name: staging
description: A Helm chart for Kubernetes
type: application
version: 0.1.0
appVersion: "1.0.0"
dependencies:
  - name: my-service
    repository: file://../../services/my-service/helm
    version: 79947968d75f9b728b321b070d12eaacd12636ca-SNAPSHOT

environments/staging/values.yaml look like this:
my-service:
  image:
    tag: 79947968d75f9b728b321b070d12eaacd12636ca-SNAPSHOT

services/my-service/helm/templates/deployment.yaml look like this:
...
    spec:
      containers:
      - name: {{ .Chart.Name }}
        image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
...

There is a way to access to dependencies.my-service.version from my "child" deployment template, with something like this ?
        image: "{{ .Values.image.repository }}:{{ .Chart.Dependencies.my-service.version }}"

If not (what I guess), do you please have tips to achieve this ?

**Tags:** helm, kubernetes-helm


---

## 1 answers

### Answer by username_1 on 2022-07-15. Score: 1

From the [docs](https://helm.sh/docs/chart_template_guide/subcharts_and_globals/)

> A subchart is considered "stand-alone", which means a subchart can
> never explicitly depend on its parent chart. For that reason, a
> subchart cannot access the values of its parent. A parent chart can
> override values for subcharts. Helm has a concept of global values
> that can be accessed by all charts.

I believe the best approach will be to maintain any shared values under the `global` section


---

