• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

stacklok / toolhive / 25101888720

29 Apr 2026 09:44AM UTC coverage: 64.037% (+0.01%) from 64.027%
25101888720

push

github

web-flow
Preserve user fields in EmbeddingServer podTemplateSpec merge (#5104)

* Preserve user fields in EmbeddingServer podTemplateSpec merge

The previous merge function copied only NodeSelector, Affinity,
Tolerations, SecurityContext, ServiceAccountName, and the embedding
container's SecurityContext. Anything else the user put on
spec.podTemplateSpec.spec -- imagePullSecrets, additional volumes,
priorityClassName, topologySpreadConstraints, runtimeClassName, init
containers, sidecars -- was silently dropped.

Replace the enumerated copy with a strategic merge patch on the raw
user JSON (mirroring VirtualMCPServer's approach). The patch preserves
every user-provided PodSpec field while controller defaults remain
where the user did not set a value. Using the raw JSON avoids the
nil-slice-becomes-empty-array problem that re-marshaling would hit.

Add a regression test covering imagePullSecrets, priorityClassName,
volumes, runtimeClassName, topologySpreadConstraints, and sidecar
containers, asserting they all reach the resulting StatefulSet pod
template.

Fixes #5100

* Skip PodTemplateSpec merge on invalid user input

Refusing to build the StatefulSet when the user-provided
PodTemplateSpec is malformed left the EmbeddingServer stuck with no
pod and broke the existing integration test that asserts a StatefulSet
is still created in this case. The validation status condition
(Phase=Failed, ConditionPodTemplateValid=False) is the user-facing
signal for invalid input; the controller now treats merge failures as
soft skips so the resource still produces an observable StatefulSet
built from controller defaults.

Restores the pre-existing tolerant behavior that the previous
field-by-field merge had implicitly via NewPodTemplateSpecBuilder's
silent error path.

* Extract PodTemplateSpec strategic merge patch to controllerutil

The marshal-then-StrategicMergePatch-then-unmarshal sequence was
copy-pasted across the EmbeddingServer and VirtualMCPServer
controllers. Pull ... (continued)

44 of 51 new or added lines in 3 files covered. (86.27%)

34 existing lines in 4 files now uncovered.

60478 of 94442 relevant lines covered (64.04%)

58.49 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

58.0
/cmd/thv-operator/controllers/embeddingserver_controller.go


Source Not Available

STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc