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

Values merge where a key with an nil value is added does not work #1154

Closed
mattymo opened this issue Mar 23, 2020 · 2 comments · Fixed by #1162
Closed

Values merge where a key with an nil value is added does not work #1154

mattymo opened this issue Mar 23, 2020 · 2 comments · Fixed by #1162
Labels

Comments

@mattymo
Copy link

mattymo commented Mar 23, 2020

Problem: Adding a new key to a map with a nil value doesn't merge.

Scenario to reproduce

values1.yaml:

components:
  etcd-operator:
   version: 0.10.0

values2.yaml:

components:
  etcd-operator:
    version:  0.10.3
  prometheus:

helmfile.yaml

repositories:
- name: "stable"
  url: "https://kubernetes-charts.storage.googleapis.com"

environments:
  default:
    values:
      - values1.yaml
      - values2.yaml

releases:
- name: "etcd-operator"
  chart: stable/etcd-operator
{{- if .Values.components | getOrNil "etcd-operator" | getOrNil "version" }}
  version: {{ .Values.components  | getOrNil "etcd-operator"  | getOrNil "version"  }}
{{- end }}

{{- if hasKey .Values.components "prometheus }}
- name: "prometheus"
  chart: stable/prometheus
{{- if .Values.components | getOrNil "prometheus" | getOrNil "version" }}
  version: {{ .Values.components  | getOrNil "prometheus"  | getOrNil "version"  }}
{{- end }}
{{- end }}

Expected calculated values:

components:
  etcd-operator:
    version:  0.10.3
  prometheus:

Actual calculated values:

components:
  etcd-operator:
    version:  0.10.3

Note: If prometheus is an empty map {}, it works, or if prometheus has some version set, it also works.

Helmfile version: v0.104.0

@mumoshu
Copy link
Collaborator

mumoshu commented Mar 29, 2020

@mattymo Thanks! Seems like this is resolved in mergo via darccio/mergo#133. I'll bring it to helmfile soon.

@mumoshu
Copy link
Collaborator

mumoshu commented Mar 29, 2020

@mattymo This should be fixed in v0.106.2. Could you confirm if it works on your machine, too?

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

Successfully merging a pull request may close this issue.

2 participants