Harmonize SeiNode peer discovery between controller and sidecar
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 35/100
- Issue type
- Refactor
- Clarity
- Needs clarification
- Activity status
- Quiet
- Tech stack
- go, kubernetes
- Domain
- backend, infrastructure
Research direction
Start with internal/controller/node/peers.go and internal/planner/group.go:59, then compare runtimes/sidecar/tasks/collect_set_peers.go with the three proposed ownership models. Use related issue #360 for context; the issue does not name tests or settle a target, so done requires choosing and implementing one model while preserving Spec.Peers, genesis logic, and cross-cluster transport.
Written by the indexing model from the issue text.
Description
Problem
Peer discovery + config writing for SeiNodes is split across two controllers today, and the split is not principled:
internal/controller/node/peers.go(controller-side) —reconcilePeersresolvesSpec.Peers(EC2 tags, K8s labels, static) into a list ofhost:portentries written toStatus.ResolvedPeers. Runs every reconcile.CollectAndSetPeers(sidecar-side) — runs as a planned task. ReadsStatus.ResolvedPeersfrom its own SeiNode, queries each peer's:26657/statusto discover the peer'snode_id, then writes the full<nodeID>@<host>:<port>list intopersistent_peersinconfig.tomland reloads seid.
The split is "controller discovers K8s/AWS membership; sidecar enriches with on-chain identity." That's a defensible separation in isolation, but in practice it means:
- Two reconcile cadences for one logical concern — controller-side runs every reconcile (~30s steady-state); sidecar-side runs only when the planner schedules
CollectAndSetPeers. - Two error surfaces — controller errors land on SND/SeiNode status; sidecar errors land on task status. An operator chasing "why isn't this node peering?" has to check both.
- Membership drift between the two —
Status.ResolvedPeerscan be stale relative to what the sidecar actually wrote intopersistent_peers. - The
seinodeDeploymentPeerSource extension we landed in PR-1 (#361, then dropped during PR-3 cuts in favor of using the existingLabelPeerSourcewith thesei.io/nodedeploymentlabel) is a hint that the controller-side resolver is already doing more than just "K8s membership" — it's resolving cross-SND peer relationships that fold into the same path.
Impact
This shows up immediately when we go to roll out publishable P2P (#360) and start exercising the cross-cluster peer-discovery story. Validators-peering-validators across a deterministic set means the controller's resolver becomes the load-bearing membership service, and the split-with-sidecar-enrichment adds enough latency + opacity that it becomes a debugging hot spot during P2P bring-up.
Proposed approach (to refine)
Three shapes worth considering:
- Controller owns everything — controller resolves peers AND queries
node_id(proxy through sidecar HTTP if needed), writes the finalpersistent_peersdirectly. Sidecar'sCollectAndSetPeersbecomes config-apply only. - Sidecar owns everything — controller's
reconcilePeersis deleted; sidecar handles selector→host+nodeID→config end-to-end. Requires the sidecar to read K8s resources (or have the controller push the selector spec via a different surface). - Cleaner split, same boundaries — keep the controller-resolves / sidecar-enriches split but unify the data surface (one canonical place to read "what peers does this node currently have?") and the error surface (one condition that aggregates both halves).
(1) is probably the cleanest if we can do it without making the controller depend on seid availability for membership — but that's a structural question worth weighing.
Out of scope
- Anything that changes the
Spec.Peersuser surface. The PeerSource union (ec2Tags,static,label) stays. - Genesis ceremony peer logic (controller-side genesis assembly is a different code path).
- Cross-cluster discovery transport (we currently rely on the EC2 tag resolver for sei-infra-managed peers; this stays).
Relevant experts
- kubernetes-specialist — controller-runtime patterns, the existing
reconcilePeersshape, how a controller-owned resolver would handle the sidecar boundary. - platform-engineer — sidecar HTTP plumbing, the
CollectAndSetPeerstask lifecycle, sei-infra peer membership. - sei-network-specialist — CometBFT peer discovery semantics,
node_idresolution timing,:26657/statusreliability vs. on-chain alternatives.
References
internal/controller/node/peers.go—reconcilePeers,LabelPeerSourceresolverinternal/planner/group.go:59—CollectAndSetPeerstask buildingruntimes/sidecar/tasks/collect_set_peers.go(or wherever seictl handles it) — the actual:26657/statusquery + config write- Related: #360 (publishable P2P) — the use case that surfaces this as load-bearing.
- Dominant language
- Go
- Stars
- 1
- Forks
- 2
- Avg merge
- 2h 29m
- Merged PRs (30d)
- 56
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from sei-protocol/sei-k8s-controller
-
Difficulty 5/5 Over a week Newbie friendliness 32/100
-
Difficulty 5/5 Over a week Newbie friendliness 32/100
sei-protocol/sei-k8s-controller#457 · 2 comments ·
-
Difficulty 3/5 1-2 days Newbie friendliness 68/100
-
Difficulty 4/5 3-5 days Newbie friendliness 45/100
-
Difficulty 3/5 1-2 days Newbie friendliness 65/100
All issues in sei-protocol/sei-k8s-controller
Similar issues
-
optimization optimization:agents-md-curator
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
githubnext/gh-aw-cao#13143 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
blinklabs-io/bursa#904 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
yanet-platform/ipfw-go#129 ·
-
bug confmap/provider/googlesecretmanagerprovider needs triage
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
open-telemetry/opentelemetry-collector-contrib#51273 · 2 comments ·
-
bug: AI Gateway client filter lists "Unknown" twice when NULL and literal Unknown clients coexist Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 90/100