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

deepCopy, will not override an integer value with the value 0 #356

Open
cunningr opened this issue Dec 12, 2022 · 0 comments
Open

deepCopy, will not override an integer value with the value 0 #356

cunningr opened this issue Dec 12, 2022 · 0 comments

Comments

@cunningr
Copy link

This issue is ported over from helm issues but i am not sure if the issue I am seeing would be in https://github.com/imdario/mergo?

Output of helm version:

version.BuildInfo{Version:"v3.8.2", GitCommit:"6e3701edea09e5d55a8ca2aae03a68917630e91b", GitTreeState:"clean", GoVersion:"go1.18.1"}

Output of kubectl version:

N/A

Cloud Provider/Platform (AKS, GKE, Minikube etc.):

CAPI/Openstack, vanilla k8s.

Issue:

When doing a deepCopy, it is not possible to override an integer value with the value 0. I am not sure if this is a bug or a know behaviour (but it is a little annoying :-)).

We can reproduce this in the helm playground

With values:

---
rolloutStrategy1:
  type: RollingUpdate
  rollingUpdate:
    maxUnavailable: 1
    maxSurge: 1

rolloutStrategy2:
  type: RollingUpdate
  rollingUpdate:
    maxUnavailable: 0
    maxSurge: 1

and template:

---
{{- $nodeGroup := deepCopy $.Values.rolloutStrategy1 | mustMerge $.Values.rolloutStrategy2 }}
{{ toYaml $nodeGroup }}

I would expect the values in rolloutStrategy2 to override the values in rolloutStrategy1, which they do, unless the value is a 0.

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

1 participant