Skip to content

fix(kpr): supervise the svc_vips reconciler, and give it the configured endpoint - #57

Merged
lllamnyp merged 1 commit into
mainfrom
fix/kpr-reconciler-restart
Oct 8, 2026
Merged

lllamnyp merged 1 commit into
mainfrom
fix/kpr-reconciler-restart

Conversation

@lllamnyp

@lllamnyp lllamnyp commented Oct 8, 2026

Copy link
Copy Markdown
Owner

Reported from the integration stand (addendum item 2e). A stand was parked and woken by the TTL automation; every cozyplane-kpr pod came up, attached its socket-LB programs, and ~30 s later logged

svc_vips reconciler exited err="get own node node0: Get \"https://10.96.0.1:443/api/v1/nodes/node0\": dial tcp 10.96.0.1:443: i/o timeout"

then stayed Running and Ready for 25 hours with nothing reconciling. No Service change reached the datapath in that window — the root ingress Service's node-owned externalIPs were refused on every node, including the two with a Ready ingress pod, and pods created after the wake were never added as backends. rollout restart fixed it instantly.

Two defects, one symptom.

It dialed a VIP it is itself responsible for. 10.96.0.1 is kubernetes.default's ClusterIP, which with kube-proxy gone kpr programs. The reconciler called rest.InClusterConfig() unconditionally, so during boot it dialed the one address it had not yet served. chart/cozyplane-kpr already has apiServerURL for this and values-talos.yaml already points it at KubePrism — but that value reached only Cilium's hive, via --k8s-api-server-urls. cozyplane's own net-0 reconciler never read the flag. It does now, parsed as Cilium parses it (a bare host:port means https), keeping the in-cluster CA and token.

The exit was terminal. go func() { if err := run(); err != nil { log } }() turns one transient error into a permanently dead worker with nothing to notice it: kpr has no readiness probe, the process stays up, and the pod goes on advertising health. It runs under runWithRestart now — capped exponential backoff, reset once a run has stayed up, stopping only on context cancellation. Re-running is the recovery path: the pin waits already retry in a loop and seed() is a full pass that sweeps leftovers, so every stage is idempotent.

Unit tests cover both halves: an exiting run is restarted (error and nil alike), a cancelled context neither starts a run nor spins, the backoff is capped, and the endpoint flag resolves the way the chart's values expect (including the bare-host:port and unset cases).

The addendum offered "restart with backoff inside the process, or fail the readiness probe and exit". In-process restart is the one implemented: recovery is faster, and the probe option would mean adding a probe endpoint and a chart stanza that do not exist today.

Detail and the lesson in docs/bringup-field-notes.md §13.

…ed endpoint

A woken stand ran 25 hours with every kpr pod Running and Ready and nothing
reconciling Services. Reported from the integration stand; two defects behind
one symptom.

The reconciler dialed the apiserver through rest.InClusterConfig(), i.e.
kubernetes.default's ClusterIP — a VIP that, with kube-proxy gone, kpr itself
programs. So during boot it was dialling the one address it is responsible for
serving, and timed out. chart/cozyplane-kpr already carries apiServerURL for
this, and values-talos.yaml already points it at KubePrism, but that value
reached only Cilium's hive through --k8s-api-server-urls; the net-0 reconciler
never read the flag. It does now, parsed as Cilium parses it (a bare host:port
means https), keeping the in-cluster CA and token.

And the exit was terminal. `go func() { if err := run(); err != nil { log } }()`
turns one transient error into a permanently dead worker, with nothing to notice
it: kpr has no readiness probe, the process stayed up, and the pod went on
advertising itself as healthy while the datapath kept whatever Service state it
held at the moment of the exit. It runs under runWithRestart now — capped
exponential backoff, reset once a run has stayed up, stopping only on context
cancellation. Re-running is the recovery: the pin waits already retry in a loop
and seed() is a full pass that sweeps leftovers, so every stage is idempotent.

Unit-tested both: that an exiting run is restarted (error and nil alike), that a
cancelled context neither starts nor spins, that the backoff is capped, and that
the endpoint flag resolves the way the chart's values expect.

Refs: docs/bringup-field-notes.md §13

Assisted-by: LLM
Signed-off-by: Timofei Larkin <[email protected]>
@lllamnyp
lllamnyp merged commit 9a3fce9 into main Oct 8, 2026
4 checks passed
lllamnyp added a commit to cozystack/cozystack that referenced this pull request Oct 16, 2026
Re-vendor from upstream main: kpr's svc_vips reconciler is supervised
and dials the configured apiserver endpoint rather than dying silently
with the default one (lllamnyp/cozyplane#57), and the agent re-creates
the FabricIP claim of a pod that already holds the address instead of
wedging it (lllamnyp/cozyplane#58). Both are binary fixes, so both
image pins move; the charts themselves are unchanged.

Assisted-by: LLM
Signed-off-by: Timofei Larkin <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant