Skip to content

fix(kubescape): mount scanner config.json dir so posture scans persist#2444

Closed
devantler wants to merge 1 commit into
mainfrom
claude/kubescape-configjson-mount
Closed

fix(kubescape): mount scanner config.json dir so posture scans persist#2444
devantler wants to merge 1 commit into
mainfrom
claude/kubescape-configjson-mount

Conversation

@devantler

Copy link
Copy Markdown
Contributor

🤖 Generated by the Daily AI Assistant

Why

The cluster's security scanner (Kubescape) has silently stopped producing fresh results — posture/compliance data has been frozen since 27 Jun. Every scan now fails on a broken config-file mount, so the dashboard shows stale findings and the platform's security exceptions never take effect. This surfaced while fixing a real credential finding (dex) — the dashboard couldn't reflect the fix because scanning itself was dead.

What

A small mount correction lets the scanner write its config file again, so daily posture scans persist and exceptions apply. No behaviour or resource change — it only unblocks scanning. Once this deploys and re-scans, the compliance dashboard reflects reality again.

Pairs with (doesn't depend on) the scanner v4.0.9 bump that exposed this, already merged in #2316.

In offline mode the chart mounts the writable `kubescape-volume` emptyDir at
the FILE path /home/nonroot/.kubescape/config.json with `subPath: config.json`.
emptyDir + subPath makes Kubernetes create the subPath as a DIRECTORY, so
config.json is a directory, not a file. The v4.0.8 scanner never wrote it;
v4.0.9 (pinned for the CRD-exceptions getter) writes a generated account ID
there and now aborts every scan with `open .../config.json: is a directory`
before any WorkloadConfigurationScan result is persisted — so posture data
froze on 2026-06-27 and ClusterSecurityException posture exceptions are never
evaluated (dashboard shows stale findings, exceptions read "0 excluded").

Add a Flux postRenderer that mounts the emptyDir at the .kubescape directory
(no subPath) — the same writable layout the chart's online branch uses — so the
scanner can create config.json as a file; host-scanner.yaml stays a nested
mount. Verified by rendering the chart and applying the patch: the file-path
mount is gone. Drop once fixed upstream in kubescape/helm-charts.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 4, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@devantler, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 31 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 29bc8da6-8062-473c-b6cc-76359e868faf

📥 Commits

Reviewing files that changed from the base of the PR and between 32ce888 and 8c45cde.

📒 Files selected for processing (1)
  • k8s/bases/infrastructure/controllers/kubescape/helm-release.yaml
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/kubescape-configjson-mount

Comment @coderabbitai help to get the list of available commands.

@devantler

Copy link
Copy Markdown
Contributor Author

🤖 Generated by the Daily AI Assistant

Closing as a duplicate of #2443, which fixes the same frozen-posture-scan regression more completely.

This PR only corrects the config.json emptyDir+subPath mount (directory → writable file). But #2443's investigation shows that alone is insufficient: even with the mount fixed (equivalently, kubescapeOffline: disable), the scheduler still posts Submit=true, so the v4.0.9 scanner tries to submit to ARMO cloud and aborts with a 402 before persisting any WorkloadConfigurationScan — the failure just moves from "config.json is a directory" to a cloud-submit error. #2443 forces scanV1.keepLocal: true in the scheduler request body (Submit=false → the scanner never touches cloud or config.json), which mirrors upstream kubescape/helm-charts#862 and is the load-bearing fix.

Superseded by #2443.

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

Labels

None yet

Projects

Status: ✅ Done

Development

Successfully merging this pull request may close these issues.

1 participant