Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Local dependencies not working in release definition #1762

Closed
marianogg9 opened this issue Apr 8, 2021 · 7 comments · Fixed by #1765
Closed

Local dependencies not working in release definition #1762

marianogg9 opened this issue Apr 8, 2021 · 7 comments · Fixed by #1765

Comments

@marianogg9
Copy link

marianogg9 commented Apr 8, 2021

Hi all.
I am facing an issue with local dependencies declaration part of a release, as follows:

releases:
- name: foo_rel
   namespace: foo_ns
   chart: foo_example
   dependencies:
   - name: dep_chart
      repository: file://../path/to/dep_chart_dir
      version: 1.0.1

The above will throw this error when trying to render/diff templates:

in helmfile.d/helmfile.yaml: failed to read helmfile.yaml: reading document at index 1: yaml: unmarshal errors:
  line 12: field name not found in type state.Dependency
  line 13: field repository not found in type state.Dependency
exit status 1

But if declared in Charts.yaml within foo_example directory, it works just fine and loads/renders dep_chart along with foo_example as expected.

dependencies:
- name: dep_chart
   repository: file://../path/to/dep_chart_dir
   version: 1.0.1

Thank you.

mumoshu added a commit to helmfile/chartify that referenced this issue Apr 9, 2021
mumoshu added a commit that referenced this issue Apr 9, 2021
Helmfile has been providing a feature called "adhoc chart dependency" that basially enabled you to add Chart.yaml `dependencies` entry adhocly without forking or modifying the chart.

It was missing the support for using a local chart as the adhoc dependency. This patch adds that.

Usage:

`releases[].dependencies[].chart` is enhanced to accept the fs path to the local chart:

```
releases:
- name: foo
  chart: ./path/to/foo
  dependencies:
  - chart: ./path/to/bar
```

Resolves #1762
@mumoshu
Copy link
Collaborator

mumoshu commented Apr 9, 2021

@marianogg9 Hey! Please see helmfile/chartify@c9b4508 and #1765.

I was pretty confused initially but I managed to make it work.

First of all, Helmfile's dependencies syntax is a bit different from Helm Chart.yaml's. In helmfile's, the only available fields are:

  • alias (optional)
  • chart (required)
  • version (optional)

Until now chart only supported the REMOTE_REPO/CHART where REMOTE_REPO must be defined in repositories section of your helmfiel.yaml like:

repositories:
- name: REMOTE_REPO
  url: https://example.com/charts

Neither repositories[].url nor releases[].dependencies[].chart had support for local file URLs(with a file:// scheme)

#1765 enhanced the latter, repositories[].dependencies[].chart to just accept the path to local chart.

So,

releases:
- name: foo
  chart: ./path/to/foo
  dependencies:
  - chart: ./path/to/bar

results in Helmfile internally generating Chart.yaml containing:

dependencies:
- alias: bar
  name: bar
  repo: file:///abs/path/to/bar

@marianogg9 WDYT? Does this resolve your issue?

@marianogg9
Copy link
Author

marianogg9 commented Apr 9, 2021

Thank you @mumoshu, that looks good! If it accepts a local FS path for a chart, then it is fixed.

mumoshu added a commit that referenced this issue Apr 10, 2021
Helmfile has been providing a feature called "adhoc chart dependency" that basially enabled you to add Chart.yaml `dependencies` entry adhocly without forking or modifying the chart.

It was missing the support for using a local chart as the adhoc dependency. This patch adds that.

Usage:

`releases[].dependencies[].chart` is enhanced to accept the fs path to the local chart:

```
releases:
- name: foo
  chart: ./path/to/foo
  dependencies:
  - chart: ./path/to/bar
```

Resolves #1762
@mumoshu
Copy link
Collaborator

mumoshu commented Apr 10, 2021

@marianogg9 Thanks for confirming! #1765 has been merged with a brand new documentation about adding ad-hoc dendendencies https://github.com/roboll/helmfile/blob/master/docs/advanced-features.md#adding-dependencies-without-forking-the-chart

@eigood
Copy link

eigood commented Aug 19, 2022

This is still an issue, as the dependencies need a proper version constraint, but with a local kustomization chart, that doesn't work.

@arielweinberger
Copy link

Confirming this does not work

releases:
- name: aws-load-balancer-controller
  chart: eks/aws-load-balancer-controller
  version: 1.4.3
  namespace: kube-system
  dependencies:
  - chart: ./crds
  values:
  - values.yaml.gotmpl

Getting the following error:

in ./helmfile.yaml: in .helmfiles[0]: in releases/aws-load-balancer-controller/helmfile.yaml: [exit status 1

COMMAND:
  helm dependency up /var/folders/9_/hb_cskt16clgqf0380d96shw0000gn/T/chartify978043108/kube-system/aws-load-balancer-controller/aws-load-balancer-controller

OUTPUT:
  Error: dependency "crds" has an invalid version/constraint format: improper constraint: 

@yxxhero
Copy link
Contributor

yxxhero commented Aug 21, 2022

@arielweinberger #2148

@Falven
Copy link

Falven commented Nov 13, 2024

Why is there no namespace field for dependencies 😬 it's the whole reason I started using helmfile in the first place, so that I could deploy subcharts to different namespaces.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants