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 does not overwrite booleans #7313

Closed
parinapatel opened this issue Dec 30, 2019 · 1 comment
Closed

Merge does not overwrite booleans #7313

parinapatel opened this issue Dec 30, 2019 · 1 comment

Comments

@parinapatel
Copy link

Output of helm version:

ppatel@NB:Mon Dec 30 01:24 PM ~/Documents/ : helm version
version.BuildInfo{Version:"v3.0.2", GitCommit:"19e47ee3283ae98139d98460de796c1be1e3975f", GitTreeState:"clean", GoVersion:"go1.13.5"}

Output of kubectl version:

ppatel@NB:Mon Dec 30 01:25 PM ~/Documents/: kubectl version
Client Version: version.Info{Major:"1", Minor:"17", GitVersion:"v1.17.0", GitCommit:"70132b0f130acc0bed193d9ba59dd186f0e634cf", GitTreeState:"clean", BuildDate:"2019-12-13T11:51:44Z", GoVersion:"go1.13.4", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"16", GitVersion:"v1.16.3", GitCommit:"b3cbbae08ec52a7fc73d334838e18d17e8512749", GitTreeState:"clean", BuildDate:"2019-11-13T11:13:49Z", GoVersion:"go1.12.12", Compiler:"gc", Platform:"linux/amd64"}

Context :
I am trying use merge capability for dict in template. Merge works perfectly as expected but during boolean values it fails in certain case.
values:

service_name: activity

common:
  replicas: 1
  mongo_ssl_enabled: true


deployment:
  service:
    activity:
      replicas: 2
      mongo_ssl_enabled: false

test-connection file :

{{- $overwrite := get .Values.deployment.service .Values.service_name -}}
{{- $service := deepCopy .Values.common | merge $overwrite -}}

### NOTES
common: {{ printf "%d" .Values.common }}
service: {{ printf "%d" $service }}

expected output :

---
# Source: aunsight/templates/tests/test-connection.yaml
### NOTES
common: map[%!d(string=mongo_ssl_enabled):%!d(bool=true) %!d(string=replicas):%!d(float64=1)]
service: map[%!d(string=mongo_ssl_enabled):%!d(bool=false) %!d(string=replicas):%!d(float64=2)]

Buggy output :

---
# Source: aunsight/templates/tests/test-connection.yaml
### NOTES
common: map[%!d(string=mongo_ssl_enabled):%!d(bool=true) %!d(string=replicas):%!d(float64=1)]
service: map[%!d(string=mongo_ssl_enabled):%!d(bool=true) %!d(string=replicas):%!d(float64=2)]
@parinapatel parinapatel changed the title Merge doesnt overwrite booleans Merge does not overwrite booleans Dec 30, 2019
@bacongobbler
Copy link
Member

See #5238. Use the mergeOverride function when dealing with boolean values. There are semantic differences when merging truthy values together that require being handled in a different way.

Thanks!

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

No branches or pull requests

2 participants