fix(operator): skip no-op VirtualMCPServer Deployment updates - #6377
fix(operator): skip no-op VirtualMCPServer Deployment updates#6377RaviTharuma wants to merge 1 commit into
Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6377 +/- ##
=======================================
Coverage 78.02% 78.03%
=======================================
Files 767 767
Lines 74273 74273
=======================================
+ Hits 57955 57959 +4
+ Misses 16313 16309 -4
Partials 5 5 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Nice fix for the root cause — the subset check + semantic env comparison directly address the drift false-positive from #6340, and the regression test follows the reconcile-twice/assert- One question on the "second line of defense" skip-write gate added in if equality.Semantic.DeepEqual(deployment.Spec.Template, newDeployment.Spec.Template) &&
maps.Equal(deployment.Labels, newDeployment.Labels) &&
maps.Equal(deployment.Annotations, mergedAnnotations) &&
replicasUnchanged {
return ctrl.Result{}, nil
}
Since the actual fix already lives in |
|
Hi @RaviTharuma , can you please solve the conflicts? |
will do it, this weekend 👍 |
statusReportingInterval requeues were treated as drift when a user PodTemplateSpec left extra labels on the live template. Compare pod-template metadata as a subset and use semantic env equality so generation stops bumping every interval. The extra full-template DeepEqual skip-write gate is omitted: API-server defaulting makes it unreachable, and the subset plus semantic-env checks already prevent the write. Fixes stacklok#6340 Co-authored-by: Ravi Tharuma <RaviTharuma@users.noreply.github.com>
9380995 to
fb3753a
Compare
|
@reyortiz3 Conflicts are resolved — the branch is MERGEABLE and CI is green. On the extra skip-write gate: dropped it, as you suggested. The production path is |
Cross-links
Summary
VirtualMCPServer
statusReportingIntervalrequeues (including the CRD 30sdefault) called
Updateon the Deployment even when the pod template wasunchanged. That bumped
metadata.generationand emittedDeploymentUpdatedwith no new ReplicaSet — and only for vMCPs that had a unique
podTemplateSpec.Root cause:
podTemplateMetadataNeedsUpdateusedmaps.Equalon the fulllabel/annotation maps. User
PodTemplateSpecmerge leaves extra keys on thelive template, so every status tick looked like drift.
MapIsSubset(expected ⊆ live)equality.Semantic.DeepEqual(K8s defaulting)annotations, and replicas are unchanged
Fixes #6340
Type of change
Test plan
go test -ldflags=-extldflags=-Wl,-w ./cmd/thv-operator/controllers/ -run 'TestVirtualMCPServerEnsureDeployment_PodTemplateSpecSteadyState|TestVirtualMCPServerPodTemplateSpec'podTemplateSpecshouldnot emit
DeploymentUpdatedon everystatusReportingIntervaltickAPI Compatibility
v1beta1API, OR theapi-break-allowedlabel is applied and the migration guidance is described above.No CRD schema change.
Does this introduce a user-facing change?
Yes. VirtualMCPServer Deployments no longer get a no-op Update (and a
generation bump) on every status-interval reconcile.
Special notes for reviewers
Matches the suggested fix on #6340: do not treat the status requeue itself as
drift. The subset check is what stops
podTemplateSpecextras from lookinglike a spec change; the skip-write is a second line of defense if
deploymentNeedsUpdateis still true for a non-template reason.