I have a subchart in the chart dependencies defined as:
dependencies:
- condition: myTestSubchart.enabled
name: my-test-subchart
repository: oci://harbor.test.com/helm
version: 0.1.0
alias: myTestSubchart
The alias
is defined as we cannot reference on the names with dashes in the yaml.
However, using alias, we do not get the correct name of the subchart.
For example {{ template "my-test-subchart.name" .Subcharts.myTestSubchart }}
will produce myTestSubchart
instead of my-test-subchart
, I understand this is because of the alias of the dependent subchart.
The template is default one:
{{/*
Expand the name of the chart.
*/}}
{{- define "my-test-subchart.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}
But I need to have an alias, because of the yaml convention.
One of the solution I do not like very much is to override the name back in the values.yaml
of the umbrella chart like this:
myTestSubchart:
nameOverride: my-test-subchart
This will produce expected my-test-subchart
from {{ template "my-test-subchart.name" .Subcharts.myTestSubchart }}
.
However, it is hardcoded in the values of the umbrella chart.
Is there any solution for that without overriding values?