Skip to content

feat(helm): add hash cache persistence support#67

Open
amascia-gg wants to merge 5 commits intomainfrom
feature/NHI-1429-hash-cache-persistence
Open

feat(helm): add hash cache persistence support#67
amascia-gg wants to merge 5 commits intomainfrom
feature/NHI-1429-hash-cache-persistence

Conversation

@amascia-gg
Copy link
Contributor

@amascia-gg amascia-gg commented Mar 6, 2026

Summary

  • Adds PVC-based persistence for the scrypt hash cache so it survives across CronJob runs
  • Only the inventory CronJob gets the cache mount (ping/sync don't hash)
  • Adds persistence section to values.yaml, values.schema.json, and templates
  • Includes 11 helm-unittest test cases covering PVC creation, env var injection, volumeMount, existingClaim, and disabled state

Changes

File What
values.yaml New persistence block: enabled, storageClassName, size, existingClaim
values.schema.json Schema definition for IDE completion + validation
templates/persistentvolumeclaim.yaml Creates PVC when persistence.enabled && !existingClaim
templates/_cronjob.tpl Conditionally injects HASH_CACHE_PATH env, volumeMount, and PVC volume
templates/cronjob_inventory.yaml Passes use_cache_pvc: true to shared template
tests/persistence_test.yaml 11 test cases across 2 suites
Chart.yaml Version bump 0.5.14 → 0.5.15

Usage

persistence:
  enabled: true          # creates PVC, mounts it, sets HASH_CACHE_PATH
  # storageClassName: "" # optional, defaults to cluster default
  # size: 100Mi          # optional, 64 bytes/entry → 100Mi handles ~1.6M secrets
  # existingClaim: ""    # optional, use pre-existing PVC instead of creating one

Without persistence.enabled, behavior is unchanged — secrets are hashed from scratch every run.

Test plan

  • helm unittest charts/ggscout — all 40 tests pass (11 new persistence tests)
  • helm template renders correctly with and without persistence
  • Deployed to eks-sandbox-01 with persistence.enabled: true — cold run: 0 hits/40 misses, warm run: 40 hits/0 misses

In eks-sandbox-01:

Screenshot 2026-03-06 at 15 22 47 Screenshot 2026-03-06 at 15 23 17

@linear
Copy link

linear bot commented Mar 6, 2026

@amascia-gg amascia-gg force-pushed the feature/NHI-1429-hash-cache-persistence branch from 7db8017 to a72d9ea Compare March 10, 2026 14:18
amascia-gg and others added 5 commits March 11, 2026 11:30
Add PVC-based persistence for the scrypt hash cache so it survives
across CronJob runs. Only the inventory CronJob gets the cache mount.

Includes PVC template, schema validation, values defaults, and
11 helm-unittest test cases.

Issue: NHI-1429

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Issue: NHI-1429

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The persistence property was only in the generated values.schema.json
but not in values-base-schema.schema.json, causing the schema-bundle
pre-commit hook to strip it during regeneration.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Adds a pre-flight curl check against /nhi/ping to surface the actual
error when auth fails. Removes delinea from validation groups as its
OAuth credentials have been expired for 10 months.

Issue: NHI-1429

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
InitContainer checks the cache file mtime before each inventory run
and flushes it if stale (default 24h), preventing sensitive hash data
from lingering when the job stops. PVC is no longer rendered when
the inventory fetch job is disabled.

Issue: NHI-1429

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Made-with: Cursor
@amascia-gg amascia-gg force-pushed the feature/NHI-1429-hash-cache-persistence branch from a72d9ea to 370898f Compare March 11, 2026 10:30
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