Thiru
Thiru

Reputation: 327

Specifying local helm dependency

I am trying to add a rabbitmq service using a bitnami helm chart. the chart contains one dependent helm chart which is called common. The whole application itself is deployed using a parent helm chart and each service has its own separate helm chart. the Helm chart structure looks like this-

\myapp
    \charts
        \service1
        \service2
        \service3
        \messaging
            \charts 
                \common
            \templates
                \chart.yml
                \values.yml

When i ran "helm dependency update" from the 'messaging' dir, it downloaded a common-1.x.x.tgz file. i extracted the contents and placed it in the \messaging\charts\common folder the original messaging\templates\chart.yml (rabbitmq helm chart) contained the following entry

dependencies:
  - name: common
    repository: https://charts.bitnami.com/bitnami
    tags:
      - bitnami-common
    version: 1.x.x

because i cannot download during the "Helm install" execution i had to download the dependent helm charts beforehand and save them as a local dependency. After downloading the common.tgz file, i extracted the contents and updated the dependencies in the messaging\templates\chart.yml as follows

dependencies:
  - name: common
    repository: 'file://charts/messaging/charts/common'
    tags:
      - bitnami-common
    version: 1.x.x

If i do "helm install messaging ." from \myapp\charts\messaging directory, the service gets deployed without any error. But when the application's parent helm chart is deployed i always get this error

"Error: found in Chart.yaml, but missing in charts/ directory: messaging"

Can someone please point out the mistake in the configuration? I moved around the contents of the common folder around multiple location, had them as tgz file, updated the repository path relative to the messaging directory instead of parent helm chart location, but in all cases, the installation of the messaging service fails with the above error

Upvotes: 1

Views: 19262

Answers (2)

Spoolie
Spoolie

Reputation: 31

I had a similar issue and it was because a developer had placed the Charts and templates etc in the charts directory. I kept getting errors saying it couldn't find directories so moved all the charts into a helm-charts directory instead as the charts directory is managed by Helm. When I updated the repository listing to pull from the new directory, my issue was resolved. I got the idea from this issue's comments and it worked. https://github.com/helm/helm/issues/2887

Upvotes: 0

David Maze
David Maze

Reputation: 160043

You don't need to unpack the charts/*.tgz file. If they're in that directory (and still packed up) then Helm will use them to run the deployment. Helm won't contact the external chart repository on its own, only when you run the helm dependency commands.

After you run helm dep up your filesystem layout should look like

myapp
\-- charts
  \-- messaging
    +-- charts
    | \-- rabbitmq-8.15.3.tgz
    |-- templates
    | +-- deployment.yaml
    | \-- service.yaml
    +-- Chart.yaml
    \-- values.yaml

You're ready to go in this state. Don't unpack anything.

If you need to copy this setup across a network boundary, include the charts/*.tgz files when you do it. It doesn't matter that Chart.yaml or requirements.yaml references an Internet location; helm install will only use those local archives.

Upvotes: 7

Related Questions