carlos / platform Public

steering: exclude pool-only boxes and isolate invalid DNS changes

Named-pool-only group members shared adi's AWS region and caused Route 53
to reject the first steering batch on every pass.

Exclude explicit non-shared edges, preserve one eligible incumbent per
region, and bisect invalid batches so other records can converge. Read
surviving records before collecting owned health checks after partial
failures. Exercise the housekeeper pass through the real constructors
against a local Route 53 endpoint that refuses non-local requests.
Co-Authored-By: GPT-6 Astra <noreply@openai.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev c1aed6d9b12113ecb57313fe6b92c33a3aee1bdf parent eb3b88a
6 files changed, +664 −77
  • internal/host/steering_g3_test.go +295 −0
  • internal/host/steering_loop.go +20 −5
  • internal/steering/g3_test.go +221 −0
  • internal/steering/route53.go +94 −57
  • internal/steering/route53_test.go +25 −11
  • internal/steering/steering.go +9 −4

Intent

Human

<task-notification> <task-id>bwwzjke31</task-id> <tool-use-id>toolu_01L7iqweJin9PaxXr9XnYYsP</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/f72ef775-81b3-4d2e-a18d-c8edb14aa192/tasks/bwwzjke31.output</output-file> <status>completed</status> <summary>Background command ".superpowers/sdd/2026-11-07-region-ha-g3-fixes/wait.sh t3" completed (exit code 0)</summary> </task-notification>

Human

<task-notification> <task-id>bhz2nkmc7</task-id> <tool-use-id>toolu_01313UD4CG3PfBWtPzx79SwR</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/f72ef775-81b3-4d2e-a18d-c8edb14aa192/tasks/bhz2nkmc7.output</output-file> <status>completed</status> <summary>Background command ".superpowers/sdd/2026-11-07-region-ha-g3-fixes/wait.sh t1" completed (exit code 0)</summary> </task-notification>

Human

<task-notification> <task-id>bd2mgpyrw</task-id> <tool-use-id>toolu_01GCALQUrtWCshFAxECDXeWT</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/f72ef775-81b3-4d2e-a18d-c8edb14aa192/tasks/bd2mgpyrw.output</output-file> <status>completed</status> <summary>Background command "until [ "$(date -u +%H%M)" -ge 1420 ]; do sleep 30; done; date -u +%T; aws --profile keymail s3api list-object-versions --bucket carlos-flagship-271376211898 --prefix control/edges/g-cfbd --output json | python3 -c ' import json,sys;d=json.load(sys.stdin) for k in ("Versions","DeleteMarkers"): for v in d.get(k) or []: if v["IsLatest"]: print(k,v["Key"],v["LastModified"])'" completed (exit code 0)</summary> </task-notification>

Human

<paseo-system version="1" kind="agent-message" source-agent-id="dd66f2a7-d7e4-49bd-8ef2-24f96784b7bd" message-id="7cf7b8b1-9c9c-4ae6-a240-15e7e5420816" source-agent-title="G3 EXECUTOR: carloku.com US goes HA"> G3 dd66f2a SCAN READ 1 (adi registry, read-only, 14:21:52Z), ha_departure_scans + ha_departures: {&quot;id&quot;: &quot;07599e17e66f&quot;, &quot;row_version&quot;: 41, &quot;Version&quot;: 41, &quot;Generation&quot;: &quot;cf0962815f217f280ca5024a8617d7237b664ba159bda0af18edf69b943a9e6e&quot;, &quot;InventoryGeneration&quot;: &quot;10/1794061090592793775&quot;, &quot;Cursor&quot;: 32, &quot;Rescan&quot;: false, &quot;Unresolved&quot;: 0, &quot;hosts&quot;: 1, &quot;EdgesETag&quot;: &quot;&quot;, &quot;other&quot;: {&quot;DeleteUncertain&quot;: false, &quot;PermissionAlerted&quot;: false}} {&quot;id&quot;: &quot;b462a713bd15&quot;, &quot;row_version&quot;: 12, &quot;Version&quot;: 12, &quot;Generation&quot;: &quot;96df58b800ab76a45aed7b00d6affda21cbe2d56728a7bf3582cff3a4050146d&quot;, &quot;InventoryGeneration&quot;: &quot;11/1794061201020745208&quot;, &quot;Cursor&quot;: 32, &quot;Rescan&quot;: false, &quot;Unresolved&quot;: 0, &quot;hosts&quot;: 0, &quot;EdgesETag&quot;: &quot;&quot;, &quot;other&quot;: {&quot;DeleteUncertain&quot;: false, &quot;PermissionAlerted&quot;: false}} {&quot;id&quot;: &quot;e139387cbbc7&quot;, &quot;row_version&quot;: 12, &quot;Version&quot;: 12, &quot;Generation&quot;: &quot;96df58b800ab76a45aed7b00d6affda21cbe2d56728a7bf3582cff3a4050146d&quot;, &quot;InventoryGeneration&quot;: &quot;11/1794061276884286816&quot;, &quot;Cursor&quot;: 32, &quot;Rescan&quot;: false, &quot;Unresolved&quot;: 0, &quot;hosts&quot;: 0, &quot;EdgesETag&quot;: &quot;&quot;, &quot;other&quot;: {&quot;DeleteUncertain&quot;: false, &quot;PermissionAlerted&quot;: false}} 07599e17e66f g-cfbd25eb45f1d796d877 scanning scan InvGen b462a713bd15 g-26c6d74550f302168da1 scanning scan InvGen e139387cbbc7 g-2ceae83c44d11ad6efd5 scanning scan InvGen InventoryGeneration&apos;s second field is a ns timestamp: 1794061090592793775 = 14:18:10Z; 1794061201 = 14:20:01Z; 1794061276 = 14:21:16Z. Read 2 in ~5 min. </paseo-system>

Attributed to this commit: 24.2 g CO₂e (2,811,615 tokens). This is an attribution, not a measurement — usage counted from this commit's own marker forward to the next one on region-ha-g3-fixes, never backward from it. A turn that produced more than one commit books all of its tokens to the last one, and a concurrent session on this branch can add to the same figure. Some of it was priced using the shared default rate, because no model-specific factor row exists yet for at least one model involved. The Carbon view has the repo total, which is never derived from this attribution.

diff --git a/internal/host/steering_g3_test.go b/internal/host/steering_g3_test.go
new file mode 100644
index 000000000..fd21becbd
--- /dev/null
+++ b/internal/host/steering_g3_test.go
@@ -0,0 +1,295 @@
+package host
+
+import (
+ "context"
+ "encoding/xml"
+ "errors"
+ "fmt"
+ "net/http"
+ "net/http/httptest"
+ "sort"
+ "strings"
+ "sync"
+ "testing"
+
+ "github.com/aws/aws-sdk-go-v2/aws"
+ "github.com/aws/aws-sdk-go-v2/service/route53"
+ "github.com/aws/aws-sdk-go-v2/service/route53/types"
+ "github.com/carlosframework/platform/internal/steering"
+)
+
+type g3DNSRecord struct {
+ Name string
+ Type string
+ SetIdentifier string
+ Region string
+ TTL int64
+ Values []string `xml:"ResourceRecords>ResourceRecord>Value"`
+ HealthCheckId string
+}
+
+type g3DNSChange struct {
+ Action string
+ Record g3DNSRecord `xml:"ResourceRecordSet"`
+}
+
+// g3Route53 serves the SDK's XML protocol on loopback. Tests use NewClient,
+// the DirStore constructor and the same pass factory as steeringLoop.
+type g3Route53 struct {
+ mu sync.Mutex
+ records map[string]g3DNSRecord
+ checks map[string]types.HealthCheck
+ tags map[string][]types.Tag
+ writes, created, applied int
+ batches []int
+}
+
+func (f *g3Route53) ServeHTTP(w http.ResponseWriter, r *http.Request) {
+ f.mu.Lock()
+ defer f.mu.Unlock()
+ w.Header().Set("Content-Type", "text/xml")
+ reply := func(name string, body any) {
+ enc := xml.NewEncoder(w)
+ if err := enc.EncodeElement(body, xml.StartElement{Name: xml.Name{Local: name}}); err != nil {
+ panic(err)
+ }
+ }
+ decode := func(body any) bool {
+ if err := xml.NewDecoder(r.Body).Decode(body); err != nil {
+ http.Error(w, err.Error(), 400)
+ return false
+ }
+ return true
+ }
+ path := strings.TrimPrefix(r.URL.Path, "/2013-04-01/")
+ switch {
+ case path == "hostedzone/ZG3TEST/rrset" && r.Method == "GET":
+ var records []g3DNSRecord
+ for _, rr := range f.records {
+ records = append(records, rr)
+ }
+ sort.Slice(records, func(i, j int) bool {
+ return records[i].Name+records[i].SetIdentifier < records[j].Name+records[j].SetIdentifier
+ })
+ reply("ListResourceRecordSetsResponse", struct {
+ Records []g3DNSRecord `xml:"ResourceRecordSets>ResourceRecordSet"`
+ IsTruncated bool
+ }{Records: records})
+ case path == "hostedzone/ZG3TEST/rrset" && r.Method == "POST":
+ var in struct {
+ Changes []g3DNSChange `xml:"ChangeBatch>Changes>Change"`
+ }
+ if !decode(&in) {
+ return
+ }
+ f.writes++
+ f.batches = append(f.batches, len(in.Changes))
+ if len(in.Changes) > 100 {
+ http.Error(w, "batch exceeds 100", 400)
+ return
+ }
+ projected := make(map[string]g3DNSRecord, len(f.records))
+ for key, rr := range f.records {
+ projected[key] = rr
+ }
+ for _, c := range in.Changes {
+ key := c.Record.Name + "|" + c.Record.Type + "|" + c.Record.SetIdentifier
+ switch c.Action {
+ case "UPSERT":
+ projected[key] = c.Record
+ case "DELETE":
+ delete(projected, key)
+ default:
+ http.Error(w, "unexpected action", 400)
+ return
+ }
+ }
+ regions := map[string]bool{}
+ for _, rr := range projected {
+ if rr.Region == "" {
+ continue
+ }
+ key := rr.Name + "|" + rr.Type + "|" + rr.Region
+ if regions[key] {
+ w.WriteHeader(400)
+ fmt.Fprint(w, `<ErrorResponse><Error><Code>InvalidChangeBatch</Code><Message>second latency RRSet in region</Message><Messages><Message>second latency RRSet in region</Message></Messages></Error></ErrorResponse>`)
+ return
+ }
+ regions[key] = true
+ }
+ f.records = projected
+ f.applied += len(in.Changes)
+ reply("ChangeResourceRecordSetsResponse", struct{}{})
+ case path == "healthcheck" && r.Method == "GET":
+ var checks []types.HealthCheck
+ for _, hc := range f.checks {
+ checks = append(checks, hc)
+ }
+ reply("ListHealthChecksResponse", struct {
+ Checks []types.HealthCheck `xml:"HealthChecks>HealthCheck"`
+ IsTruncated bool
+ }{Checks: checks})
+ case path == "healthcheck" && r.Method == "POST":
+ var in struct {
+ CallerReference string
+ HealthCheckConfig types.HealthCheckConfig
+ }
+ if !decode(&in) {
+ return
+ }
+ f.writes++
+ f.created++
+ id := fmt.Sprintf("hc-%d", f.created)
+ hc := types.HealthCheck{Id: &id, CallerReference: &in.CallerReference, HealthCheckConfig: &in.HealthCheckConfig}
+ f.checks[id] = hc
+ reply("CreateHealthCheckResponse", struct {
+ Check types.HealthCheck `xml:"HealthCheck"`
+ }{hc})
+ case strings.HasPrefix(path, "healthcheck/") && r.Method == "DELETE":
+ id := strings.TrimPrefix(path, "healthcheck/")
+ for _, rr := range f.records {
+ if rr.HealthCheckId == id {
+ http.Error(w, "HealthCheckInUse", 400)
+ return
+ }
+ }
+ f.writes++
+ delete(f.checks, id)
+ delete(f.tags, id)
+ reply("DeleteHealthCheckResponse", struct{}{})
+ case path == "tags/healthcheck" && r.Method == "POST":
+ var in struct {
+ IDs []string `xml:"ResourceIds>ResourceId"`
+ }
+ if !decode(&in) {
+ return
+ }
+ type tagSet struct {
+ ResourceId string
+ ResourceType string
+ Tags []types.Tag `xml:"Tags>Tag"`
+ }
+ var sets []tagSet
+ for _, id := range in.IDs {
+ sets = append(sets, tagSet{id, "healthcheck", f.tags[id]})
+ }
+ reply("ListTagsForResourcesResponse", struct {
+ Sets []tagSet `xml:"ResourceTagSets>ResourceTagSet"`
+ }{sets})
+ case strings.HasPrefix(path, "tags/healthcheck/") && r.Method == "POST":
+ var in struct {
+ Tags []types.Tag `xml:"AddTags>Tag"`
+ }
+ if !decode(&in) {
+ return
+ }
+ f.writes++
+ f.tags[strings.TrimPrefix(path, "tags/healthcheck/")] = in.Tags
+ reply("ChangeTagsForResourceResponse", struct{}{})
+ default:
+ http.Error(w, "unexpected local Route53 request: "+r.Method+" "+path, 400)
+ }
+}
+
+type g3LocalHTTPClient struct {
+ base string
+ client *http.Client
+}
+
+func (c g3LocalHTTPClient) Do(r *http.Request) (*http.Response, error) {
+ if !strings.HasPrefix(r.URL.String(), c.base+"/") {
+ return nil, fmt.Errorf("refusing non-local Route53 request to %s", r.URL.Host)
+ }
+ return c.client.Do(r)
+}
+
+func TestSteeringG3HousekeeperPass(t *testing.T) {
+ fake := &g3Route53{records: map[string]g3DNSRecord{}, checks: map[string]types.HealthCheck{}, tags: map[string][]types.Tag{}}
+ server := httptest.NewServer(fake)
+ t.Cleanup(server.Close)
+ for key, value := range map[string]string{
+ "AWS_ACCESS_KEY_ID": "g3-local-test", "AWS_SECRET_ACCESS_KEY": "g3-local-test", "AWS_SESSION_TOKEN": "",
+ "AWS_PROFILE": "", "AWS_DEFAULT_PROFILE": "", "AWS_CONFIG_FILE": "/dev/null", "AWS_SHARED_CREDENTIALS_FILE": "/dev/null",
+ "AWS_REGION": "us-east-1", "AWS_EC2_METADATA_DISABLED": "true",
+ } {
+ t.Setenv(key, value)
+ }
+ ctx := context.Background()
+ client, err := steering.NewClient(ctx, func(o *route53.Options) {
+ o.BaseEndpoint = &server.URL
+ o.HTTPClient = g3LocalHTTPClient{base: server.URL, client: server.Client()}
+ })
+ if err != nil {
+ t.Fatal(err)
+ }
+ // Prove the wire fake refuses the original same-region membership and
+ // leaves the whole batch unapplied before exercising the production pass.
+ var collision []types.Change
+ for _, box := range []string{"adi", "g-00000000000000000001"} {
+ collision = append(collision, types.Change{Action: types.ChangeActionUpsert, ResourceRecordSet: &types.ResourceRecordSet{
+ Name: aws.String("edge.example.com."), Type: types.RRTypeA, SetIdentifier: aws.String(box), Region: types.ResourceRecordSetRegionUsEast1, TTL: aws.Int64(60),
+ ResourceRecords: []types.ResourceRecord{{Value: aws.String("192.0.2.1")}},
+ }})
+ }
+ _, err = client.ChangeResourceRecordSets(ctx, &route53.ChangeResourceRecordSetsInput{HostedZoneId: aws.String("ZG3TEST"), ChangeBatch: &types.ChangeBatch{Changes: collision}})
+ var invalid *types.InvalidChangeBatch
+ fake.mu.Lock()
+ if !errors.As(err, &invalid) || len(fake.records) != 0 {
+ t.Fatalf("collision must fail atomically: err=%v records=%v", err, fake.records)
+ }
+ fake.writes = 0
+ fake.batches = nil
+ fake.mu.Unlock()
+
+ store := steeringTestStore(t, map[string][]byte{
+ "control/edges/adi.json": []byte(`{"v":1,"box":"adi","eip":"192.0.2.1","region":"us-east-1","serves_shared_pool":true,"served_pools":[""],"hosts":{}}`),
+ })
+ for i := 1; i <= 3; i++ {
+ ref := fmt.Sprintf("g-%020x", i)
+ stamp := "2026-11-07T12:00:00Z"
+ if i == 3 {
+ ref = "g-cfbd25eb45f1d796d877"
+ stamp = "2026-11-01T00:00:00Z"
+ }
+ body := []byte(fmt.Sprintf(`{"v":1,"box":%q,"eip":"192.0.2.%d","region":"us-east-1","serves_shared_pool":false,"named_pools":["ha"],"hosts":{},"generation":%q}`, ref, i+1, stamp))
+ if _, err := store.Put(ctx, "control/edges/"+ref+".json", body, ""); err != nil {
+ t.Fatal(err)
+ }
+ }
+ sqid := seedAccount(t, store, 731, "g3-steering")
+ // 134 instance records plus the synthetic edge record exercise two batches.
+ for i := 0; i < 134; i++ {
+ seedRecord(t, store, sqid, "app", fmt.Sprintf("h%03d.example.com", i), "latency", "")
+ }
+ pass := steeringPassFor(store, client, "ZG3TEST", "example.com", nil)
+ if err := pass(ctx); err != nil {
+ t.Fatal(err)
+ }
+ fake.mu.Lock()
+ if fake.applied != 135 || len(fake.batches) != 2 || fake.batches[0] != 100 || fake.batches[1] != 35 {
+ t.Fatalf("applied=%d batches=%v", fake.applied, fake.batches)
+ }
+ if len(fake.records) != 135 || len(fake.checks) != 1 {
+ t.Fatalf("records=%d checks=%d", len(fake.records), len(fake.checks))
+ }
+ for _, rr := range fake.records {
+ if rr.SetIdentifier != "adi" {
+ t.Fatalf("member received record: %+v", rr)
+ }
+ }
+ for _, hc := range fake.checks {
+ if *hc.HealthCheckConfig.IPAddress != "192.0.2.1" {
+ t.Fatalf("member received check: %+v", hc)
+ }
+ }
+ writes := fake.writes
+ fake.mu.Unlock()
+ if err := pass(ctx); err != nil {
+ t.Fatal(err)
+ }
+ fake.mu.Lock()
+ defer fake.mu.Unlock()
+ if fake.writes != writes {
+ t.Fatalf("second pass wrote %d times", fake.writes-writes)
+ }
+}
diff --git a/internal/host/steering_loop.go b/internal/host/steering_loop.go
index 658741b1a..611ce9702 100644
--- a/internal/host/steering_loop.go
+++ b/internal/host/steering_loop.go
@@ -15,6 +15,7 @@ import (
"strings"
"time"
+ "github.com/aws/aws-sdk-go-v2/service/route53"
"github.com/carlosframework/platform/internal/provision"
"github.com/carlosframework/platform/internal/registry"
"github.com/carlosframework/platform/internal/release"
@@ -179,6 +180,24 @@ func steeringDuty(zoneID string, pass func(context.Context) error) housekeeperDu
}}
}
+type steeringClient interface {
+ ListResourceRecordSets(ctx context.Context, in *route53.ListResourceRecordSetsInput, optFns ...func(*route53.Options)) (*route53.ListResourceRecordSetsOutput, error)
+ ChangeResourceRecordSets(ctx context.Context, in *route53.ChangeResourceRecordSetsInput, optFns ...func(*route53.Options)) (*route53.ChangeResourceRecordSetsOutput, error)
+ ListHealthChecks(ctx context.Context, in *route53.ListHealthChecksInput, optFns ...func(*route53.Options)) (*route53.ListHealthChecksOutput, error)
+ ListTagsForResources(ctx context.Context, in *route53.ListTagsForResourcesInput, optFns ...func(*route53.Options)) (*route53.ListTagsForResourcesOutput, error)
+ CreateHealthCheck(ctx context.Context, in *route53.CreateHealthCheckInput, optFns ...func(*route53.Options)) (*route53.CreateHealthCheckOutput, error)
+ DeleteHealthCheck(ctx context.Context, in *route53.DeleteHealthCheckInput, optFns ...func(*route53.Options)) (*route53.DeleteHealthCheckOutput, error)
+ ChangeTagsForResource(ctx context.Context, in *route53.ChangeTagsForResourceInput, optFns ...func(*route53.Options)) (*route53.ChangeTagsForResourceOutput, error)
+}
+
+func steeringPassFor(store release.Store, client steeringClient, zoneID, appsDomain string, judge *provision.LifetimeJudge) func(context.Context) error {
+ return func(ctx context.Context) error {
+ return steeringPass(provision.WithLifetimes(ctx, judge), store, func(ctx context.Context, routes []registry.Route, edges [][]byte) error {
+ return steering.ConvergeDeployment(ctx, client, zoneID, routes, edges, appsDomain)
+ })
+ }
+}
+
// steeringLoop converges the deployment's steering zone every 5 minutes +
// jitter, on the one box holding the housekeeper lease.
//
@@ -234,11 +253,7 @@ func steeringLoop(judge *provision.LifetimeJudge) {
return
}
appsDomain := strings.TrimSpace(os.Getenv("PLATFORM_APPS_DOMAIN"))
- pass = func(ctx context.Context) error {
- return steeringPass(provision.WithLifetimes(ctx, judge), store, func(ctx context.Context, routes []registry.Route, edges [][]byte) error {
- return steering.ConvergeDeployment(ctx, client, zoneID, routes, edges, appsDomain)
- })
- }
+ pass = steeringPassFor(store, client, zoneID, appsDomain, judge)
log.Printf("agent: steering loop armed (5min + jitter), zone %s, apps domain %q — converges only while this box holds the housekeeper lease", zoneID, appsDomain)
}
diff --git a/internal/steering/g3_test.go b/internal/steering/g3_test.go
new file mode 100644
index 000000000..d1b9419bc
--- /dev/null
+++ b/internal/steering/g3_test.go
@@ -0,0 +1,221 @@
+package steering
+
+import (
+ "context"
+ "errors"
+ "fmt"
+ "strings"
+ "testing"
+
+ "github.com/aws/aws-sdk-go-v2/aws"
+ "github.com/aws/aws-sdk-go-v2/service/route53"
+ r53types "github.com/aws/aws-sdk-go-v2/service/route53/types"
+ "github.com/carlosframework/platform/internal/registry"
+)
+
+func TestG3Membership(t *testing.T) {
+ for _, tc := range []struct {
+ name, field string
+ keep bool
+ }{
+ {"absent", "", true}, {"shared", `,"serves_shared_pool":true`, true}, {"pool-only", `,"serves_shared_pool":false`, false},
+ } {
+ t.Run(tc.name, func(t *testing.T) {
+ f, err := parseEdgesFileView([]byte(`{"v":1,"box":"g-fixed","eip":"192.0.2.1","region":"us-east-1"` + tc.field + `}`))
+ if err != nil {
+ t.Fatal(err)
+ }
+ log := captureLog(t)
+ got := desiredState(nil, []edgesFileView{f}, "example.com")
+ if (len(got) == 1) != tc.keep {
+ t.Fatalf("records = %v", got)
+ }
+ if !tc.keep && strings.Count(log.String(), "edge g-fixed unarmed: does not serve the shared pool") != 1 {
+ t.Fatalf("log = %s", log)
+ }
+ })
+ }
+}
+
+func TestG3FakeRejectsDuplicateRegionAtomically(t *testing.T) {
+ f := newFake()
+ a := desiredRRSet(dublinRec, "a")
+ b := a
+ b.SetIdentifier = aws.String("second")
+ f.records = []r53types.ResourceRecordSet{a}
+ good := desiredRRSet(oregonRec, "b")
+ _, err := f.ChangeResourceRecordSets(context.Background(), &route53.ChangeResourceRecordSetsInput{ChangeBatch: &r53types.ChangeBatch{Changes: []r53types.Change{
+ {Action: r53types.ChangeActionUpsert, ResourceRecordSet: &good},
+ {Action: r53types.ChangeActionUpsert, ResourceRecordSet: &b},
+ }}})
+ var invalid *r53types.InvalidChangeBatch
+ if !errors.As(err, &invalid) {
+ t.Fatalf("want InvalidChangeBatch, got %v", err)
+ }
+ if len(f.records) != 1 || aws.ToString(f.records[0].SetIdentifier) != "dublin" {
+ t.Fatalf("failed batch changed zone: %v", f.records)
+ }
+}
+
+func TestG3RegionWinner(t *testing.T) {
+ for _, incumbent := range []string{"", "z-fixed"} {
+ t.Run("incumbent-"+incumbent, func(t *testing.T) {
+ f := newFake()
+ if incumbent != "" {
+ f.records = []r53types.ResourceRecordSet{desiredRRSet(desiredRecord{Name: "edge.example.com.", Box: incumbent, EIP: "192.0.2.2", Region: "us-east-1"}, "foreign")}
+ }
+ log := captureLog(t)
+ bodies := [][]byte{
+ []byte(`{"v":1,"box":"z-fixed","eip":"192.0.2.2","region":"us-east-1","serves_shared_pool":true}`),
+ []byte(`{"v":1,"box":"a-fixed","eip":"192.0.2.1","region":"us-east-1","serves_shared_pool":true}`),
+ }
+ err := ConvergeDeployment(context.Background(), f, testZone, []registry.Route{{Host: "app.example.com", Steering: "latency"}}, bodies, "example.com")
+ if err != nil {
+ t.Fatal(err)
+ }
+ winner := incumbent
+ if winner == "" {
+ winner = "a-fixed"
+ }
+ if len(f.records) != 2 || len(f.checks) != 1 {
+ t.Fatalf("records=%d checks=%d", len(f.records), len(f.checks))
+ }
+ for _, rr := range f.records {
+ if aws.ToString(rr.SetIdentifier) != winner {
+ t.Fatalf("winner=%s record=%v", winner, rr)
+ }
+ }
+ if strings.Count(log.String(), "ERROR steering: dropped duplicate region target") != 1 {
+ t.Fatalf("log=%s", log)
+ }
+ })
+ }
+}
+
+func TestG3OneConflictAmong135(t *testing.T) {
+ f := newFake()
+ conflict := desiredRRSet(desiredRecord{Name: "h050.example.com.", Box: "foreign", EIP: "192.0.2.9", Region: "us-east-1"}, "foreign-check")
+ f.records = []r53types.ResourceRecordSet{conflict}
+ var routes []registry.Route
+ for i := 0; i < 134; i++ {
+ routes = append(routes, registry.Route{Host: fmt.Sprintf("h%03d.example.com", i), Steering: "latency"})
+ }
+ log := captureLog(t)
+ err := ConvergeDeployment(context.Background(), f, testZone, routes, [][]byte{[]byte(`{"v":1,"box":"adi","eip":"192.0.2.1","region":"us-east-1"}`)}, "example.com")
+ if err == nil {
+ t.Fatal("partial failure reported as success")
+ }
+ if len(f.submitted) != 134 || len(f.records) != 135 {
+ t.Fatalf("applied=%d records=%d", len(f.submitted), len(f.records))
+ }
+ if strings.Count(log.String(), "refused change") != 1 || !strings.Contains(log.String(), "h050.example.com.") || !strings.Contains(log.String(), "set=adi") || !strings.Contains(log.String(), "second latency RRSet") {
+ t.Fatalf("log=%s", log)
+ }
+ if len(f.checks) != 1 {
+ t.Fatalf("referenced check removed: %v", f.checks)
+ }
+}
+
+func TestG3DeleteBeforeUpsertAcrossBatches(t *testing.T) {
+ f := newFake()
+ var want []desiredRecord
+ var old []r53types.ResourceRecordSet
+ for i := 0; i < 101; i++ {
+ rec := desiredRecord{Name: fmt.Sprintf("h%03d.example.com.", i), Box: "old", EIP: "192.0.2.1", Region: "us-east-1"}
+ old = append(old, desiredRRSet(rec, "old-check"))
+ rec.Box = "new"
+ want = append(want, rec)
+ }
+ f.records = append(f.records, old...)
+ changes, err := recordChanges(want, f.records, map[string]string{"192.0.2.1": "new-check"}, nil, old)
+ if err != nil {
+ t.Fatal(err)
+ }
+ if err = applyChanges(context.Background(), f, testZone, changes); err != nil {
+ t.Fatal(err)
+ }
+ if len(f.records) != 101 {
+ t.Fatalf("records=%d", len(f.records))
+ }
+ for i, c := range f.submitted {
+ if (i < 101) != (c.Action == r53types.ChangeActionDelete) {
+ t.Fatalf("change %d out of order: %v", i, c)
+ }
+ }
+}
+
+type g3FailureClient struct {
+ *fakeR53
+ failDelete bool
+ failReadAfterWrite bool
+ uncertainWrite bool
+ calls int
+}
+
+func (f *g3FailureClient) ChangeResourceRecordSets(ctx context.Context, in *route53.ChangeResourceRecordSetsInput, opts ...func(*route53.Options)) (*route53.ChangeResourceRecordSetsOutput, error) {
+ f.calls++
+ if f.failDelete {
+ for _, c := range in.ChangeBatch.Changes {
+ if c.Action == r53types.ChangeActionDelete {
+ return nil, invalidBatch("delete refused")
+ }
+ }
+ }
+ out, err := f.fakeR53.ChangeResourceRecordSets(ctx, in, opts...)
+ if f.uncertainWrite && f.calls == 1 && err == nil {
+ return nil, errors.New("response lost after write")
+ }
+ return out, err
+}
+
+func (f *g3FailureClient) ListResourceRecordSets(ctx context.Context, in *route53.ListResourceRecordSetsInput, opts ...func(*route53.Options)) (*route53.ListResourceRecordSetsOutput, error) {
+ if f.failReadAfterWrite && f.calls > 0 {
+ return nil, errors.New("zone read unavailable")
+ }
+ return f.fakeR53.ListResourceRecordSets(ctx, in, opts...)
+}
+
+func TestG3CleanupAfterFailedDelete(t *testing.T) {
+ f := newFake()
+ mustConverge(t, f, []desiredRecord{dublinRec, oregonRec})
+ f.checks = append(f.checks, r53types.HealthCheck{Id: aws.String("orphan"), HealthCheckConfig: &r53types.HealthCheckConfig{Type: r53types.HealthCheckTypeHttps, Port: aws.Int32(443), IPAddress: aws.String("192.0.2.99")}})
+ f.tags["orphan"] = []r53types.Tag{{Key: aws.String(steeringTagKey), Value: aws.String(testZone)}}
+ client := &g3FailureClient{fakeR53: f, failDelete: true}
+ if err := converge(context.Background(), client, testZone, []desiredRecord{dublinRec}); err == nil {
+ t.Fatal("failed delete not reported")
+ }
+ if len(f.records) != 2 {
+ t.Fatalf("surviving records=%d", len(f.records))
+ }
+ if len(f.deletedChecks) != 1 || f.deletedChecks[0] != "orphan" {
+ t.Fatalf("GC=%v; must collect only the orphan", f.deletedChecks)
+ }
+}
+
+func TestG3UncertainWriteAndCleanupReadFailure(t *testing.T) {
+ for _, readFailure := range []bool{false, true} {
+ t.Run(fmt.Sprint(readFailure), func(t *testing.T) {
+ f := newFake()
+ client := &g3FailureClient{fakeR53: f, uncertainWrite: true, failReadAfterWrite: readFailure}
+ var want []desiredRecord
+ for i := 0; i < 135; i++ {
+ rec := dublinRec
+ rec.Name = fmt.Sprintf("h%03d.example.com.", i)
+ want = append(want, rec)
+ }
+ err := converge(context.Background(), client, testZone, want)
+ if err == nil || !strings.Contains(err.Error(), "response lost") {
+ t.Fatalf("error=%v", err)
+ }
+ if readFailure && !strings.Contains(err.Error(), "zone read unavailable") {
+ t.Fatalf("read failure lost: %v", err)
+ }
+ if client.calls != 2 || len(f.records) != 135 {
+ t.Fatalf("calls=%d records=%d", client.calls, len(f.records))
+ }
+ if len(f.checks) != 1 || f.nDeleteCheck != 0 {
+ t.Fatalf("referenced check deleted: %v", f.deletedChecks)
+ }
+ })
+ }
+}
diff --git a/internal/steering/route53.go b/internal/steering/route53.go
index 653a3f25d..78998b825 100644
--- a/internal/steering/route53.go
+++ b/internal/steering/route53.go
@@ -15,8 +15,10 @@ package steering
import (
"context"
+ "errors"
"fmt"
"log"
+ "log/slog"
"os"
"regexp"
"sort"
@@ -161,7 +163,7 @@ func SteeringZoneID() string {
// internal/edge/route53dns.go's newRoute53DNS. Route53 is a global service
// but the SDK still needs a signing region, so default to us-east-1 when the
// environment names none; an explicit AWS_REGION still wins.
-func NewClient(ctx context.Context) (route53API, error) {
+func NewClient(ctx context.Context, optFns ...func(*route53.Options)) (route53API, error) {
var opts []func(*awsconfig.LoadOptions) error
if strings.TrimSpace(os.Getenv("AWS_REGION")) == "" && strings.TrimSpace(os.Getenv("AWS_DEFAULT_REGION")) == "" {
opts = append(opts, awsconfig.WithRegion("us-east-1"))
@@ -170,7 +172,7 @@ func NewClient(ctx context.Context) (route53API, error) {
if err != nil {
return nil, fmt.Errorf("steering: load aws config: %w", err)
}
- return newRoute53Methods(route53.NewFromConfig(cfg)), nil
+ return newRoute53Methods(route53.NewFromConfig(cfg, optFns...)), nil
}
// ownedCheck is one Route53 health check this deployment owns: tagged
@@ -194,14 +196,12 @@ type ownedCheck struct {
// what the pass would delete — BOTH REFUSALS RUN BEFORE THE FIRST WRITE,
// so a refused pass is genuinely zero-write, not merely zero-delete;
// 4. CREATE any missing health check — capacity before records need it;
-// 5. UPSERT wanted records, DELETE managed-but-unwanted ones;
+// 5. DELETE managed-but-unwanted records, then UPSERT wanted ones;
// 6. GC health checks nothing references any more — after the records that
// referenced them are gone, never before.
//
-// A failure at any step returns loudly and leaves the rest of the pass
-// undone; the housekeeper's next tick re-runs the whole thing from a fresh
-// read. Every step is individually idempotent, so a half-applied pass is a
-// state this function converges from, not a state it gets stuck in.
+// Record failures are returned after trying the remaining changes and cleanup.
+// The next tick reads the zone again and retries what remains.
func converge(ctx context.Context, client route53API, zoneID string, want []desiredRecord) error {
if !steeringZonePattern.MatchString(strings.TrimSpace(zoneID)) {
return fmt.Errorf("steering: refusing to converge: %q is not a bare hosted-zone id", zoneID)
@@ -247,6 +247,8 @@ func converge(ctx context.Context, client route53API, zoneID string, want []desi
return err
}
+ want = oneTargetPerRegion(want, existing)
+
// 3a. names Route53 forbids us from writing at all.
conflicted := conflictedNames(want, existing)
if len(conflicted) > 0 {
@@ -309,12 +311,15 @@ func converge(ctx context.Context, client route53API, zoneID string, want []desi
if err != nil {
return err
}
- if err := applyChanges(ctx, client, zoneID, changes); err != nil {
- return err
- }
+ applyErr := applyChanges(ctx, client, zoneID, changes)
- // 6. GC. Runs only once the record batches have landed.
- return gcHealthChecks(ctx, client, owned, want, existing, changes)
+ // A failed request may have reached Route 53. Read the surviving records
+ // before collecting checks; if that read fails, keep every check.
+ surviving, readErr := listRecords(ctx, client, zoneID)
+ if readErr != nil {
+ return errors.Join(applyErr, readErr)
+ }
+ return errors.Join(applyErr, gcHealthChecks(ctx, client, owned, want, surviving))
}
// shrinkLimit is how many managed records one pass may delete, given how many
@@ -507,9 +512,8 @@ func createHealthCheck(ctx context.Context, client route53API, zoneID, eip, fqdn
// delete of an in-use check anyway, but failing the whole pass on that
// is worse than skipping the one check and saying so.
//
-// A delete that fails is logged, not fatal: the records are already correct,
-// and next tick will try again.
-func gcHealthChecks(ctx context.Context, client route53API, owned []ownedCheck, want []desiredRecord, existing []r53types.ResourceRecordSet, applied []r53types.Change) error {
+// A cleanup delete that fails is logged; the next tick tries it again.
+func gcHealthChecks(ctx context.Context, client route53API, owned []ownedCheck, want []desiredRecord, existing []r53types.ResourceRecordSet) error {
if len(owned) == 0 {
return nil
}
@@ -519,29 +523,13 @@ func gcHealthChecks(ctx context.Context, client route53API, owned []ownedCheck,
wantedEIP[rec.EIP] = true
}
- // Every check id still referenced once this pass has landed.
- deleted := make(map[string]bool)
- for _, c := range applied {
- if c.Action == r53types.ChangeActionDelete && c.ResourceRecordSet != nil {
- deleted[recordKey(*c.ResourceRecordSet)] = true
- }
- }
+ // This is a fresh zone read, including records from failed or uncertain writes.
referenced := make(map[string]bool)
for _, rr := range existing {
- if deleted[recordKey(rr)] {
- continue
- }
if id := aws.ToString(rr.HealthCheckId); id != "" {
referenced[id] = true
}
}
- for _, c := range applied {
- if c.Action == r53types.ChangeActionUpsert && c.ResourceRecordSet != nil {
- if id := aws.ToString(c.ResourceRecordSet.HealthCheckId); id != "" {
- referenced[id] = true
- }
- }
- }
for _, c := range owned {
if wantedEIP[c.eip] && referenced[c.id] {
@@ -871,8 +859,8 @@ func firstValue(rr r53types.ResourceRecordSet) string {
// already, by partitionManaged, and are passed in — this function only turns
// them into changes.
//
-// UPSERTs come first in the returned slice and DELETEs last, so that when the
-// changes are chunked, capacity is added before any is taken away.
+// DELETEs precede UPSERTs so a retiring target releases its region slot
+// before its replacement is submitted, including across batch boundaries.
//
// A wanted key that already holds a record we do NOT manage (a foreign
// latency record at exactly the (name, SetIdentifier) we would create) is
@@ -915,39 +903,88 @@ func recordChanges(want []desiredRecord, existing []r53types.ResourceRecordSet,
deletes = append(deletes, r53types.Change{Action: r53types.ChangeActionDelete, ResourceRecordSet: &set})
}
- return append(upserts, deletes...), nil
+ return append(deletes, upserts...), nil
}
-// applyChanges submits the changes in chunks.
-//
-// Partial failure is explicit: chunk N lands, chunk N+1 fails, the pass
-// returns the error and stops. That is safe because each chunk is
-// independently valid — an UPSERT is idempotent and a DELETE is of a record
-// nothing wants — so the next housekeeper tick re-reads the zone and issues
-// exactly the changes still outstanding. The one thing that must NOT happen
-// after a failed batch is the health-check GC, and converge returns before
-// reaching it.
+// applyChanges preserves delete-before-upsert order through each split. Only
+// InvalidChangeBatch is bisected: retrying uncertain transport failures could
+// replay a DELETE that already landed.
func applyChanges(ctx context.Context, client route53API, zoneID string, changes []r53types.Change) error {
- if len(changes) == 0 {
- return nil
- }
- for start := 0; start < len(changes); start += changeBatchLimit {
- end := start + changeBatchLimit
- if end > len(changes) {
- end = len(changes)
- }
- chunk := changes[start:end]
- if _, err := client.ChangeResourceRecordSets(ctx, &route53.ChangeResourceRecordSetsInput{
+ var apply func([]r53types.Change) error
+ apply = func(chunk []r53types.Change) error {
+ _, err := client.ChangeResourceRecordSets(ctx, &route53.ChangeResourceRecordSetsInput{
HostedZoneId: aws.String(zoneID),
ChangeBatch: &r53types.ChangeBatch{Changes: chunk},
- }); err != nil {
- return fmt.Errorf("steering: change batch %d-%d of %d in %s: %w", start, end, len(changes), zoneID, err)
+ })
+ if err != nil {
+ var invalid *r53types.InvalidChangeBatch
+ isInvalid := errors.As(err, &invalid)
+ if isInvalid && len(chunk) > 1 {
+ mid := len(chunk) / 2
+ leftErr := apply(chunk[:mid])
+ rightErr := apply(chunk[mid:])
+ return errors.Join(leftErr, rightErr)
+ }
+ if isInvalid && len(invalid.Messages) > 0 {
+ err = fmt.Errorf("%w: %s", err, strings.Join(invalid.Messages, "; "))
+ }
+ message := "steering: change request failed"
+ if isInvalid {
+ message = "steering: refused change"
+ }
+ for _, c := range chunk {
+ slog.Error(message, "name", aws.ToString(c.ResourceRecordSet.Name), "set", aws.ToString(c.ResourceRecordSet.SetIdentifier), "action", c.Action, "error", err)
+ }
+ return err
}
for _, c := range chunk {
log.Printf("steering: %s %s (set %s)", c.Action, aws.ToString(c.ResourceRecordSet.Name), aws.ToString(c.ResourceRecordSet.SetIdentifier))
}
+ return nil
}
- return nil
+ var failures []error
+ for start := 0; start < len(changes); start += changeBatchLimit {
+ end := min(start+changeBatchLimit, len(changes))
+ if err := apply(changes[start:end]); err != nil {
+ failures = append(failures, fmt.Errorf("steering: change batch %d-%d of %d in %s: %w", start, end, len(changes), zoneID, err))
+ }
+ }
+ return errors.Join(failures...)
+}
+
+// oneTargetPerRegion selects a deployment-wide target before any writes.
+// Existing latency answers win; ties and new regions use the lowest box ref.
+func oneTargetPerRegion(want []desiredRecord, existing []r53types.ResourceRecordSet) []desiredRecord {
+ type target struct{ region, box, eip string }
+ current := make(map[target]bool)
+ for _, rr := range existing {
+ if rr.Type == r53types.RRTypeA && rr.Region != "" {
+ current[target{string(rr.Region), aws.ToString(rr.SetIdentifier), firstValue(rr)}] = true
+ }
+ }
+ winners := make(map[string]target)
+ for _, rec := range want {
+ candidate := target{rec.Region, rec.Box, rec.EIP}
+ kept, ok := winners[rec.Region]
+ if !ok || (current[candidate] && !current[kept]) || (current[candidate] == current[kept] && candidate.box < kept.box) {
+ winners[rec.Region] = candidate
+ }
+ }
+ out := make([]desiredRecord, 0, len(want))
+ logged := make(map[target]bool)
+ for _, rec := range want {
+ candidate := target{rec.Region, rec.Box, rec.EIP}
+ kept := winners[rec.Region]
+ if candidate != kept {
+ if !logged[candidate] {
+ slog.Error("steering: dropped duplicate region target", "region", rec.Region, "kept", kept.box, "dropped", rec.Box)
+ logged[candidate] = true
+ }
+ continue
+ }
+ out = append(out, rec)
+ }
+ return out
}
// ---------------------------------------------------------------------------
diff --git a/internal/steering/route53_test.go b/internal/steering/route53_test.go
index 21a594956..f54823c67 100644
--- a/internal/steering/route53_test.go
+++ b/internal/steering/route53_test.go
@@ -67,14 +67,15 @@ func (f *fakeR53) writes() int {
return f.nChangeRecords + f.nCreateCheck + f.nDeleteCheck + f.nChangeTags
}
-// validateZone enforces the three Route53 rules this converger can violate,
+// validateZone enforces the Route53 rules this converger can violate,
// each of which rejects the WHOLE batch:
//
// 1. a name+type holds either one simple record OR a routing-policy record
// set, never both;
// 2. a name holding a CNAME holds no other record type;
// 3. one routing policy per name+type — a weighted set and a latency set
-// cannot share a name.
+// cannot share a name;
+// 4. one latency record per name, type and region.
//
// Modelled on the projected post-batch state, so a batch is judged by what it
// would produce, atomically.
@@ -83,9 +84,17 @@ func validateZone(recs []r53types.ResourceRecordSet) error {
plain, policy := map[nt]bool{}, map[nt]bool{}
policies := map[nt]map[string]bool{}
names := map[string]map[string]bool{} // name -> set of types
+ latency := map[string]bool{}
for _, rr := range recs {
name := strings.ToLower(aws.ToString(rr.Name))
k := nt{name, string(rr.Type)}
+ if rr.Region != "" {
+ key := name + "|" + string(rr.Type) + "|" + string(rr.Region)
+ if latency[key] {
+ return &r53types.InvalidChangeBatch{Messages: []string{"second latency RRSet for " + key}}
+ }
+ latency[key] = true
+ }
if names[name] == nil {
names[name] = map[string]bool{}
}
@@ -102,22 +111,26 @@ func validateZone(recs []r53types.ResourceRecordSet) error {
}
for k := range plain {
if policy[k] {
- return fmt.Errorf("fake: InvalidChangeBatch: RRSet with DNS name %s and type %s cannot be both a simple record and a routing-policy record set", k.name, k.typ)
+ return invalidBatch("fake: InvalidChangeBatch: RRSet with DNS name %s and type %s cannot be both a simple record and a routing-policy record set", k.name, k.typ)
}
}
for name, types := range names {
if types["CNAME"] && len(types) > 1 {
- return fmt.Errorf("fake: InvalidChangeBatch: RRSet with DNS name %s has a CNAME, which cannot coexist with any other record type", name)
+ return invalidBatch("fake: InvalidChangeBatch: RRSet with DNS name %s has a CNAME, which cannot coexist with any other record type", name)
}
}
for k, kinds := range policies {
if len(kinds) > 1 {
- return fmt.Errorf("fake: InvalidChangeBatch: RRSet with DNS name %s and type %s mixes routing policies (%v) — only one policy per name and type", k.name, k.typ, sortedKeys(kinds))
+ return invalidBatch("fake: InvalidChangeBatch: RRSet with DNS name %s and type %s mixes routing policies (%v) — only one policy per name and type", k.name, k.typ, sortedKeys(kinds))
}
}
return nil
}
+func invalidBatch(format string, args ...any) error {
+ return &r53types.InvalidChangeBatch{Messages: []string{fmt.Sprintf(format, args...)}}
+}
+
func fakePolicyKind(rr r53types.ResourceRecordSet) string {
switch {
case rr.Region != "":
@@ -189,7 +202,7 @@ func (f *fakeR53) ChangeResourceRecordSets(ctx context.Context, in *route53.Chan
if f.failChange != nil {
return nil, f.failChange
}
- if in.ChangeBatch == nil || len(in.ChangeBatch.Changes) == 0 {
+ if in.ChangeBatch == nil || len(in.ChangeBatch.Changes) == 0 || len(in.ChangeBatch.Changes) > changeBatchLimit {
return nil, errors.New("fake: empty change batch")
}
@@ -215,7 +228,7 @@ func (f *fakeR53) ChangeResourceRecordSets(ctx context.Context, in *route53.Chan
}
case r53types.ChangeActionDelete:
if idx < 0 {
- return nil, fmt.Errorf("fake: InvalidChangeBatch: no such record %s", key)
+ return nil, invalidBatch("fake: InvalidChangeBatch: no such record %s", key)
}
projected = append(projected[:idx], projected[idx+1:]...)
default:
@@ -743,7 +756,8 @@ func TestFakeRejectsConflictingBatches(t *testing.T) {
if err == nil {
t.Fatalf("the fake accepted the batch — it is more permissive than Route53")
}
- if !strings.Contains(err.Error(), "InvalidChangeBatch") || !strings.Contains(err.Error(), tt.wantErr) {
+ var invalid *r53types.InvalidChangeBatch
+ if !errors.As(err, &invalid) || !strings.Contains(strings.Join(invalid.Messages, "; "), tt.wantErr) {
t.Errorf("wrong error: %v", err)
}
// atomic: the innocent change did NOT land either
@@ -1088,9 +1102,9 @@ func TestConvergeChangeFailureIsLoud(t *testing.T) {
if !strings.Contains(err.Error(), "InvalidChangeBatch") {
t.Errorf("the underlying error was not wrapped: %v", err)
}
- // nothing may be GC'd on a pass whose record changes did not land
- if len(f.deletedChecks) != 0 {
- t.Errorf("checks GC'd after a failed record batch: %v", f.deletedChecks)
+ // The new check has no surviving record and must be collected.
+ if len(f.deletedChecks) != 1 {
+ t.Errorf("unreferenced check leaked after failed record batch: %v", f.deletedChecks)
}
}
diff --git a/internal/steering/steering.go b/internal/steering/steering.go
index 2e8dc7708..15d5375a3 100644
--- a/internal/steering/steering.go
+++ b/internal/steering/steering.go
@@ -71,10 +71,11 @@ type edgeHostView struct {
}
type edgesFileView struct {
- V int `json:"v"`
- Box string `json:"box"`
- EIP string `json:"eip"`
- Region string `json:"region,omitempty"`
+ V int `json:"v"`
+ Box string `json:"box"`
+ EIP string `json:"eip"`
+ Region string `json:"region,omitempty"`
+ ServesSharedPool *bool `json:"serves_shared_pool"`
// Hosts is the per-host map the file publishes (the writer's
// internal/host/edgeHost shape; see edgeHostView for what survives the
// decode). The mark rides the ENTRY (edgeHost.Replica on the writer
@@ -119,6 +120,10 @@ var awsRegionPattern = regexp.MustCompile(`^[a-z]{2}(-[a-z]+)+-\d$`)
func armedEdges(edges []edgesFileView) []edgesFileView {
out := make([]edgesFileView, 0, len(edges))
for _, e := range edges {
+ if e.ServesSharedPool != nil && !*e.ServesSharedPool {
+ log.Printf("steering: edge %s unarmed: does not serve the shared pool", e.Box)
+ continue
+ }
if e.EIP == "" {
log.Printf("steering: edge %s unarmed: no EIP", e.Box)
continue