Skip to content

[v3 backport] fix(action): guard nil RESTClientGetter in CRD install path#31920

Merged
gjenkins8 merged 1 commit into
helm:dev-v3from
SergioChan:backport-fix-empty-crd-resources-31552
May 16, 2026
Merged

[v3 backport] fix(action): guard nil RESTClientGetter in CRD install path#31920
gjenkins8 merged 1 commit into
helm:dev-v3from
SergioChan:backport-fix-empty-crd-resources-31552

Conversation

@SergioChan

@SergioChan SergioChan commented Mar 11, 2026

Copy link
Copy Markdown

What this PR does / why we need it

Backports the helm template panic fix in #31578 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
@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
Copy Markdown
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

@TerryHowe TerryHowe left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

/lgtm

@TerryHowe TerryHowe added the Has One Approval This PR has one approval. It still needs a second approval to be merged. label Mar 22, 2026
@gjenkins8
gjenkins8 merged commit 348e654 into helm:dev-v3 May 16, 2026
1 check passed
@scottrigby scottrigby changed the title fix(action): guard nil RESTClientGetter in CRD install path (dev-v3) [v3 backport] fix(action): guard nil RESTClientGetter in CRD install path Jun 12, 2026
@scottrigby scottrigby added this to the 3.21.1 milestone Jun 12, 2026
@scottrigby scottrigby added bug Categorizes issue or PR as related to a bug. needs-pick Indicates that a PR needs to be cherry-picked into the next release candidate. picked Indicates that a PR has been cherry-picked into the next release candidate. and removed Has One Approval This PR has one approval. It still needs a second approval to be merged. needs-pick Indicates that a PR needs to be cherry-picked into the next release candidate. labels Jun 12, 2026
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. picked Indicates that a PR has been cherry-picked into the next release candidate. 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.

4 participants