-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Remove non-essential dependency imdario/mergo
#5044
Remove non-essential dependency imdario/mergo
#5044
Conversation
Welcome @krzysiekg! |
Hi @krzysiekg. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Thanks for your contributing!
Could you try to add the test with |
/ok-to-test |
Agreed, I would prefer a dedicated test case that shows the bug fix specifically (ideally as small and specific as possible). I'm also wondering why we use |
No problem, I will write separate tests for this. Once I have them I'll also try and replace |
/triage under-consideration |
The Kubernetes project currently lacks enough contributors to adequately respond to all PRs. This bot triages PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale |
The Kubernetes project currently lacks enough active contributors to adequately respond to all PRs. This bot triages PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle rotten |
@krzysiekg Hi, did you get a chance to write those tests? |
d88c002
to
ff4d8b5
Compare
Sorry for the long silence. I did write the test and replaced Since kustomize roadmap states that |
This PR has multiple commits, and the default merge method is: merge. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/ok-to-test |
switch p.ValuesMerge { | ||
case valuesMergeOptionOverride: | ||
err = mergo.Merge( | ||
&chValues, p.ValuesInline, mergo.WithOverride) | ||
outValues, err = merge2.Merge(inlineValues, chValues, kyaml.MergeOptions{}) | ||
case valuesMergeOptionMerge: | ||
err = mergo.Merge(&chValues, p.ValuesInline) | ||
outValues, err = merge2.Merge(chValues, inlineValues, kyaml.MergeOptions{}) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Override option with kyaml/yaml/merge2 lib can be achieved without extra parameters, just by passing src and dest in different order.
Could you add any comments about the above information?
I think this code is a little confusing what is doing because the above two lines only have different argument orders.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point! I added the explanation in the code.
Unrelated, but I also decided to copy the value before merging, so that the original values are preserved after the merge. Someone might still want to use it.
I think this change looks almost good, and we can merge. @natasha41575 |
plugin/builtin/helmchartinflationgenerator/HelmChartInflationGenerator.go
Outdated
Show resolved
Hide resolved
The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs. This bot triages PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /close |
@k8s-triage-robot: Closed this PR. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/reopen |
@krzysiekg: Failed to re-open PR: state cannot be changed. The fix-empty-map-merge branch was force-pushed or recreated. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/reopen |
@krzysiekg: Reopened this PR. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
plugin/builtin/helmchartinflationgenerator/HelmChartInflationGenerator_test.go
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @krzysiekg
This PR almost looks good to me!
I plan to merge it.
But, I found a scenario of tests that are better to take.
Could you add any tests?
I added the test for I think it functionality is limited but it is hard to tell how many people actually use it, so maybe it is better to keep it around. It does not replace the default values file from the chart (I would expect that). It only can replace the values file defined in the kustomization file with the values inline. But since it has to be the same kustomization file, people can just pass everything as inline values of as values file. And you can't use it to replace the values when you include the kustomization into another kustomization as resource, because at that point, helm chart is already inflated. But it is not the |
919aefb
to
d73f0fd
Compare
Lint check was failing on |
Thanks! |
I agree with your opinion. I think the |
Hi @krzysiekg Thanks for your long working! /lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: koba1t, krzysiekg The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
This fixes #4905
There was an issue with overwriting empty values in map[string]interface{} that was fixed a while ago in darccio/mergo#84.
I'm not sure how to test it best. None of the charts used in tests have this issue. I'm thinking about replacing minecraft chart that is used to test valuesInline with istio gateway chart. That way I can test all that these tests already cover plus that empty map issue. But maybe that is too much. I can also just add a separate test just to cover this.