0
votes

I have chart A with two dependencies: chart D (storage) and F (front end). D and F are official charts from some remote repository and I don't have any control / impact on those.

Within chart D the URL to it is being generated in Ds templates (lets name it D-URL) on top of some value provided to it (let say D-NAME). One of Helm values required for F is this D-URL, but also my own chart A would like to inject this D-URL into one of A templates.

So my question is: is there a way for somehow store D-URL and use D-URL in above use case? Or the only option for me is to force user to compute and inject D-URL as Helm value to multiple values during deployment?

I'm sorry if this is silly question, but I'm new to Helm and couldn't find clear answer online.

1

1 Answers

0
votes

Given the fact that you don't have the rights to modify the dependency charts makes it difficult but not impossible. We'll give it a go and see how things turn out.

  1. Pull the D-CHART dependency charts to read the contents.

  2. In the chart look into the templates/service.yaml file.(I am assuming F and D charts will communicate using services.). You will find something like: name: <template-here>

  3. The template here is important. This tells you what the name of your service will look like on deployment and the variables it is dependant upon. (D-URL=D-NAME+some value)

  4. If both the charts use something like {{ .Release.Name }} or {{ include "D-Chart.fullname" . }} as the template then attaching a release-name to your helm install <release-Name> . or hardcoding the dependency name in Chart.yaml will do the trick.

  5. If D-NAME is a user-defined variable then use the following in your A-Chart to pass the value to dependant chart.

D-CHART:
  D-NAME: <value-here>
F-CHART:
  D-URL: <D-NAME value-here>-<some-value>
# to be passed in you A-chart template
D-URL: <D-NAME value-here>-<some-value>

In case mentioned above, you will definitely have to pass the value to multiple variable as shown above.

However, if you are in luck and "some value" is something that can be fixed then you can avoid having the user do the calculation by fixing the value.

You can take the decision based on the template that is given in the charts.

If you can modify the charts try using subcharts_and_globals