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

Merge remote helmfile with local values #1205

Open
XenoAura opened this issue Apr 14, 2020 · 10 comments
Open

Merge remote helmfile with local values #1205

XenoAura opened this issue Apr 14, 2020 · 10 comments

Comments

@XenoAura
Copy link

XenoAura commented Apr 14, 2020

It would be nice if the following syntax was implemented. Remote helmfile and local values are not currently being merged.

helmfiles:
  - path: git::ssh://git@dsf.yaml
    values:
      - values.yaml

Originally posted by @kamsz in #469 (comment)

@andrewnazarov
Copy link
Contributor

I don't think I'm following you correctly but we've been using this syntax for some time. It works for us.

@XenoAura
Copy link
Author

XenoAura commented Apr 14, 2020

I discovered strange behavior.
This works for repositories in github, but not working for gitlab repos. (not correct)

upd.

Reproducing the problem

helmfile.yaml

helmfiles:
- path: git::https://github.com/XenoAura/helmfile-test.git@helmfile.yaml?ref=master
  values:
    - metallb-vals.yaml

metallb-vals.yaml

configInline:
  address-pools:
    - name: ingress
      protocol: layer2
      addresses:
      - 10.12.12.184-10.12.12.184

prometheus:
  serviceMonitor:
    enabled: false
  prometheusRule:
    enabled: false
$ helmfile --log-level debug template

instead of values from metallb-vals.yaml i saw following log:

worker 1/1 finished
successfully generated the value file at values.yaml. produced:
configInline: {}

prometheus:
  serviceMonitor:
    enabled: true
  prometheusRule:
    enabled: true

another repo: https://gitlab.com/XenoAura/helmfile-test.git@helmfile.yaml?ref=master

@andrewnazarov
Copy link
Contributor

We are using Gitlab:)

Probably our case is a bit different as we are utilizing environments:. But since global environments are not inherited by sub-helmfiles we've ended up with the following workaround:

environments:
  staging:
    values:
      - environments/staging.yaml

helmfiles:
  - path: git::https://gitlab+mytoken:{{ requiredEnv "REPO_TOKEN" }}@gitlab.mydomain.com/my-project/my-repo.git@deployment/helmfile.yaml?ref=master
    values:
      - environments/staging.yaml

and we run this like helmfile -e staging diff

@baurmatt
Copy link
Contributor

baurmatt commented May 4, 2020

Running into the same problem. Using the syntax shown in the README.md doesn't use the provided values file:

...
helmfiles:
- path: path/to/subhelmfile.yaml
  values:
    # Values files merged into the nested state's values
    - additional.values.yaml
...

Also your workaround @andrewnazarov doesn't work for us:

environments:
  default:
    values:
      - values.yaml

helmfiles:
  - path: git::https://gitlab.com/path/to/project@helmfile.yaml?ref=master
    values:
      - values.yaml

@andrewnazarov
Copy link
Contributor

@baurmatt what is your helmfile version?

@baurmatt
Copy link
Contributor

baurmatt commented May 4, 2020

@andrewnazarov v0.114.0

@baurmatt
Copy link
Contributor

baurmatt commented May 4, 2020

I think the problem is: You can't override values which are defined in other values YAML includes.

For example this doesn't work:

helmfile-to-be-included.yaml

...
releases:
  - name: foo
    ...
    values:
      - values.yaml # Uses replica: 1
...

helmfile.yaml:

helmfiles:
  - path: path/to/helmfile-to-be-included.yaml
    values:
      - values-override.yaml # Uses replica: 2

But this seems to work:

helmfile-to-be-included.yaml

...
releases:
  - name: foo
    ...
    values:
      - replica: 1
...

helmfile.yaml:

helmfiles:
  - path: path/to/helmfile-to-be-included.yaml
    values:
      - values-override.yaml # Uses replica: 2

@andrewnazarov
Copy link
Contributor

Yes, our case is your second example. We don't have these nested references. In our remote helmfile we have inline values only.

@baurmatt
Copy link
Contributor

baurmatt commented May 4, 2020

Thanks for checking! :) Sadly this approach doesn't work for us, as we depend on two different files of values being used in the sub helmfile:

...
releases:
  - name: prometheus-operator
    chart: stable/prometheus-operator
    version: 8.12.3
    values:
      - values-managed-services.yaml
      - values-base.yaml
...

This is because the values-base.yaml gets used by another project.

@abdennour
Copy link
Contributor

I am using submodules to overcome this issue.

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

No branches or pull requests

4 participants