How share template value between subchart?

11/26/2018

i have made a chart consisting of two subcharts:

my-chart
├── charts
│   ├── nginxg
│   │   ├── Chart.yaml
│   │   ├── OWNERS
│   │   ├── README.md
│   │   ├── templates
│   │   │   ├── ...
│   │   │   ├── deployment.yaml
│   │   │   ├── _helpers.tpl
│   │   │   └── service.yaml
│   │   └── values.yaml
│   ├── mongo
│   │   ├── Chart.yaml
│   │   ├── OWNERS
│   │   ├── README.md
│   │   ├── templates
│   │   │   ├── mongo-deployment.yaml
│   │   │   ├── mongo-service.yaml
│   │   │   ├── _helpers.tpl
│   │   └── values.yaml
└── values.yaml

At my-chart/charts/mongo/_helpers.tpl there is define declaration

{{- define "mongodb.fullname" -}}

that has the name for the service that exposes the mongo pod and inside yaml file is referenced with:

{{ template "mongodb.fullname" . }}

@edit

I want to use this value in my-chart/charts/nginx/deployment.yml however i get an error . The error says

Error: render error in "nginx/templates/deployment.yaml": template: nginx/templates/deployment.yaml:11:18: executing "nginx/templates/deployment.yaml" at <.Values.service.type>: can't evaluate field type in type interface {}
-- Tapxxor Stanijkis
charts
kubernetes
kubernetes-helm

0 Answers