Add optional cache for provisioner Secret reads #1611
All Vouch review confidence checks passed
Residual risk 0.33 = Change Risk (0.63) × (1 − Review Confidence (0.47)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.63 · 280 lines diff across 3 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Shallow Review Depth
shallow_review_depth
0.344
Diff Size
diff_size
0.337
Sensitive Paths
sensitive_paths
0.063
Real PR Conversation Timeline
1 comments
"Review active on #1611"
general
weight: 0.35
jsafrane
What type of PR is this?
/kind feature
What this PR does / why we need it:
Adds
--secret-cache-ttl(default0, disabled) and--secret-cache-max-entries(default128).With many PVCs sharing one StorageClass, every CreateVolume and DeleteVolume
reads the same provisioner Secret with a separate GET, and these reads are
throttled by
--kube-api-qps. When enabled, the Secret data is cached for afixed time after it was read.
used instead of an error
still continues without credentials when the Secret cannot be read
Measured against a local test server with the default client limits (5 QPS,
burst 10), 100 workers and 1500 reads of one Secret:
| | API calls | total | median latency |
|------------|-----------|--------|----------------|
| before | 1500 | ~5 min | 20s |
| after, 10s | 1 | 4 ms | 0 |
Which issue(s) this PR fixes:
Fixes #1610
Special notes for your reviewer:
NewCSIProvisionergets two new arguments, sothe existing test calls pass
0, 0.golang.org/x/syncmoves from an indirect to a direct dependency; it wasalready vendored.
credentials stay in memory for up to the TTL. A failed CSI call does not clear
the entry, so recovery after a rotation waits for the TTL (the provisioner
retries with backoff). Not caching new Secrets when the cache is full is
intentional; an LRU is possible if you prefer it.
Does this PR introduce a user-facing change?:
``
release-note--secret-cache-ttlAdd the
and--secret-cache-max-entriesflags to cache the Secrets used as provisioner credentials. The cache is disabled by default.
``