Skip to content

fix(deploy): kates deploy no longer deletes ~/.cache/helm - #391

Merged
bmscomp merged 1 commit into
mainfrom
fix/deploy-keeps-helm-cache
Oct 18, 2026
Merged

bmscomp merged 1 commit into
mainfrom
fix/deploy-keeps-helm-cache

Conversation

@bmscomp

@bmscomp bmscomp commented Oct 18, 2026

Copy link
Copy Markdown
Owner

Item 1.4 of the CLI performance and stability plan (finding F12). Independent of the other Wave 1 PRs.

Why

At the end of Group A, kates deploy refreshes the API server's schema cache by deleting ~/.kube/cache/discovery and ~/.cache/helm (cli/cmd/deploy_components.go:1013-1018 on main, 6f4cf61). The second is no discovery cache. On Linux it is Helm's repository cache ($XDG_CACHE_HOME/helm), where each repo's index lives.

  • Group A adds the kyverno repo and installs Kyverno, and then the cache goes.
  • With monitoring, wireKyvernoScrape later runs helm upgrade kyverno kyverno/kyverno (cli/cmd/deploy_monitoring.go:96) with no repo add or repo update before it. Without its index, Helm fails with "no cached repo found".
  • Every deploy also empties the user's own helm search repo.
  • macOS keeps the cache in ~/Library/Caches/helm, which is why it goes unnoticed there.

The status is PLAUSIBLE, with high confidence: it is Helm's documented cache layout, but it was not run on Linux.

Changes

cli/cmd/deploy_components.go: the os.RemoveAll of ~/.cache/helm is gone. ~/.kube/cache/discovery, the cache that was meant, is still deleted, and a comment says why the Helm cache stays.

Tests

None added, as the plan says for this item: the line is deleted, and nothing read it.

Run locally, passing:

  • cd cli && go test ./..., go test -race ./cmd, go vet ./....
  • golangci-lint run --new-from-rev=origin/main ./...: 0 issues.
  • scripts/check-cli-style.sh and scripts/check-cli-compat.sh: OK.
  • The backend suite, which cli/** triggers (Build & Test): this PR touches nothing under kates/. ./mvnw test on main's kates/ tree ran 1,254 tests with 0 failures and 0 errors, once for all of Wave 1.

Skipped locally: govulncheck, as go.mod is unchanged.

CI only: ./mvnw verify with the *IT tests, the Kind and Docker jobs, CodeQL and Trivy.

To refresh the API server's schema cache after installing CRDs, deploy
deleted ~/.kube/cache/discovery and ~/.cache/helm. The second is no discovery
cache: on Linux it is Helm's repository cache. The kyverno/kyverno upgrade
that wires Kyverno into Prometheus later in the same deploy runs with no repo
add before it, so it could fail with "no cached repo found", and every deploy
emptied the user's own `helm search repo`. macOS keeps Helm's cache in
~/Library/Caches/helm, which is why it went unnoticed there.

Deploy now deletes only ~/.kube/cache/discovery, and a comment says why
~/.cache/helm stays.
@bmscomp
bmscomp merged commit 32a0027 into main Oct 18, 2026
55 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant