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

cannot use values from bases #1975

Closed
schollii opened this issue Sep 30, 2021 · 6 comments
Closed

cannot use values from bases #1975

schollii opened this issue Sep 30, 2021 · 6 comments

Comments

@schollii
Copy link

helmfile version:

helmfile version v0.140.1

The following setup fails:

  • environments.yaml:
environments:
  default:
    values:
      - datadogApiKey: someKey
  • helmfile-bad.yaml:
bases:
  - environments.yaml

repositories:
  - name: incubator
    url: https://charts.helm.sh/incubator

releases:
  - name: datadog
    chart: incubator/raw
    values:
      - datadog:
          apiKey: {{ .Values.datadogApiKey }}
  • run template, build or sync command; eg:
$ helmfile -f helmfile-bad.yaml template
in ./helmfile-bad.yaml: error during helmfile-bad.yaml.part.0 parsing: template: stringTemplate:14:28: executing "stringTemplate" at <.Values.datadogApiKey>: map has no entry for key "datadogApiKey"
$ _

The following setup works: move the contents of environments.yaml into the helmfile, ie

  • helmfile-ok.yaml:
environments:
  default:
    values:
      - datadogApiKey: someKey

repositories:
  - name: incubator
    url: https://charts.helm.sh/incubator

releases:
  - name: datadog
    chart: incubator/raw
    values:
      - datadog:
          apiKey: {{ .Values.datadogApiKey }}
  • run template, build or sync command; eg:
$ helmfile -f helmfile-ok.yaml template
Adding repo incubator https://charts.helm.sh/incubator
"incubator" has been added to your repositories

Templating release=datadog, chart=incubator/raw
$ _

Is this a bug or I'm doing something wrong?

@kingli-crypto
Copy link

I have the same issue on helmfile version v0.142.0

@oliver-subskribe
Copy link

Wondering if #1090 is related

@antaloala
Copy link

antaloala commented Dec 23, 2021

This is really related to how helmfile "double rendering" works (see #308)
Solution was previously commented by @mumoshu (see this comment from #388).

You can easily solve it using a --- yaml separator inside helmfile-bad.yaml (see below, I tested it using the helmfile yaml files commented above):

bases:
  - environments.yaml
---
repositories:
  - name: incubator
    url: https://charts.helm.sh/incubator

releases:
  - name: datadog
    chart: incubator/raw
    values:
      - datadog:
          apiKey: {{ .Values.datadogApiKey }}
    values:
      - datadog:
          apiKey: {{ .Values.datadogApiKey }}

@schollii
Copy link
Author

Right on I will try that, thanks so much @antaloala!

@mumoshu
Copy link
Collaborator

mumoshu commented Jan 15, 2022

Thanks a lot @antaloala!
I'm closing this as answered.

@schollii
Copy link
Author

schollii commented Jan 15, 2022

@mumoshu I think it is a bug so although there is a workaround,

  1. it should be fixed (maybe this ticket should remain open then)
  2. until it is fixed, the workaround should be documented in the readme or the docs folder.

I see you have # 2 in #756. I can submit a PR for # 2. Let me know where you think this info should go.

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

5 participants