operator(P3): headless coverage Service + status.coverageEndpoint - #15
Conversation
When spec.coverageService is on (and coverage enabled), the operator now creates a headless Service (clusterIP: None) selecting the target's pods on the coverage port, so its cluster DNS resolves to every pod IP — which is exactly what the DD-023 driver flag + InetAddress.getAllByName consume to union-merge coverage across replicas. status.coverageEndpoint publishes <svc>.<ns>.svc.cluster.local:<port> to point the flag at. - coverage_service.go: desiredCoverageService (headless, selector from the Deployment, coverage port) + name/endpoint helpers. - reconcileCoverageService: create/update when wanted, delete when toggled off (or coverage disabled), owner-referenced to the target so it's GC'd on delete. core/services RBAC added. - envtest: create+publish-endpoint, and toggle-off deletes + clears. - e2e.sh: coverageService:true + asserts the Service is headless, backs the pod (has an endpoint), and status.coverageEndpoint is published. 9/9 green in-cluster; envtest 13/13. Design doc §8 P3 + status, TODO updated. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JuGqspSB9zpA5AyvHJBiDK
|
@claude please review — operator P3 (headless coverage Service + status.coverageEndpoint). Worth checking:
Verified: envtest 13/13 (create/publish + toggle-off/delete), e2e 9/9 in-cluster (headless, has-endpoint, endpoint-published). |
|
Claude finished @ianp94's task in 2m 38s —— View job Review — operator P3 (headless coverage Service +
|
… watch (review) PR #15 review found a real gap: if the referenced Deployment disappears AFTER the coverage Service was created, Reconcile early-returns on the DeploymentNotFound branch before the coverage logic runs, leaving an orphaned Service and a STALE published status.coverageEndpoint (worse than none). - Extract removeCoverageService (delete Service + clear endpoint) and call it in the DeploymentNotFound branch, so a dead endpoint is never left published. New envtest covers it. - Add Owns(&corev1.Service{}) to SetupWithManager so an out-of-band edit/delete of the coverage Service self-heals (also makes the list/watch services RBAC load-bearing). - Log when the derived Service selector is empty (Deployment uses matchExpressions-only), which would silently break DD-023. envtest 14/14; e2e 9/9 in-cluster. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JuGqspSB9zpA5AyvHJBiDK
|
Fixed the real gap in
Left |
Operator P3 — headless coverage Service +
status.coverageEndpointThe operator now closes the loop with DD-023 (multi-pod union coverage): when
spec.coverageServiceis on, it creates a headless Service (clusterIP: None) selecting the target's pods on the coverage port. The Service's cluster DNS resolves to every pod IP, which is exactly what the DD-023 driver flag (-Dclosurejvm.coverage.jacoco=<host>:<port>) +InetAddress.getAllByNameconsume to union-merge coverage across replicas.status.coverageEndpointpublishes<svc>.<ns>.svc.cluster.local:<port>so the flag is copy-pasteable.Behavior
coverageService && coverage.enabled; delete it and clear the endpoint when toggled off or coverage disabled.core/servicesRBAC added (get;list;watch;create;update;patch;delete).Verification
status.coverageEndpoint; togglingcoverageService: falsedeletes the Service and clears the endpoint.deploy/e2e/e2e.shnow also asserts the coverage Service is headless, has the app pod as an endpoint, andstatus.coverageEndpointis published — end to end against a raw JPetStore.Notes
.svc.cluster.localFQDN (assumes the default cluster domain).ClosureJVMCampaign); P3 stops at exposing it.envtest 13/13; e2e 9/9. Design doc §8 P3 + status header and TODO updated.
🤖 Generated with Claude Code
https://claude.ai/code/session_01JuGqspSB9zpA5AyvHJBiDK