agentmesh-node run fails on restart when --bootstrap-token-path is still set

Aperta
#956 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
56/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
go

Direzione di ricerca

Start with cmd/agentmesh-node/main.go at the token resolution around line 320 and the stored identity branch around line 474. Trace how the control plane URL and stored identity are checked, then run the node enrollment tests. Done means a node can restart with the spent token, stay healthy, and retain the same PeerID; explicit reset and mesh switching should still re-enroll.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

A node enrolled with a single-use token can't restart with the same command line:

agentmesh-node run --control-plane http://127.0.0.1:8090 --bootstrap-token-path tok --data-dir ./n1   # first run: OK
# stop it, then run the identical command again:
agentmesh-node run --control-plane http://127.0.0.1:8090 --bootstrap-token-path tok --data-dir ./n1
# FATAL ... Bootstrap token max usages exceeded

Dropping --bootstrap-token-path brings the same peer back healthy with its stored identity.

Cause: cmd/agentmesh-node/main.go:320 resolves the token file into bootstrapTokenFlag. The stored-identity branch at :474 only runs when jwtStr == "" && bootstrapTokenFlag == "". A token on the command line therefore always forces re-enrollment, even when a valid identity for the same control plane is already stored.

This bites anything that starts nodes from a fixed command line or unit file: systemd, scheduled tasks, Kubernetes args. The token is spent after the first boot, and every restart after that fails.

Proposal:

  • If a stored identity exists for the same control plane URL, use it, and log that the supplied bootstrap token was not used.
  • Keep explicit re-enrollment unchanged: agentmesh-node reset, or --join when switching meshes.
  • Add a regression test: enroll, restart with the spent token, and expect a healthy node with the same PeerID.

Happy to send the PR if this direction works for you.

Lingua principale
Go
Stelle
1.2k
Fork
207
Merge medio
1g 10h
PR unite (30g)
85

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di google/agentmesh

Tutte le issue di google/agentmesh

Issue simili

Altre issue su Go

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.