Files
helm/pkg/action
Pujitha Paladugu 5fed6a5e0d fix(action): wait for CRD establishment under HookOnlyStrategy (#32672)
* fix(action): wait for CRD establishment under HookOnlyStrategy

Motivation:
installCRDs() selected its CRD-establishment waiter using the
release's WaitStrategy. Under kube.HookOnlyStrategy, that waiter's
Wait() is a no-op by design, intended to skip waiting on general
chart resources such as Deployments. That no-op also silently
skipped the unrelated CRD establishment check, which exists so
custom resources depending on freshly-installed CRDs aren't
processed before the API server recognizes the new CRD types. Helm 3
performed this CRD establishment wait unconditionally, regardless of
the release's wait flag/strategy. Under HookOnlyStrategy this can
intermittently produce an install failure such as:

  no matches for kind "ServiceMonitor" in version "monitoring.coreos.com/v1"

when a chart installs CRDs and dependent custom resources in the
same release, if the CRDs have not finished being established by the
time Helm processes the custom resources.

Approach:
In installCRDs(), compute a local crdWaitStrategy that substitutes
kube.StatusWatcherStrategy for the CRD-establishment wait only when
i.WaitStrategy is HookOnlyStrategy. i.WaitStrategy itself is left
untouched, so every other waiter-selection call site (the
general-resource wait later in Install.RunWithContext, and the
equivalents in rollback.go/upgrade.go) keeps HookOnlyStrategy's
existing no-op behavior for general resources. This mirrors the
promotion to StatusWatcherStrategy already used elsewhere in this
file for HookOnlyStrategy combined with RollbackOnFailure.

Validation:
- go build ./...
- go test ./pkg/action/... ./pkg/kube/...
- golangci-lint run ./pkg/action/... ./pkg/kube/... (0 issues)
- go vet ./pkg/action/... ./pkg/kube/... (clean)
- go mod tidy -diff (empty)
- make build && make test-coverage PKG="./pkg/action/... ./pkg/kube/..."
- Added TestInstallCRDs_HookOnlyStrategyStillWaitsForEstablishment, a
  targeted unit test with a fake kube.Interface that mimics the real
  no-op hookOnlyWaiter versus a genuine wait attempt. Verified via
  git stash that this test fails on the pre-fix code ("An error is
  expected but got nil") and passes after the fix.

This was validated at the unit level with a fake Kubernetes client,
not against a live cluster.

Report: https://github.com/helm/helm/issues/32671
Signed-off-by: Pujitha Paladugu <10557236+pujitha24@users.noreply.github.com>
Assisted-by: claude-sonnet-5 (via Claude Code)

* test(action): reuse FailingKubeClient for the CRD wait strategy test

Drop the test-only strategyAwareWaitKubeClient/strategyAwareWaiter fakes
and use kubefake.FailingKubeClient instead. FailingKubeClient now records
the WaitStrategy passed to GetWaiter/GetWaiterWithOptions in
RecordedWaitStrategies, alongside the existing RecordedWaitOptions, so the
test can assert installCRDs() asks for a StatusWatcherStrategy waiter
under HookOnlyStrategy.

Signed-off-by: Pujitha Paladugu <10557236+pujitha24@users.noreply.github.com>
Assisted-by: claude-opus-5-5 (via Claude Code)

---------

Signed-off-by: Pujitha Paladugu <10557236+pujitha24@users.noreply.github.com>
Co-authored-by: Pujitha Paladugu <10557236+pujitha24@users.noreply.github.com>
(cherry picked from commit dc56a44fee)
2026-10-14 19:56:55 -04:00
..
…
2026-07-27 19:53:24 +02:00
2026-03-14 08:47:43 +01:00
2026-02-23 16:46:35 -08:00
2026-07-27 19:53:24 +02:00
2026-07-27 19:53:24 +02:00
2021-04-12 22:56:09 -04:00
2026-02-23 16:46:35 -08:00
2026-07-27 19:53:24 +02:00
2026-07-27 19:53:24 +02:00
2026-07-27 19:53:24 +02:00
2026-07-27 19:53:24 +02:00
2025-09-17 11:14:34 -06:00