Skip to content

fix(action): guard nil RESTClientGetter in CRD install path (dev-v3)#31920

Open
SergioChan wants to merge 1 commit intohelm:dev-v3from
SergioChan:backport-fix-empty-crd-resources-31552
Open

fix(action): guard nil RESTClientGetter in CRD install path (dev-v3)#31920
SergioChan wants to merge 1 commit intohelm:dev-v3from
SergioChan:backport-fix-empty-crd-resources-31552

Conversation

@SergioChan
Copy link

What this PR does / why we need it

Backports the helm template panic fix to dev-v3 for issue #31552.

When CRDs are present, installCRDs always dereferenced i.cfg.RESTClientGetter to invalidate discovery/REST mapper caches. In ClientOnly flows this getter can be nil, which caused a nil pointer panic instead of returning a template error.

This PR:

  • guards CRD cache invalidation behind i.cfg.RESTClientGetter != nil
  • keeps cache invalidation behavior unchanged when a getter is available
  • adds a regression test (TestInstallCRDsWithNilRESTClientGetter) to ensure no panic when CRDs exist and RESTClientGetter is nil

Fixes #31552

Validation

  • go test ./pkg/action -run "TestInstallCRDsWithNilRESTClientGetter|TestInstallRelease$" -count=1

@pull-request-size pull-request-size bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Mar 11, 2026
Signed-off-by: sergiochan <yuheng9211@qq.com>
@SergioChan SergioChan force-pushed the backport-fix-empty-crd-resources-31552 branch from b2454d6 to 711a4ea Compare March 11, 2026 00:59
@SergioChan
Copy link
Author

Pushed a follow-up commit (force-push) to satisfy the failing DCO check.

  • Added Signed-off-by via git commit --amend -s
  • No functional code changes beyond sign-off metadata

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

Labels

size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant