<p>I have a Helm Chart comprising of a few subcharts, sth like this:</p>

<pre><code>├── Chart.yaml
├── README.md
├── charts
│   ├── nginx-1.0.0.tgz
│   └── redis-1.0.0.tgz
├── index.yaml
├── requirements.lock
├── requirements.yaml
├── subcharts
│   ├── nginx
│   │   ├── Chart.yaml
│   │   ├── templates
│   │   │   ├── deployment.yaml
│   │   │   ├── service.yaml
│   └── redis
│       ├── Chart.yaml
│       ├── templates
│       │   ├── deployment.yaml
│       │   └── service.yaml
│       └── values.yaml
└── values.yaml

</code></pre>

<p>In my <strong>root level</strong> <code>values.yaml</code>, I define the (per chart) values, under the corresponding <code>yaml</code> node, i.e. the file would look something like this:</p>

<pre><code>redis:
  namespace: default
  replicas: 1
  image: redis
  tag: 5.0-alpine
  port: 6379
  imagePullPolicy: IfNotPresent
  serviceType: ClusterIP
  resources:
    requests:
      cpu: 200m
      memory: 512Mi
    limits:
      cpu: 1000M
      memory: 1500Mi
nginx:
  namespace: default
  istio:
    enabled: false
  replicas: 1
  image: redash/nginx
  tag: latest
  port: 80
  imagePullPolicy: IfNotPresent
  serviceType: LoadBalancer
</code></pre>

<p>And these values (the ones in the hierarchy <code>&lt;subchartname&gt;.value</code> are accessed as follows in a subchart template:</p>

<pre><code>spec:
  replicas: {{ default 1 .Values.replicas }}
</code></pre>

<p>i.e. there is no reference to the subchart name, given that this becomes the root context for the template.</p>

<p>Is there a way so that my helm templates access the parent (root) context values?</p>

<p>I want to do this so I can share values across subcharts in a DRY mode.</p>

<p>i.e. more or less my question becomes:</p>

<p>how should I access from my subchart templates, values in the root level?</p>

<pre><code>myvariable1:
    value1
myvarianle2:
    value2
</code></pre>

pkaramol
<p>I think you need to use global chart values which can be shared across subcharts . Link to doc <a href="https://helm.sh/docs/topics/chart_template_guide/subcharts_and_globals/#global-chart-values" rel="nofollow noreferrer">https://helm.sh/docs/topics/chart_template_guide/subcharts_and_globals/#global-chart-values</a></p>
