fix(operator): detect vMCP volume drift - #6299
Conversation
Hash the complete generated volume and volume-mount state so changes to referenced Secrets, ConfigMaps, and CA bundles roll the Deployment. Signed-off-by: King Star <mcxin.y@gmail.com>
|
@jstar0 I think you'll have to rebase and resolve some conflicts |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #6299 +/- ##
==========================================
- Coverage 78.08% 78.02% -0.06%
==========================================
Files 767 767
Lines 74269 74307 +38
==========================================
- Hits 57992 57980 -12
- Misses 16272 16322 +50
Partials 5 5 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
…drift # Conflicts: # cmd/thv-operator/controllers/virtualmcpserver_controller.go # cmd/thv-operator/controllers/virtualmcpserver_deployment.go
Signed-off-by: King Star <mcxin.y@gmail.com>
|
Refreshed the branch with current Verification on the merged head: |
ChrisJBurns
left a comment
There was a problem hiding this comment.
Multi-Agent Consensus Review
Agents consulted: Kubernetes reconciliation, Go/code quality, test/intent, Codex cross-review
Consensus Summary
| # | Finding | Consensus | Severity | Action |
|---|---|---|---|---|
| 1 | Add CA-bundle drift and hash-contract regressions | 10/10 | MEDIUM | Fix |
| 2 | Isolate the legacy missing-annotation transition | 8/10 | LOW | Fix |
| 3 | Make the volume hash a required input | 9/10 | LOW | Fix |
Overall
This PR fixes false-negative vMCP volume drift by centralizing generated volume construction and storing a deterministic fingerprint on the Deployment. The approach is sound: the PodSpec and annotation use the same desired snapshot, ordering-only changes are normalized, and operator-owned annotation cleanup preserves unrelated metadata.
The findings are about making the regression guarantees load-bearing across the CA-bundle and upgrade paths, and expressing the hash invariant at compile time. None identifies a current runtime correctness defect, but addressing them would reduce the chance of this drift class returning.
Generated with Codex using the dev:pr-review workflow
Make the volume hash a required deployment metadata input and pin its ordering and full-field contract. Exercise ConfigMap-backed CA drift and the legacy missing-annotation transition through fake clients. Signed-off-by: King Star <mcxin.y@gmail.com>
|
/retest |
Summary
Changes to Secrets, ConfigMaps, and CA bundles referenced by a vMCP deployment can change the generated pod volumes without changing the existing pod-template hash. The operator therefore leaves a stale deployment running.
This change hashes the complete generated volume and volume-mount state used by the pod template and compares that hash during reconciliation. It also removes the annotation when the desired state no longer contains a volume hash.
Fixes #5619
Type of change
Test plan
go test ./cmd/thv-operator/controllers -count=1)task test-e2e)task lint-fix)API Compatibility
v1beta1API.Changes
virtualmcpserver_controller.govirtualmcpserver_deployment.goDoes this introduce a user-facing change?
No. The operator now rolls deployments when referenced volume inputs change.
Special notes for reviewers
The focused controller package tests pass on the rebased branch.