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

bugfix: Override subcharts with null values #12879

Merged
merged 4 commits into from
Jan 23, 2025

Conversation

ryanhockstad
Copy link
Contributor

@ryanhockstad ryanhockstad commented Mar 14, 2024

This PR closes #12469 and closes #12488

Helm should allow users to not only override default values, but also completely remove any default values by setting a config to null.

This works fine for regular charts, but default values within sub-charts cannot be null-ed. The linked issue has a good example of this created by user "naemono."

The reason this issue is happening is because the coalesce function goes over sub-chart values that are defined in a values file or with a --set flag twice due to the logic here. merge is always set to false in this context, and the first time coalesce gets called, the null value gets removed during the coalesceTablesFullKey function here. This is fine for regular chart values, but for sub-chart values, the coalesceDeps function runs the logic again for every value in the subChart, so we end right back to the spot in the previous link. But the config option that was explicitly set to null was already removed, so we end up at this point two lines down, which overwrites the user defined null config the sub-chart default value.

This problem only occurs because when the coalesce function is run while merge is false.

To prevent this bug from removing sub-chart config values that are explicitly set to null and therefore getting overwritten when coalesceDeps runs through the sub-chart values a second time, I added logic to check if the key was the name of a sub-chart, and if so setting merge to false so the null config option is not deleted.
 

Special notes for your reviewer:
Follow-up if this PR is accepted may be to add a unit-test to confirm sub-chart nulls aren't overwritten.

@pull-request-size pull-request-size bot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Mar 14, 2024
@ryanhockstad ryanhockstad changed the title Override subcharts with null values bugfix: Override subcharts with null values Mar 15, 2024

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
Signed-off-by: Ryan Hockstad <ryanhockstad@gmail.com>
@messiahUA
Copy link

messiahUA commented Apr 22, 2024

When this could be merged?

@joejulian @mattfarina

@AndrewFarley
Copy link

Please merge/release ASAP. All builds from 3.13 onwards are "effectively" broken for many of my clients because of this.

@aabouzaid
Copy link

I hope to see this in the next Helm release, there are many workarounds used to overcome this bug.

@duplabe
Copy link

duplabe commented May 6, 2024

I think this is also related #12991

@AndrewFarley
Copy link

Beep boop we need this, boop beep

@AndrewFarley
Copy link

Ahh, alas, another week goes by, and yet more DevOps engineers are fraught with this unnecessary pain in having to continue to use such an old version of Helm without this bug. Beep boop, someone merge and release this, boop beep.

@AndrewFarley
Copy link

Another week nudge on this. Sorry to be the annoying jerk, but this is important.

@Tawmu
Copy link

Tawmu commented Jun 11, 2024

Sorry to go against etiquette here with comment spam but we're also affected by this bug, and with this PR waiting for review for almost 3 months now I think some of us might be losing hope :-)

@pisto
Copy link

pisto commented Jun 12, 2024

Just collecting all the duplicate bugs about this over the years, for fun I guess...

#12991 #12741 #12730 #12637 #12594 #12522 #12511 #12490 #12488 #12469 #12441 #12417 #11567 #9806 #9804 #9696 #9136 #9027 #6277 #5184

I'm so happy that the helm devs keep this bug alive so that I can charge my clients hours in working around it. Thanks! Tonight I eat steak thanks to you!

On a more serious note, who can we ping about this? I see @mattfarina worked on #12480 , sorry for the rude ping but maybe you were at least aware of the issue at some point in time.

@MrBlaise
Copy link

MrBlaise commented Jul 1, 2024

I'd like to join the ping party, even though I know it won't help and normally I'd consider it rude as well, but this is getting ridiculous. Even if this is merged it will be some time until tools like argo-cd picks it up so that things can finally go back to the way they were.

Anyone with merge rights on this repo please take a look, lots of people would appreciate it ❤️

@AndrewFarley
Copy link

AndrewFarley commented Jul 2, 2024

Hmm, can we just start aggressively @-ing owners and/or higher tier contributors on this repo? I feel like maybe this thread has been muted, and maybe we have no choice. I don't mention brute force lightly, but this is a serious issue which has gone unchecked for too long.

@sylwit
Copy link

sylwit commented Jul 9, 2024

This PR fixes a really inconvenient bug and is highly expected to be merge.
@joejulian do you know who we should ping to have a look at it or if this PR isn't ready can we have some feedback please ?
Thank you ❤️

@ryanhockstad
Copy link
Contributor Author

@scottrigby I'm not sure the added complexity of adding logic to nullify certain keys after the merge/coalesce recursion has occurred once is worth dealing with edge cases that users are able to handle themselves anyway.

Also, the way that this should be handled is a bit ambiguous anyway. A user may want to actually nullify a parent global key without nullifying all of the children globals.

@scottrigby
Copy link
Member

OK so I think we should keep the scope of this PR to a fix for known issues users are having. It addresses them very well with many new tests, and as such is a valuable improvement. Let's move consideration for fixing possible issues with globals and null values to a separate issue. I'm running the tests now—let's see where they land.

Copy link
Member

@scottrigby scottrigby left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm 👍

@scottrigby scottrigby added the Has One Approval This PR has one approval. It still needs a second approval to be merged. label Jan 21, 2025
Copy link
Contributor

@joejulian joejulian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@scottrigby scottrigby removed the Has One Approval This PR has one approval. It still needs a second approval to be merged. label Jan 23, 2025
@scottrigby
Copy link
Member

Thanks @joejulian and everyone 👏 Merging

@ryanhockstad do you want to open a v3 backport PR from your same branch while the code applies as-is, and link to this one?

@scottrigby scottrigby merged commit d53fb50 into helm:main Jan 23, 2025
5 checks passed
@AndrewFarley
Copy link

10 months later, amazing, thank you team. Now just waiting for the backport and release of Helm 3 with this patch

@ryanhockstad
Copy link
Contributor Author

Here is the backport PR: #13654

@pierluigilenoci
Copy link

@ryanhockstad thank you!

@scottrigby scottrigby removed the Needs v3 backport Label PRs for v4/main, which are still applicable to v3 so need a separate backport PR label Jan 27, 2025
@scottrigby
Copy link
Member

📣 Backport PR #13654 merged 👏 This fix is scheduled to be in Helm 3.17.1

mattfarina pushed a commit that referenced this pull request Feb 12, 2025

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
- Add consistency for null test in given values, parent chart, subchart, and
  sub-sub-chart
- Remove bar null test to keep consistent with boat=null at top level

Signed-off-by: Scott Rigby <scott@r6by.com>
(cherry picked from commit 60fcce1)
tmeijn pushed a commit to tmeijn/dotfiles that referenced this pull request Feb 13, 2025
This MR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [helm/helm](https://github.com/helm/helm) | patch | `v3.17.0` -> `v3.17.1` |

MR created with the help of [el-capitano/tools/renovate-bot](https://gitlab.com/el-capitano/tools/renovate-bot).

**Proposed changes to behavior should be submitted there as MRs.**

---

### Release Notes

<details>
<summary>helm/helm (helm/helm)</summary>

### [`v3.17.1`](https://github.com/helm/helm/releases/tag/v3.17.1): Helm v3.17.1

[Compare Source](helm/helm@v3.17.0...v3.17.1)

Helm v3.17.1 is a patch release. Users are encouraged to upgrade for the best experience. Users are encouraged to upgrade for the best experience.

The community keeps growing, and we'd love to see you there!

-   Join the discussion in [Kubernetes Slack](https://kubernetes.slack.com):
    -   for questions and just to hang out
    -   for discussing MRs, code, and bugs
-   Hang out at the Public Developer Call: Thursday, 9:30 Pacific via [Zoom](https://zoom.us/j/696660622)
-   Test, debug, and contribute charts: [ArtifactHub/packages](https://artifacthub.io/packages/search?kind=0)

#### Installation and Upgrading

Download Helm v3.17.1. The common platform binaries are here:

-   [MacOS amd64](https://get.helm.sh/helm-v3.17.1-darwin-amd64.tar.gz) ([checksum](https://get.helm.sh/helm-v3.17.1-darwin-amd64.tar.gz.sha256sum) / aba59ba9511971a71943b5c76f15d52ace1681197bb3f71ed1f0b15caceacb2c)
-   [MacOS arm64](https://get.helm.sh/helm-v3.17.1-darwin-arm64.tar.gz) ([checksum](https://get.helm.sh/helm-v3.17.1-darwin-arm64.tar.gz.sha256sum) / b823a213d8d7937222becc63d9c7bb3d15a090e7ecd1f70f3a583ed39657e21b)
-   [Linux amd64](https://get.helm.sh/helm-v3.17.1-linux-amd64.tar.gz) ([checksum](https://get.helm.sh/helm-v3.17.1-linux-amd64.tar.gz.sha256sum) / 3b66f3cd28409f29832b1b35b43d9922959a32d795003149707fea84cbcd4469)
-   [Linux arm](https://get.helm.sh/helm-v3.17.1-linux-arm.tar.gz) ([checksum](https://get.helm.sh/helm-v3.17.1-linux-arm.tar.gz.sha256sum) / 1dc5ed54350f4f7ae87441e878be4f4fd9b727a86b11b1d20b1001358c83bed3)
-   [Linux arm64](https://get.helm.sh/helm-v3.17.1-linux-arm64.tar.gz) ([checksum](https://get.helm.sh/helm-v3.17.1-linux-arm64.tar.gz.sha256sum) / c86c9b23602d4abbfae39d9634e25ab1d0ea6c4c16c5b154113efe316a402547)
-   [Linux i386](https://get.helm.sh/helm-v3.17.1-linux-386.tar.gz) ([checksum](https://get.helm.sh/helm-v3.17.1-linux-386.tar.gz.sha256sum) / b972562a1171673db2892f000248b2540ddcd6f76850ec152852a8e9ce7972cb)
-   [Linux ppc64le](https://get.helm.sh/helm-v3.17.1-linux-ppc64le.tar.gz) ([checksum](https://get.helm.sh/helm-v3.17.1-linux-ppc64le.tar.gz.sha256sum) / 4223394f3fca82a7f8e8d083caf6faf0ee0639d8f235071334579237078a2c2e)
-   [Linux s390x](https://get.helm.sh/helm-v3.17.1-linux-s390x.tar.gz) ([checksum](https://get.helm.sh/helm-v3.17.1-linux-s390x.tar.gz.sha256sum) / fe47e5ee8abd6baef01bb1c4fc995343121bf5fc7dead1f67e97484a441ba9e8)
-   [Linux riscv64](https://get.helm.sh/helm-v3.17.1-linux-riscv64.tar.gz) ([checksum](https://get.helm.sh/helm-v3.17.1-linux-riscv64.tar.gz.sha256sum) / cf174b1ff83032255f798278152c637d01dd1d1533fd77915ab751d8cf4191a7)
-   [Windows amd64](https://get.helm.sh/helm-v3.17.1-windows-amd64.zip) ([checksum](https://get.helm.sh/helm-v3.17.1-windows-amd64.zip.sha256sum) / 08281ee6d4d272835ff10c510b8b39736d112d9cb89dfbc853fe83913fbe48d0)
-   [Windows arm64](https://get.helm.sh/helm-v3.17.1-windows-arm64.zip) ([checksum](https://get.helm.sh/helm-v3.17.1-windows-arm64.zip.sha256sum) / 44c9c8246f643ea45bb45013a182fc25da2a8206a6f322a0c6fa47a1f4bcf1e4)

The [Quickstart Guide](https://helm.sh/docs/intro/quickstart/) will get you going from there. For **upgrade instructions** or detailed installation notes, check the [install guide](https://helm.sh/docs/intro/install/). You can also use a [script to install](https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3) on any system with `bash`.

#### What's Next

-   3.17.2 is the next patch release and will be on March 12, 2025
-   3.18.0 is the next minor release and will be on May 14, 2025

#### Changelog

-   add test for nullifying nested global value [`980d8ac`](helm/helm@980d8ac) (Ryan Hockstad)
-   Add test case for removing an entire object [`c23e3b6`](helm/helm@c23e3b6) (Ryan Hockstad)
-   Tests for bugfix: Override subcharts with null values [#&#8203;12879](helm/helm#12879) [`3110d5f`](helm/helm@3110d5f) (Scott Rigby)
-   merge null child chart objects [`9520c71`](helm/helm@9520c71) (Ryan Hockstad)
-   build(deps): bump the k8s-io group with 7 updates [`ab7dedd`](helm/helm@ab7dedd) (dependabot\[bot])
-   fix: check group for resource info match [`a2d3602`](helm/helm@a2d3602) (Jiasheng Zhu)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever MR is behind base branch, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this MR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box

---

This MR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOS4xNjYuMSIsInVwZGF0ZWRJblZlciI6IjM5LjE2Ni4xIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJSZW5vdmF0ZSBCb3QiXX0=-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Categorizes issue or PR as related to a bug. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet