I want to maintain a few Helm charts in the same repository that refer to each other in their respective requirements.yaml
files. How should these charts refer to each other's relative paths?
For local development I can use the file://
protocol as in
name: chart-name
repository: file://../chart-name
However when I move to a hosted repository I will need to change this. I would prefer that this directory of charts does not need to have its final location baked into its repository.yaml files. Is this possible?
When you move to a hosted repository, won't you have had to publish each chart? If so, as long as you don't have cyclic dependencies, publish each chart in dependent order to your hosted repo and then update requirements.yaml.
i.e. if you have 3 charts A,B and C.
Publish A to the hosted repo, update B's requirements to point to the hosted repo name of A, then publish B and repeat the update process for C.
I'm doing something similar but I don't use a hosted repo. I already have a large Ansible setup so I wrote a role which installs charts directly from directories. There's a single git repo with all (currently 7) my charts and this minus running a helm server is a similar process. The obvious downside being the manual update of requirements, but I'm not sure there's any other choice on that.
EDIT
A bit hacky but could work:
To avoid editing dependencies one way is to also run your chart repo locally. If your repo is available at charts.domain.com
, add a dependency to this as per usual
dependencies:
- name: my-chart
repository: http://charts.domain.com
version: 0.0.1
then, when you develop locally, add an entry to your hosts file which points charts.domain.com
to your localhost
charts.
Sample workflow might be something like:
mkdir my-charts
mv my-char-a-0.0.1.tgz my-charts/
helm repo index my-charts/ --url http://charts.domain.com
Now serve the index/repo generated from localhost. This way your dependency is always to charts.domain.com
Depending on which remote host you're using you could just rsync this local index to your remote when you're happy to release and that way you reduce the chance of your local and remotes diverging.
Again, caveat being you need to enable disable this host entry depending on if your developing or wanting to use the live repo. You can always script the editing of host file entry.