The control plane uses whichever mirror answers

mirror.peers names the mirrors kept in step with mirror.api. The
mirror's management calls go to the first that can be reached, and
each mirror is asked every fifteen seconds whether it answers: a shard
is sent its model's and adapters' address on one that does while the
mirror the catalog names is down.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Ilker ManapandClaude Opus 5.5 committed 2026-10-29 13:43:27 +01:00
1 parent 5bc71b3d0a
commit 8a76a53afb
11 files changed
+276 -21

No files matched your search

+13 -2
View File
@@ -567,10 +567,21 @@ func newServerCmd() *cobra.Command {
// rather than turning into a broken admin page hours later when
// somebody finally opens it.
if cfg.Mirror.API != "" {
mc, err := mirror.NewClient(cfg.Mirror.API, cfg.Mirror.TLS, cfg.Mirror.Timeout)
mirrors := append([]string{cfg.Mirror.API}, cfg.Mirror.Peers...)
mc, err := mirror.NewFailoverClient(mirrors, cfg.Mirror.TLS, cfg.Mirror.Timeout)
if err != nil {
return fmt.Errorf("the model mirror: %w", err)
}
// Mirrors kept in step: a node is given a model's file on one
// that answers while the one the catalog names is down.
if len(cfg.Mirror.Peers) > 0 {
src, err := mirror.NewSources(mirrors, cfg.Mirror.TLS, log)
if err != nil {
return fmt.Errorf("the model mirrors: %w", err)
}
go src.Run(ctx)
agentsvc.SetSourceRewrite(src.Rewrite)
}
rt.SetMirror(mc)
if fwPub != nil {
fwPub.setMirror(mc)
@@ -578,7 +589,7 @@ func newServerCmd() *cobra.Command {
// Adapters trained on the nodes are kept there too; sending one
// takes longer than the mirror's usual answers.
if adminAPI != nil {
if up, err := mirror.NewClient(cfg.Mirror.API, cfg.Mirror.TLS, 10*time.Minute); err == nil {
if up, err := mirror.NewFailoverClient(mirrors, cfg.Mirror.TLS, 10*time.Minute); err == nil {
adminAPI.SetTrainMirror(up)
}
}