Skip to content

fix: support helm v4 beside v3#6016

Merged
k8s-ci-robot merged 2 commits intokubernetes-sigs:masterfrom
hmilkovi:fix/helm-4.0
Feb 5, 2026
Merged

fix: support helm v4 beside v3#6016
k8s-ci-robot merged 2 commits intokubernetes-sigs:masterfrom
hmilkovi:fix/helm-4.0

Conversation

@hmilkovi
Copy link
Contributor

This PR fixes Helm V4 issues.

Helm V4 is backward compatible with V3 helm charts and -c is not needed for V3 Helm (tested it).

This is fix for error I experience also #6013

Many thanks in advance for viewing this PR.

@k8s-ci-robot
Copy link
Contributor

Welcome @hmilkovi!

It looks like this is your first PR to kubernetes-sigs/kustomize 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes-sigs/kustomize has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Nov 15, 2025

CLA Signed

The committers listed above are authorized under a signed CLA.

@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Nov 15, 2025
@k8s-ci-robot
Copy link
Contributor

Hi @hmilkovi. Thanks for your PR.

I'm waiting for a github.com member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

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-sigs/prow repository.

@k8s-ci-robot k8s-ci-robot added cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. and removed cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. labels Nov 15, 2025
@k8s-ci-robot
Copy link
Contributor

This PR has multiple commits, and the default merge method is: merge.
You can request commits to be squashed using the label: tide/merge-method-squash

Details

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-sigs/prow repository.

@k8s-ci-robot k8s-ci-robot added 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. labels Nov 15, 2025
@hmilkovi
Copy link
Contributor Author

hmilkovi commented Nov 15, 2025

I have changed tests to be done with V4. I was thinking if I should implement to run tests with both versions of Helm?

@koba1t
Copy link
Member

koba1t commented Nov 16, 2025

Considering that Helm v3 is likely installed in the environment, I believe we need code and tests that can support both v3 and v4 environments.

@koba1t
Copy link
Member

koba1t commented Nov 16, 2025

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Nov 16, 2025
@koba1t
Copy link
Member

koba1t commented Nov 16, 2025

Helm V4 is backward compatible with V3 helm charts and -c is not needed for V3 Helm (tested it).

OK, I understand.
Please add tests for both v3 and v4 binaries.
This ensures backward compatibility in kustomize.

@k8s-ci-robot k8s-ci-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Nov 16, 2025
@hmilkovi
Copy link
Contributor Author

I agree as I didn't want to make it only Helm V4 as many people will still use V3 and that would be a breaking change.

I have added wrapper for Helm tests to be run for multiple versions in HelmChartInflationGenerator_test.go, example test logs:

--- PASS: TestHelmChartInflationGeneratorWithDebug (0.48s)
    --- PASS: TestHelmChartInflationGeneratorWithDebug/HelmV3 (0.24s)
    --- PASS: TestHelmChartInflationGeneratorWithDebug/HelmV4 (0.24s)

@hmilkovi
Copy link
Contributor Author

/retest

@hmilkovi
Copy link
Contributor Author

/retest-required

@hmilkovi
Copy link
Contributor Author

@koba1t can you please check when you have time, sorry for direct ping

@tcaddy
Copy link

tcaddy commented Dec 15, 2025

What can be done to get this across the finish line? I'd like to see #6013 resolved. @hmilkovi can you please squash your commits? If there is anything else holding up the approved/LGTM labels, can someone comment about what else is needed?

@hmilkovi
Copy link
Contributor Author

hmilkovi commented Jan 12, 2026

Sorry for misunderstanding message.

After checking I propose that we add install of Helm before tests.
https://github.com/kubernetes-sigs/kustomize/blob/master/.github/workflows/go.yml#L139

make $(go env GOPATH)/bin/helmV4

I just not sure if we should support also Windows here as I don't have a Windows installation and want to avoid if possible.

If I see correctly on master branch Helm tests are also skipped, checked random commit where tests passed:
https://github.com/kubernetes-sigs/kustomize/actions/runs/19710588332/job/56469821183#step:4:2979

@hmilkovi
Copy link
Contributor Author

/retest-required

@hmilkovi
Copy link
Contributor Author

hmilkovi commented Jan 22, 2026

Tested it with Helm V3 and V4 locally. Discovered relation to #5971:

Helm chart resources are now tagged with kustomize.config.k8s.io/helm-chart-generated: "true" annotation during generation

$ go test ./api/krusty -run TestHelmChartDifferentNamespaces
===== ACTUAL BEGIN ========================================
apiVersion: v1
kind: Service
metadata:
  annotations:
    helm-namespace: helm-ns
  name: test-service
  namespace: helm-ns
===== ACTUAL END ==========================================
   EXPECTED                                                     ACTUAL
   --------                                                     ------
   apiVersion: v1                                               apiVersion: v1
   kind: Service                                                kind: Service
   metadata:                                                    metadata:
     annotations:                                                 annotations:
       helm-namespace: helm-ns                                      helm-namespace: helm-ns
X      internal.config.kubernetes.io/helm-generated: "true"       name: test-service
X    name: test-service                                           namespace: helm-ns
X    namespace: helm-ns
--- FAIL: TestHelmChartDifferentNamespaces (0.06s)
    hasgett.go:22: Expected not equal to actual
FAIL
FAIL	sigs.k8s.io/kustomize/api/krusty	0.509s
FAIL

@Skaronator Can you please jump in to give a bit more light if we expect it to render this internal annotation or remove it?
Currently kustomizer.Run() unconditionally calls m.RemoveBuildAnnotations(), which removes the internal.config.kubernetes.io/helm-generated: "true" annotation as it's part of the BuildAnnotations slice:

konfig.HelmGeneratedAnnotation,

I can do either way, I want to fix the Helm integration tests. Many thanks for your time.

@hmilkovi
Copy link
Contributor Author

hmilkovi commented Feb 2, 2026

/retest-required

@hmilkovi
Copy link
Contributor Author

hmilkovi commented Feb 4, 2026

@koba1t Can you please check when you have time? Tests should pass now.

@koba1t
Copy link
Member

koba1t commented Feb 4, 2026

Hi @hmilkovi
So sorry to delay resnponse and can't spend time on this problem. (I started working at a new company this month.)

After seeing your PR, I realized that it is difficult to balance helmv3 and helmv4 tests with the current test code. I think that the current test seems to be tested only with helmv4 binary.

So, could you please modify this PR to include only the following file without including any changes to testing or CI?
plugin/builtin/helmchartinflationgenerator/HelmChartInflationGenerator.go
I checked, and since helmv4 is trying to maintain backward compatibility with helmv3, the above code should work even if tested with a helmv3 binary.

I'm thinking of introducing testing for helmv4 in a separate PR.

I'm sorry that the implementation policy has changed, but please update this PR or create a separate PR.

@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Feb 4, 2026
@hmilkovi
Copy link
Contributor Author

hmilkovi commented Feb 4, 2026

I agree, all fine don't worry. I have kept changes related only to Helm:

  • api/internal/builtins/HelmChartInflationGenerator.go
  • plugin/builtin/helmchartinflationgenerator/HelmChartInflationGenerator.go

Related to tests I want to just keep this as it fixes tests to pass (not related to Helm version):

  • api/krusty/helmchartinflationgenerator_test.go

@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Feb 4, 2026
@k8s-ci-robot k8s-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Feb 4, 2026
@koba1t
Copy link
Member

koba1t commented Feb 5, 2026

Thank you @hmilkovi

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 5, 2026
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: hmilkovi, koba1t, Skaronator

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Feb 5, 2026
@k8s-ci-robot k8s-ci-robot merged commit 6c8c9cc into kubernetes-sigs:master Feb 5, 2026
22 checks passed
@erikgb
Copy link
Member

erikgb commented Feb 5, 2026

We have been waiting very long for this bugfix, so I am really glad to see it finally merged. Would it be possible to cut a release containing the fix ASAP, @koba1t?

@koba1t
Copy link
Member

koba1t commented Feb 6, 2026

@erikgb

I plan to make a new release after #6044 is merged.

@koba1t
Copy link
Member

koba1t commented Feb 9, 2026

A new release has been created that fixes this issue
https://github.com/kubernetes-sigs/kustomize/releases/tag/kustomize%2Fv5.8.1

tmeijn pushed a commit to tmeijn/dotfiles that referenced this pull request Feb 10, 2026
This MR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [kubernetes-sigs/kustomize](https://github.com/kubernetes-sigs/kustomize) | patch | `v5.8.0` → `v5.8.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>kubernetes-sigs/kustomize (kubernetes-sigs/kustomize)</summary>

### [`v5.8.1`](https://github.com/kubernetes-sigs/kustomize/releases/tag/kustomize/v5.8.1)

[Compare Source](kubernetes-sigs/kustomize@kustomize/v5.8.0...kustomize/v5.8.1)

#### Introduction

This release completes a fix for namespace propagation that occurred in v5.8.0. [#&#8203;6031 (comment)](kubernetes-sigs/kustomize#6031 (comment))
Also addressed the breaking changes introduced in helm v4. [#&#8203;6016](kubernetes-sigs/kustomize#6016)

#### fix

[#&#8203;5990](kubernetes-sigs/kustomize#5990): fix: allow empty patches files
[#&#8203;6016](kubernetes-sigs/kustomize#6016): fix: support helm v4 beside v3
[#&#8203;6038](kubernetes-sigs/kustomize#6038): Fix a failing test
[#&#8203;6044](kubernetes-sigs/kustomize#6044): Fix namespace propagation problem at v5.8.0

#### Dependencies

[#&#8203;6057](kubernetes-sigs/kustomize#6057): Upgrade json-patch to v4.13.0 to remove pkg/errors dependency

#### chore

[#&#8203;6065](kubernetes-sigs/kustomize#6065): Update kyaml to v0.21.1
[#&#8203;6066](kubernetes-sigs/kustomize#6066): Update cmd/config to v0.21.1
[#&#8203;6067](kubernetes-sigs/kustomize#6067): Update api to v0.21.1

</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:eyJjcmVhdGVkSW5WZXIiOiI0Mi45Ni4yIiwidXBkYXRlZEluVmVyIjoiNDIuOTYuMiIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsiUmVub3ZhdGUgQm90IiwiYXV0b21hdGlvbjpib3QtYXV0aG9yZWQiLCJkZXBlbmRlbmN5LXR5cGU6OnBhdGNoIl19-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants