1

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 ?

1 Answer 1

1

From the docs

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.