carlos / platform Public

region-ha p2a: use regional ingress in DNS guidance

Keep configured public DNS ingress separate from proxy authority and live-box
folding. Refuse configured HA placements before claim writes while regional
readiness is unavailable, preserving legacy behavior and row-local fallback.

Cover startup, console doors, CLI refusals and proxy trust with tests, and
document the ingress activation order.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Paul Campbell pushed by claude agent, operated by paul@keymail.dev 08e3f9d8880344c5f38655839ac16c5b62b8b386 parent b0b4164
12 files changed, +766 −51
  • cmd/console/main.go +10 −0
  • cmd/console/regioningress_test.go +30 −0
  • docs/site/cli.md +8 −0
  • domains_cli_test.go +40 −0
  • internal/console/apidomains.go +1 −1
  • internal/console/apiplacements.go +95 −2
  • internal/console/appsettings.go +11 −4
  • internal/console/regioningress.go +31 −0
  • internal/console/regioningress_test.go +504 −0
  • internal/console/server.go +19 −10
  • internal/console/server_test.go +2 −2
  • internal/console/view.go +15 −32

CI passed — run details

diff --git a/cmd/console/main.go b/cmd/console/main.go
index e13fd40cd..a2790c73a 100644
--- a/cmd/console/main.go
+++ b/cmd/console/main.go
@@ -452,6 +452,10 @@ func serve() {
// Before the server exists: every door that seals reads this switch.
appconfig.SetBoundSealing(secretsEnvelopeV2())
geoReader := consoleGeoReader(strings.TrimSpace(os.Getenv("CONSOLE_GEOIP_DB")))
+ regionalIngress, err := regionIngress(os.Getenv)
+ if err != nil {
+ log.Fatal(err)
+ }
cfg := console.Config{
Origin: origin,
Keymail: envOr("CONSOLE_KEYMAIL", "https://keymail.dev"),
@@ -510,6 +514,7 @@ func serve() {
ReleasePub: pub,
Key: key,
EdgeIPs: edgeIPs(),
+ RegionIngress: regionalIngress,
SecretsPub: secretsPub(),
AppsDomain: appsDomain(),
AppsDomainAliasAccounts: strings.FieldsFunc(os.Getenv("CONSOLE_APPS_DOMAIN_ALIAS_ACCOUNTS"), func(r rune) bool { return r == ',' || r == ' ' }),
@@ -1987,3 +1992,8 @@ func planCatalog() (*plans.Catalog, error) {
}
return plans.LoadCatalog(path)
}
+
+// regionIngress validates the complete DNS list before NewServer or a listener.
+func regionIngress(getenv func(string) string) ([]string, error) {
+ return console.ParseRegionIngress(getenv("CONSOLE_REGION_INGRESS"))
+}
diff --git a/cmd/console/regioningress_test.go b/cmd/console/regioningress_test.go
new file mode 100644
index 000000000..dc31d5364
--- /dev/null
+++ b/cmd/console/regioningress_test.go
@@ -0,0 +1,30 @@
+package main
+
+import (
+ "reflect"
+ "testing"
+)
+
+func TestRegionIngressStartupWiring(t *testing.T) {
+ for _, tc := range []struct {
+ raw string
+ want []string
+ bad bool
+ }{
+ {"", nil, false}, {" 192.0.2.90,2001:0db8::1,192.0.2.90 ", []string{"192.0.2.90", "2001:db8::1"}, false}, {"192.0.2.90,not-an-ip", nil, true},
+ } {
+ t.Run(tc.raw, func(t *testing.T) {
+ calls := 0
+ got, err := regionIngress(func(k string) string {
+ calls++
+ if k != "CONSOLE_REGION_INGRESS" {
+ t.Fatalf("read %s", k)
+ }
+ return tc.raw
+ })
+ if calls != 1 || (err != nil) != tc.bad || !reflect.DeepEqual(got, tc.want) {
+ t.Fatalf("startup = %v, %v (%d getenv calls)", got, err, calls)
+ }
+ })
+ }
+}
diff --git a/docs/site/cli.md b/docs/site/cli.md
index 6cf69e8e0..93b89cb72 100644
--- a/docs/site/cli.md
+++ b/docs/site/cli.md
@@ -1446,6 +1446,14 @@ A regional domain has to be new. A hostname already attached as an ordinary doma
Each instance stays separate, with its own data, backups and hostname. Path prefixes, static sites and fleet placements are not supported on a regional domain.
+When the deployment uses configured regional ingress, set `CONSOLE_REGION_INGRESS` to the complete deployment-wide set of public ingress IP addresses. Keep `PLATFORM_EDGE_IPS` aligned with that same public set. Every `PLATFORM_EDGE_IPS` entry must be a public ingress address. A platform box EIP can qualify if it is public ingress.
+
+Before rolling the console, validate the complete `CONSOLE_REGION_INGRESS` value. Verify that the agents accept the same addresses through `PLATFORM_EDGE_IPS` before setting `CONSOLE_REGION_INGRESS`. Set the console ingress before any group box publishes an edges file.
+
+With configured ingress, DNS guidance uses A records for both apexes and subdomains. `carlos domains placements` refuses configured high availability placements while regional placement readiness is unavailable. The refusal names the configured public ingress addresses and does not list member addresses.
+
+The root CLI help still says that `carlos domains placements` shows the addresses to point DNS at for each region. That help remains unchanged. The configured-ingress refusal limits that promise until regional placement readiness is available.
+
### carlos features
Sets or lists an app's own feature flags — switches the app defines, the
diff --git a/domains_cli_test.go b/domains_cli_test.go
index be4fed5d4..fec921a8a 100644
--- a/domains_cli_test.go
+++ b/domains_cli_test.go
@@ -1255,3 +1255,43 @@ func TestRunDomainsPlacementsPublishedExamples(t *testing.T) {
t.Fatalf("ran %d published write examples, want both", writes)
}
}
+
+func TestDomainsPlacementsConfiguredIngressRefusal(t *testing.T) {
+ const msg = "Placement readiness for shop.example.com is unavailable here. For DNS, use the configured public ingress addresses: 192.0.2.90."
+ fc := newFakeDomainsConsole(t)
+ fc.putStatus, fc.putBody = http.StatusConflict, `{"error":"`+msg+`"}`
+ home := t.TempDir()
+ creds := filepath.Join(home, "credentials")
+ writeTestCredential(t, creds, fc.ts.URL)
+ // Exercise both existing client doors, including the command's fatal-error printing.
+ ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ if strings.HasSuffix(r.URL.Path, "/placements") {
+ w.WriteHeader(http.StatusConflict)
+ json.NewEncoder(w).Encode(map[string]string{"error": msg})
+ return
+ }
+ fc.ts.Config.Handler.ServeHTTP(w, r)
+ }))
+ defer ts.Close()
+ writeTestCredential(t, creds, ts.URL)
+ bin := buildCarlos(t)
+ for _, set := range []bool{false, true} {
+ args := []string{"domains", "placements", "-app", "tito", "-account", "bab"}
+ if set {
+ args = append(args, "-set", "ie=shop-ie.example.net")
+ }
+ args = append(args, "shop.example.com")
+ cmd := exec.Command(bin, args...)
+ cmd.Env = carlosTestEnv(t, "CARLOS_CREDENTIALS="+creds, "CARLOS_DEPLOYMENT_BUCKET=", "CARLOS_DEPLOYMENT_DIR=")
+ cmd.Dir = home
+ out, err := cmd.CombinedOutput()
+ if err == nil || !strings.Contains(string(out), msg) {
+ t.Fatalf("CLI = %v %s", err, out)
+ }
+ for _, bad := range []string{"DNS-ready", "203.0.113.10", "BOX", "TARGET"} {
+ if strings.Contains(string(out), bad) {
+ t.Fatalf("CLI advertised member table: %s", out)
+ }
+ }
+ }
+}
diff --git a/internal/console/apidomains.go b/internal/console/apidomains.go
index d9a6f3484..faf3f3f6e 100644
--- a/internal/console/apidomains.go
+++ b/internal/console/apidomains.go
@@ -1454,7 +1454,7 @@ func (s *Server) domainItem(ctx context.Context, c domains.Claim, readings map[s
// region's visitors to every edge. A wildcard's delegation CNAME is
// not a pointing record, and stays: without it the delegation check
// below can say "missing" with nothing to create.
- item.Guidance = regionalDNSGuidance(c.Host)
+ item.Guidance, item.Detail = s.configuredRegionalGuidance(ctx, c)
item.Records = delegationRecords(c.Host, c.Wildcard, s.delegationZone)
case item.DNSStatus != "pointing" && item.DNSStatus != "unresolved":
item.Guidance = domainGuidance(c.Host, targets)
diff --git a/internal/console/apiplacements.go b/internal/console/apiplacements.go
index 6a56e612e..d52d96839 100644
--- a/internal/console/apiplacements.go
+++ b/internal/console/apiplacements.go
@@ -105,6 +105,9 @@ func (s *Server) handleAPIDomainPlacementsGet(w http.ResponseWriter, r *http.Req
if !s.teamClaimSnapshotInScope(w, r, ctx, c, "api domain placements") {
return
}
+ if s.refuseConfiguredPlacements(w, r.WithContext(ctx), *c) {
+ return
+ }
now := time.Now()
var (
snap edgesfile.Snapshot
@@ -485,7 +488,7 @@ func (s *Server) handleAPIDomainPlacementsPut(w http.ResponseWriter, r *http.Req
}
ctx, cancel := context.WithTimeout(r.Context(), instanceStoreTimeout)
defer cancel()
- set, ref := s.placementsBindings(ctx, acct, app, in.Placements)
+ set, ref := s.placementsBindings(ctx, acct, app, host, in.Placements)
if ref != nil {
jsonError(w, ref.Status, ref.Msg)
return
@@ -692,7 +695,7 @@ func onceProver(prove func() bool) func() bool {
// kind), not a replica, not fleet-placed, not TCP-backed (Addr or Addrs).
// A host that is not one answers RD-20 whatever the reason, so the door
// says nothing of other apps' and accounts' instances. Sorted by nothing: body order is kept.
-func (s *Server) placementsBindings(ctx context.Context, acct *Account, app string, in []placementIn) ([]domains.Placement, *doorRefusal) {
+func (s *Server) placementsBindings(ctx context.Context, acct *Account, app, host string, in []placementIn) ([]domains.Placement, *doorRefusal) {
if len(in) == 0 || len(in) > domains.MaxPlacements {
return nil, &doorRefusal{http.StatusBadRequest, placementsCountMsg}
}
@@ -739,6 +742,14 @@ func (s *Server) placementsBindings(ctx context.Context, acct *Account, app stri
return nil, &doorRefusal{http.StatusBadRequest, placementsNotInstanceMsg(b.Host, named[i])}
}
}
+ if len(s.cfg.RegionIngress) > 0 {
+ for _, b := range set {
+ rec := byHost[b.Host]
+ if rec.HA || s.haRegion(b.Region) {
+ return nil, &doorRefusal{http.StatusConflict, s.configuredPlacementGuidance(host)}
+ }
+ }
+ }
return set, nil
}
@@ -1024,3 +1035,85 @@ func heartbeatLists(boxes []status.Box, now time.Time, keys ...string) bool {
}
return false
}
+
+const configuredRegionalDetail = "Regional placement details are not available in this view."
+
+func (s *Server) configuredPlacementGuidance(host string) string {
+ return fmt.Sprintf("Placement readiness for %s is unavailable here. For DNS, use the configured public ingress addresses: %s.", host, strings.Join(s.edgeIPs(context.Background()), ", "))
+}
+
+// ingressTargetRecord shares regional domain target reads within a view
+// request, including failed reads. Write validation supplies its own records.
+func (s *Server) ingressTargetRecord(ctx context.Context, acct, app, host string) (*provision.Record, error) {
+ return memoize(ctx, "ingress-target:"+acct+"/"+app+"/"+host, func() (*provision.Record, error) {
+ rec, _, err := s.readRecord(ctx, acct, app, host)
+ return rec, err
+ })
+}
+
+// configuredPlacementBlocked runs only after the claim's authorization and
+// team gates. A missing record has no immutable flag, but the active region
+// still applies. Regional claims need no record read to establish that gate.
+func (s *Server) configuredPlacementBlocked(ctx context.Context, c domains.Claim) (bool, error) {
+ if len(s.cfg.RegionIngress) == 0 {
+ return false, nil
+ }
+ if c.Regional() {
+ for _, pl := range c.Placements {
+ if s.haRegion(pl.Region) {
+ return true, nil
+ }
+ }
+ for _, pl := range c.Placements {
+ rec, err := s.ingressTargetRecord(ctx, c.Account, c.App, pl.Host)
+ if errors.Is(err, os.ErrNotExist) {
+ continue
+ }
+ if err != nil {
+ return false, err
+ }
+ if rec != nil && (rec.HA || s.haRegion(rec.Region)) {
+ return true, nil
+ }
+ }
+ return false, nil
+ }
+ target := c.Route
+ if target == "" {
+ target = c.Host
+ }
+ rec, err := s.ingressTargetRecord(ctx, c.Account, c.App, target)
+ if errors.Is(err, os.ErrNotExist) {
+ return false, nil
+ }
+ if err != nil {
+ return false, err
+ }
+ return rec != nil && (rec.HA || s.haRegion(rec.Region)), nil
+}
+
+func (s *Server) refuseConfiguredPlacements(w http.ResponseWriter, r *http.Request, c domains.Claim) bool {
+ blocked, err := s.configuredPlacementBlocked(r.Context(), c)
+ if err != nil {
+ jsonError(w, http.StatusServiceUnavailable, placementsUnreadableMsg)
+ return true
+ }
+ if blocked {
+ jsonError(w, http.StatusConflict, s.configuredPlacementGuidance(c.Host))
+ return true
+ }
+ return false
+}
+
+// configuredRegionalGuidance degrades only this row on a failed read. A
+// single-mode row must retain its DNS records without reading its target.
+func (s *Server) configuredRegionalGuidance(ctx context.Context, c domains.Claim) (string, string) {
+ if !c.Regional() {
+ return "", ""
+ }
+ blocked, err := s.configuredPlacementBlocked(ctx, c)
+ if blocked || err != nil {
+ return s.configuredPlacementGuidance(c.Host), configuredRegionalDetail
+ }
+ return regionalDNSGuidance(c.Host), regionalStateDetail
+}
diff --git a/internal/console/appsettings.go b/internal/console/appsettings.go
index cf2dc70ae..7ae239c83 100644
--- a/internal/console/appsettings.go
+++ b/internal/console/appsettings.go
@@ -749,17 +749,24 @@ func (s *Server) settingsDomains(ctx context.Context, acct *Account, app string,
if i, ok := have[strings.ToLower(c.Host)]; ok {
out[i].Claimed = true
out[i].State, out[i].Reason, out[i].Detail = state(c)
+ if c.Regional() && len(s.cfg.RegionIngress) > 0 {
+ out[i].Guidance, out[i].Detail = s.configuredRegionalGuidance(ctx, c)
+ }
if c.Pending {
- out[i].Guidance = verifyGuidance(s.domainChallenge(c.Host, c.Account))
+ proof := verifyGuidance(s.domainChallenge(c.Host, c.Account))
+ if c.Regional() && len(s.cfg.RegionIngress) > 0 {
+ out[i].Guidance = strings.TrimSpace(proof + " " + out[i].Guidance)
+ } else {
+ out[i].Guidance = proof
+ }
}
continue
}
dv := claimDomainView(c.Host, s.dnsTargets(ctx))
+ dv.State, dv.Reason, dv.Detail = state(c)
if c.Regional() {
- // Not the single-edge advice: see domainItem.
- dv.Guidance = regionalDNSGuidance(c.Host)
+ dv.Guidance, dv.Detail = s.configuredRegionalGuidance(ctx, c)
}
- dv.State, dv.Reason, dv.Detail = state(c)
if c.Pending {
// The proof comes first: until it is published nothing else on
// the row can take effect (#215).
diff --git a/internal/console/regioningress.go b/internal/console/regioningress.go
new file mode 100644
index 000000000..fbba4ce9c
--- /dev/null
+++ b/internal/console/regioningress.go
@@ -0,0 +1,31 @@
+package console
+
+import (
+ "fmt"
+ "net"
+ "strings"
+)
+
+// ParseRegionIngress accepts only IP literals; it never resolves names. A
+// malformed nonempty configuration must stop startup, rather than re-enable
+// legacy folding of group members' public addresses.
+func ParseRegionIngress(raw string) ([]string, error) {
+ if strings.TrimSpace(raw) == "" {
+ return nil, nil
+ }
+ var out []string
+ seen := map[string]bool{}
+ for _, token := range strings.Split(raw, ",") {
+ token = strings.TrimSpace(token)
+ ip := net.ParseIP(token)
+ if ip == nil {
+ return nil, fmt.Errorf("CONSOLE_REGION_INGRESS must contain comma-separated IP addresses. %s is not a valid IP address.", token)
+ }
+ canonical := ip.String()
+ if !seen[canonical] {
+ seen[canonical] = true
+ out = append(out, canonical)
+ }
+ }
+ return out, nil
+}
diff --git a/internal/console/regioningress_test.go b/internal/console/regioningress_test.go
new file mode 100644
index 000000000..4d769b8e3
--- /dev/null
+++ b/internal/console/regioningress_test.go
@@ -0,0 +1,504 @@
+package console
+
+import (
+ "context"
+ "encoding/json"
+ "net/http"
+ "reflect"
+ "strings"
+ "testing"
+ "time"
+
+ "github.com/carlosframework/platform/internal/domains"
+ "github.com/carlosframework/platform/internal/provision"
+)
+
+const ingressIP = "192.0.2.90"
+const ingressDetail = "Regional placement details are not available in this view."
+
+func ingressMessage(host string) string {
+ return "Placement readiness for " + host + " is unavailable here. For DNS, use the configured public ingress addresses: " + ingressIP + "."
+}
+
+func TestRegionIngressParsing(t *testing.T) {
+ for _, tc := range []struct {
+ raw string
+ want []string
+ bad string
+ }{
+ {"", nil, ""}, {" \t ", nil, ""},
+ {" 192.0.2.1,2001:0DB8:0:0::1,192.0.2.1,2001:db8::1 ", []string{"192.0.2.1", "2001:db8::1"}, ""},
+ {"192.0.2.1,", nil, ""}, {",", nil, ""}, {"edge.example.com", nil, "edge.example.com"},
+ {"https://192.0.2.1", nil, "https://192.0.2.1"}, {"192.0.2.1:80", nil, "192.0.2.1:80"},
+ {"[2001:db8::1]:443", nil, "[2001:db8::1]:443"}, {"2001:db8::1%eth0", nil, "2001:db8::1%eth0"}, {"bad", nil, "bad"},
+ } {
+ t.Run(tc.raw, func(t *testing.T) {
+ got, err := ParseRegionIngress(tc.raw)
+ invalid := tc.bad != "" || tc.raw == "," || tc.raw == "192.0.2.1,"
+ if invalid {
+ if err == nil || got != nil {
+ t.Fatalf("parse %q = %v, %v", tc.raw, got, err)
+ }
+ token := tc.bad
+ want := "CONSOLE_REGION_INGRESS must contain comma-separated IP addresses. " + token + " is not a valid IP address."
+ if err.Error() != want {
+ t.Fatalf("error = %q; want %q", err, want)
+ }
+ return
+ }
+ if err != nil || !reflect.DeepEqual(got, tc.want) {
+ t.Fatalf("parse = %v, %v; want %v", got, err, tc.want)
+ }
+ })
+ }
+}
+
+func TestConfiguredIngressSuppressesMemberIPs(t *testing.T) {
+ calls := 0
+ s := &Server{cfg: Config{EdgeIPs: []string{"192.0.2.1", "192.0.2.1"}, RegionIngress: []string{ingressIP, "192.0.2.1"}}, foldEdgeIPs: func(context.Context) []string { calls++; return []string{"203.0.113.10", "203.0.113.20"} }}
+ for i := 0; i < 2; i++ {
+ if got := s.dnsTargets(context.Background()).EdgeIPs; !reflect.DeepEqual(got, []string{"192.0.2.1", ingressIP}) {
+ t.Fatalf("DNS union = %v", got)
+ }
+ }
+ if calls != 0 {
+ t.Fatalf("configured DNS folded %d times", calls)
+ }
+ s.cfg.RegionIngress = nil
+ s.cfg.EdgeIPs = []string{"192.0.2.1"}
+ for i := 0; i < 2; i++ {
+ if got := s.dnsTargets(context.Background()).EdgeIPs; len(got) != 3 {
+ t.Fatal(got)
+ }
+ }
+ if calls != 1 {
+ t.Fatalf("legacy fold calls = %d", calls)
+ }
+}
+
+func TestConfiguredIngressSuppressesSteering(t *testing.T) {
+ s := &Server{cfg: Config{RegionIngress: []string{ingressIP}}, steeringHost: "edge.example.net"}
+ for _, host := range []string{"example.com", "shop.example.com", "example.co.uk"} {
+ targets := s.dnsTargets(context.Background())
+ got := domainGuidance(host, targets)
+ want := "Point an A record for " + host + " at " + ingressIP + ". Checks run every few minutes."
+ if isApexDomain(host) {
+ want = host + " is an apex domain and cannot use a CNAME. Point its A record at the configured public ingress addresses: " + ingressIP + ". Checks run every few minutes."
+ }
+ if got != want || targets.SteeringHost != "" {
+ t.Fatalf("guidance = %q / %+v, want %q", got, targets, want)
+ }
+ for _, r := range domainRecords(host, targets, false, "") {
+ if r.Type != "A" || r.Value != ingressIP {
+ t.Fatalf("record = %+v", r)
+ }
+ }
+ }
+}
+
+func TestIngressDoesNotWidenProxyTrust(t *testing.T) {
+ s := &Server{cfg: Config{EdgeIPs: []string{"192.0.2.1"}, RegionIngress: []string{ingressIP}}}
+ for host, want := range map[string]bool{ingressIP: false, "192.0.2.1": true, "127.0.0.1": true, "::1": true, "203.0.113.1": false} {
+ if got := s.trustsProxy(host); got != want {
+ t.Errorf("trust %s = %v", host, got)
+ }
+ }
+}
+
+func TestConfiguredIngressMultiRegion(t *testing.T) {
+ w := newRegionalWorld(t, "ingress-multi")
+ w.fx.srv.cfg.RegionIngress = []string{ingressIP}
+ w.fx.srv.cfg.HARegions = []string{"ie"}
+ for _, st := range []bool{false, true} {
+ if st {
+ w.fx.srv.cfg.Releases = assetEdgesFailStore{Store: w.fx.rel}
+ }
+ if got := w.fx.srv.dnsTargets(context.Background()).EdgeIPs; !reflect.DeepEqual(got, []string{ingressIP}) {
+ t.Fatalf("HA and non-HA EIPs folded: %v", got)
+ }
+ }
+}
+
+func requireIngressRefusal(t *testing.T, code int, out, host string) {
+ t.Helper()
+ requireRefusal(t, "configured placements", code, out, http.StatusConflict, ingressMessage(host))
+ for _, bad := range []string{`"placements"`, `"ready"`, "203.0.113.10", "203.0.113.20"} {
+ if strings.Contains(out, bad) {
+ t.Fatalf("refusal contains %q: %s", bad, out)
+ }
+ }
+}
+
+func TestConfiguredIngressPlacements(t *testing.T) {
+ for _, mode := range []string{"regional-active", "regional-active-later", "regional-immutable", "single-empty-home", "single-explicit-home", "single-immutable", "single-first-route"} {
+ t.Run(mode, func(t *testing.T) {
+ w := newRegionalWorld(t, "ingress-"+mode)
+ w.fx.srv.cfg.RegionIngress = []string{ingressIP}
+ w.fx.srv.cfg.HARegions = []string{"ie"}
+ host := rdHost
+ switch mode {
+ case "regional-active":
+ w.putRegionalWorldClaim(t, time.Now())
+ case "regional-active-later":
+ w.putRegionalWorldClaim(t, time.Now())
+ w.fx.srv.cfg.HARegions = []string{"uk"}
+ case "regional-immutable":
+ w.putRegionalWorldClaim(t, time.Now())
+ markHA(t, w.fx.rel, w.fx.sqid, "shop", rdUK)
+ w.fx.srv.cfg.HARegions = nil
+ case "single-first-route":
+ host = "first.example.com"
+ w.putRecord(t, w.fx.sqid, "shop", host, "", nil)
+ attachShopClaim(t, w.fx, w.fx.sqid, "shop", host, "")
+ default:
+ route := rdIE
+ if mode == "single-explicit-home" {
+ route = "explicit.example.net"
+ w.putRecord(t, w.fx.sqid, "shop", route, "ie", nil)
+ }
+ if mode == "single-immutable" {
+ markHA(t, w.fx.rel, w.fx.sqid, "shop", rdIE)
+ w.fx.srv.cfg.HARegions = nil
+ }
+ attachShopClaim(t, w.fx, w.fx.sqid, "shop", host, route)
+ }
+ st := newRDStore(w.fx.rel)
+ if mode == "regional-active-later" {
+ st.failGet[provision.RecordKey(w.fx.sqid, "shop", rdIE)] = true
+ }
+ w.fx.srv.cfg.Releases = st
+ code, _, out := rawReq(t, http.MethodGet, placementsURL(w.fx, "shop", host), w.token, "")
+ requireIngressRefusal(t, code, out, host)
+ st.mu.Lock()
+ defer st.mu.Unlock()
+ if len(st.puts) > 0 {
+ t.Fatalf("GET writes: %v", st.puts)
+ }
+ })
+ }
+ for _, immutable := range []bool{false, true} {
+ t.Run(map[bool]string{false: "put-active", true: "put-immutable"}[immutable], func(t *testing.T) {
+ w := newRegionalWorld(t, "ingress-put")
+ w.fx.srv.cfg.RegionIngress = []string{ingressIP}
+ w.fx.srv.cfg.HARegions = []string{"ie"}
+ if immutable {
+ markHA(t, w.fx.rel, w.fx.sqid, "shop", rdIE)
+ w.fx.srv.cfg.HARegions = nil
+ }
+ st := newRDStore(w.fx.rel)
+ w.fx.srv.cfg.Releases = st
+ code, out := w.put(t, rdHost, rdBoth())
+ requireIngressRefusal(t, code, out, rdHost)
+ w.requireNoClaim(t, rdHost, "refusal")
+ st.mu.Lock()
+ defer st.mu.Unlock()
+ if len(st.puts) > 0 {
+ t.Fatalf("PUT wrote claim/index/serial: %v", st.puts)
+ }
+ })
+ }
+ t.Run("legacy-and-non-ha-success", func(t *testing.T) {
+ w := newRegionalWorld(t, "ingress-legacy")
+ w.fx.srv.cfg.HARegions = []string{"ie"}
+ w.mustPut(t, rdHost, rdBoth())
+ getPlacementsRegionalIngressOK(t, w)
+ w.fx.srv.cfg.RegionIngress = []string{ingressIP}
+ w.fx.srv.cfg.HARegions = nil
+ getPlacementsRegionalIngressOK(t, w)
+ w.mustPut(t, rdHost, rdSet("uk="+rdUK))
+ })
+ t.Run("drop-old-ha", func(t *testing.T) {
+ w := newRegionalWorld(t, "ingress-drop")
+ w.putRegionalWorldClaim(t, time.Now())
+ markHA(t, w.fx.rel, w.fx.sqid, "shop", rdIE)
+ w.fx.srv.cfg.RegionIngress = []string{ingressIP}
+ w.fx.srv.cfg.HARegions = []string{"ie"}
+ // Existing binding validation lists records once. The new guard must not read old targets again.
+ st := newRDStore(w.fx.rel)
+ w.fx.srv.cfg.Releases = st
+ w.mustPut(t, rdHost, rdSet("uk="+rdUK))
+ st.mu.Lock()
+ defer st.mu.Unlock()
+ n := 0
+ for _, key := range st.gets {
+ if key == provision.RecordKey(w.fx.sqid, "shop", rdIE) {
+ n++
+ }
+ }
+ if n > 1 {
+ t.Fatalf("old target reread %d times", n)
+ }
+ })
+ t.Run("stranger-neutral", func(t *testing.T) {
+ w := newRegionalWorld(t, "ingress-stranger")
+ w.fx.srv.cfg.RegionIngress = []string{ingressIP}
+ w.fx.srv.cfg.HARegions = []string{"ie"}
+ attachShopClaim(t, w.fx, "other", "shop", rdHost, rdIE)
+ c, _, b := rawReq(t, http.MethodGet, placementsURL(w.fx, "shop", rdHost), w.token, "")
+ nc, _, nb := rawReq(t, http.MethodGet, placementsURL(w.fx, "shop", "missing.example.com"), w.token, "")
+ if c != nc || b != nb || c != 404 {
+ t.Fatalf("stranger %d %s vs %d %s", c, b, nc, nb)
+ }
+ })
+}
+func getPlacementsRegionalIngressOK(t *testing.T, w *regionalWorld) {
+ t.Helper()
+ c, _, b := rawReq(t, http.MethodGet, placementsURL(w.fx, "shop", rdHost), w.token, "")
+ if c != 200 || !strings.Contains(b, `"placements"`) {
+ t.Fatalf("legacy = %d %s", c, b)
+ }
+}
+
+func TestConfiguredIngressDeletedTarget(t *testing.T) {
+ for _, active := range []bool{false, true} {
+ t.Run(map[bool]string{false: "inactive", true: "active"}[active], func(t *testing.T) {
+ w := newRegionalWorld(t, "ingress-deleted")
+ w.putRegionalWorldClaim(t, time.Now())
+ w.fx.srv.cfg.RegionIngress = []string{ingressIP}
+ if active {
+ w.fx.srv.cfg.HARegions = []string{"ie"}
+ }
+ if err := w.fx.rel.Delete(context.Background(), provision.RecordKey(w.fx.sqid, "shop", rdIE)); err != nil {
+ t.Fatal(err)
+ }
+ w.putBox(t, rdBox("annie", "", "203.0.113.10"))
+ c, _, b := rawReq(t, http.MethodGet, placementsURL(w.fx, "shop", rdHost), w.token, "")
+ if active {
+ requireIngressRefusal(t, c, b, rdHost)
+ } else if c != 200 || !strings.Contains(b, reasonNoServingBox) {
+ t.Fatalf("missing target = %d %s", c, b)
+ }
+ checkIngressRows(t, w, active, nil)
+ })
+ }
+}
+
+// checkIngressRows drives list, detail and settings, checking row-local fallback and single-mode records.
+func checkIngressRows(t *testing.T, w *regionalWorld, blocked bool, st *rdStore) {
+ t.Helper()
+ want, detail := regionalDNSGuidance(rdHost), regionalStateDetail
+ if blocked {
+ want, detail = ingressMessage(rdHost), ingressDetail
+ }
+ for _, path := range []string{domainsURL(w.fx, w.fx.sqid, "shop"), domainGetURL(w.fx, w.fx.sqid, "shop", rdHost)} {
+ if st != nil {
+ st.mu.Lock()
+ st.gets = nil
+ st.mu.Unlock()
+ }
+ c, _, b := rawReq(t, http.MethodGet, path, w.token, "")
+ if c != 200 {
+ t.Fatalf("domain read = %d %s", c, b)
+ }
+ var out map[string]any
+ if err := json.Unmarshal([]byte(b), &out); err != nil {
+ t.Fatal(err)
+ }
+ if out["deployment"] == nil {
+ t.Fatalf("deployment lost: %s", b)
+ }
+ var rows []any
+ if ds, ok := out["domains"].([]any); ok {
+ rows = ds
+ } else {
+ rows = []any{out["domain"]}
+ }
+ found := false
+ for _, raw := range rows {
+ row := raw.(map[string]any)
+ if row["host"] == rdHost {
+ found = true
+ if row["guidance"] != want || row["detail"] != detail {
+ t.Fatalf("row = %v; want %q / %q", row, want, detail)
+ }
+ }
+ if row["host"] == "healthy.example.com" && (row["guidance"] != regionalDNSGuidance("healthy.example.com") || row["detail"] != regionalStateDetail) {
+ t.Fatalf("healthy regional sibling = %v", row)
+ }
+ if row["host"] == "plain.example.com" && (row["records"] == nil || !strings.Contains(row["guidance"].(string), ingressIP)) {
+ t.Fatalf("single row = %v", row)
+ }
+ }
+ if !found {
+ t.Fatal("regional row lost")
+ }
+ }
+ acct, err := w.fx.st.AccountBySqid(w.fx.sqid)
+ if err != nil {
+ t.Fatal(err)
+ }
+ views := w.fx.srv.settingsDomains(withReqMemo(context.Background()), acct, "shop", nil)
+ found := false
+ for _, dv := range views {
+ if dv.Domain == rdHost {
+ found = true
+ if dv.Guidance != want || dv.Detail != detail {
+ t.Fatalf("settings = %+v", dv)
+ }
+ }
+ }
+ if !found {
+ t.Fatal("settings row lost")
+ }
+ // The app's assembled view may already contain the claimed domain.
+ existing := w.fx.srv.settingsDomains(withReqMemo(context.Background()), acct, "shop", []DomainView{{Domain: rdHost, Guidance: "stale"}})
+ for _, dv := range existing {
+ if dv.Domain == rdHost && (dv.Guidance != want || dv.Detail != detail) {
+ t.Fatalf("existing settings row = %+v", dv)
+ }
+ }
+}
+
+func TestConfiguredIngressTargetReadFailure(t *testing.T) {
+ w := newRegionalWorld(t, "ingress-read-failure")
+ w.putRegionalWorldClaim(t, time.Now())
+ w.fx.srv.cfg.RegionIngress = []string{ingressIP}
+ attachShopClaim(t, w.fx, w.fx.sqid, "shop", "plain.example.com", rdUK)
+ healthy := domains.Claim{Host: "healthy.example.com", Account: w.fx.sqid, App: "shop", Route: rdUK, CreatedAt: time.Now().UTC().Format(time.RFC3339), Placements: []domains.Placement{{Region: "uk", Host: rdUK}}}
+ if _, err := domains.SetClaimPlacements(context.Background(), w.fx.rel, healthy, nil, ""); err != nil {
+ t.Fatal(err)
+ }
+ st := newRDStore(w.fx.rel)
+ st.failGet[provision.RecordKey(w.fx.sqid, "shop", rdIE)] = true
+ w.fx.srv.cfg.Releases = st
+ c, _, b := rawReq(t, http.MethodGet, placementsURL(w.fx, "shop", rdHost), w.token, "")
+ requireRefusal(t, "read failure", c, b, 503, placementsUnreadableMsg)
+ checkIngressRows(t, w, true, st)
+}
+
+func TestConfiguredIngressSingleRowsDoNotReadTargets(t *testing.T) {
+ w := newRegionalWorld(t, "ingress-single-reads")
+ markHA(t, w.fx.rel, w.fx.sqid, "shop", rdIE)
+ attachShopClaim(t, w.fx, w.fx.sqid, "shop", rdHost, rdIE)
+ w.fx.srv.cfg.RegionIngress = []string{ingressIP}
+ w.fx.srv.cfg.HARegions = []string{"ie"}
+ st := newRDStore(w.fx.rel)
+ st.failGet[provision.RecordKey(w.fx.sqid, "shop", rdIE)] = true
+ w.fx.srv.cfg.Releases = st
+ for _, path := range []string{domainsURL(w.fx, w.fx.sqid, "shop"), domainGetURL(w.fx, w.fx.sqid, "shop", rdHost)} {
+ c, _, b := rawReq(t, http.MethodGet, path, w.token, "")
+ if c != 200 || !strings.Contains(b, `"records"`) || !strings.Contains(b, "Point an A record") {
+ t.Fatalf("single = %d %s", c, b)
+ }
+ }
+ acct, _ := w.fx.st.AccountBySqid(w.fx.sqid)
+ w.fx.srv.settingsDomains(withReqMemo(context.Background()), acct, "shop", nil)
+ st.mu.Lock()
+ defer st.mu.Unlock()
+ for _, key := range st.gets {
+ if key == provision.RecordKey(w.fx.sqid, "shop", rdIE) {
+ t.Fatal("single-mode target read")
+ }
+ }
+}
+
+func TestConfiguredIngressRegionalSinks(t *testing.T) {
+ for _, immutable := range []bool{false, true} {
+ t.Run(map[bool]string{false: "active", true: "immutable"}[immutable], func(t *testing.T) {
+ w := newRegionalWorld(t, "ingress-sinks")
+ w.putRegionalWorldClaim(t, time.Now())
+ w.fx.srv.cfg.RegionIngress = []string{ingressIP}
+ if immutable {
+ markHA(t, w.fx.rel, w.fx.sqid, "shop", rdUK)
+ } else {
+ w.fx.srv.cfg.HARegions = []string{"ie"}
+ }
+ attachShopClaim(t, w.fx, w.fx.sqid, "shop", "plain.example.com", rdIE)
+ checkIngressRows(t, w, true, nil)
+ })
+ }
+}
+
+func TestConfiguredIngressMemoAndProof(t *testing.T) {
+ w := newRegionalWorld(t, "ingress-memo")
+ w.fx.srv.delegationZone = "acme.example.org"
+ w.putRegionalWorldClaim(t, time.Now())
+ w.fx.srv.cfg.RegionIngress = []string{ingressIP}
+ c := *w.claim(t, rdHost)
+ c.Host = "second.example.com"
+ c.Pending = true
+ c.Wildcard = true
+ // Preserve the proof and delegation fields while changing only regional DNS guidance.
+ st := newRDStore(w.fx.rel)
+ w.fx.srv.cfg.Releases = st
+ st.failGet[provision.RecordKey(w.fx.sqid, "shop", rdUK)] = true
+ ctx := withReqMemo(context.Background())
+ for _, host := range []string{rdHost, c.Host} {
+ claim := c
+ claim.Host = host
+ item := w.fx.srv.domainItem(ctx, claim, nil, nil, w.fx.srv.dnsTargets(ctx), time.Now(), false)
+ if item.Detail != ingressDetail || !strings.Contains(item.Guidance, ingressMessage(host)) {
+ t.Fatalf("row = %+v", item)
+ }
+ if len(item.Records) != 2 || item.Records[0].Set != "acme" || item.Records[1].Set != "verify" {
+ t.Fatalf("proof/delegation lost: %+v", item.Records)
+ }
+ }
+ st.mu.Lock()
+ defer st.mu.Unlock()
+ for _, host := range []string{rdIE, rdUK} {
+ n := 0
+ for _, key := range st.gets {
+ if key == provision.RecordKey(w.fx.sqid, "shop", host) {
+ n++
+ }
+ }
+ if n != 1 {
+ t.Fatalf("target %s read %d times, want once including failure", host, n)
+ }
+ }
+}
+
+func TestConfiguredIngressTeamScopeNeutrality(t *testing.T) {
+ w := newTeamWorld(t, "ingress-team")
+ w.fx.srv.cfg.RegionIngress = []string{ingressIP}
+ w.fx.srv.cfg.HARegions = []string{w.fx.srv.cfg.HomeRegion, "ie"}
+ putRegionalClaim(t, w.fx.rel, rdHost, "bab", "titogo", "mine.go.tito.io", false, false)
+ st := newRDStore(w.fx.rel)
+ w.fx.srv.cfg.Releases = st
+ nc, _, nb := rawReq(t, http.MethodGet, w.url("/domains/missing.example.com"), w.team, "")
+ c, _, b := rawReq(t, http.MethodGet, w.url("/domains/"+rdHost+"/placements"), w.team, "")
+ if c != 404 || c != nc || b != nb {
+ t.Fatalf("team = %d %s; missing = %d %s", c, b, nc, nb)
+ }
+ st.mu.Lock()
+ defer st.mu.Unlock()
+ for _, key := range st.gets {
+ if strings.Contains(key, "/instances/") {
+ t.Fatalf("out-of-scope target read %s", key)
+ }
+ }
+}
+
+func TestConfiguredIngressPendingTakeoverIgnoresOldTargets(t *testing.T) {
+ w := newRegionalWorld(t, "ingress-takeover")
+ foreign := domains.Claim{Schema: 1, Host: rdHost, Account: "other", App: "other", Route: "secret.example.net", Pending: true, CreatedAt: time.Now().Add(-48 * time.Hour).Format(time.RFC3339)}
+ raw, err := json.Marshal(foreign)
+ if err != nil {
+ t.Fatal(err)
+ }
+ putFixtureObject(t, w.fx.rel, domains.ClaimKey(rdHost), raw)
+ w.fx.srv.cfg.RegionIngress = []string{ingressIP}
+ w.fx.srv.cfg.HARegions = []string{"ie"}
+ st := newRDStore(w.fx.rel)
+ w.fx.srv.cfg.Releases = st
+ w.mustPut(t, rdHost, rdSet("uk="+rdUK))
+ st.mu.Lock()
+ defer st.mu.Unlock()
+ for _, key := range st.gets {
+ if strings.Contains(key, "secret.example.net") {
+ t.Fatalf("read pending owner's target %s", key)
+ }
+ }
+}
+
+func TestConfiguredIngressPlacementsPublicUnion(t *testing.T) {
+ w := newRegionalWorld(t, "ingress-public-union")
+ w.putRegionalWorldClaim(t, time.Now())
+ w.fx.srv.cfg.RegionIngress = []string{ingressIP, "192.0.2.1"}
+ w.fx.srv.cfg.EdgeIPs = []string{"192.0.2.1"}
+ w.fx.srv.cfg.HARegions = []string{"ie"}
+ code, _, out := rawReq(t, http.MethodGet, placementsURL(w.fx, "shop", rdHost), w.token, "")
+ want := "Placement readiness for shop.example.com is unavailable here. For DNS, use the configured public ingress addresses: 192.0.2.1, 192.0.2.90."
+ requireRefusal(t, "public union", code, out, 409, want)
+}
diff --git a/internal/console/server.go b/internal/console/server.go
index 02e93c86c..b6f64bc34 100644
--- a/internal/console/server.go
+++ b/internal/console/server.go
@@ -663,6 +663,9 @@ type Config struct {
// point-your-DNS-here guidance. nil is legal: guidance then says
// "this deployment's edge IP" instead of inventing an address.
EdgeIPs []string
+ // RegionIngress is the complete deployment-wide public DNS ingress set.
+ // It never grants proxy trust. Nonempty disables all live-box folding.
+ RegionIngress []string
// SecretsPub is the deployment's CARLOS_SECRETS_PUBKEY, served (never
// used) by the CLI config door so `carlos secrets set` can seal
// client-side with `carlos auth login` alone. Public material by
@@ -1564,20 +1567,26 @@ func (s *Server) chrome(p *page) {
// point DNS. ctx is the caller's request: a fold refresh it waits for is
// counted against that request (see foldedEdgeIPs).
func (s *Server) dnsTargets(ctx context.Context) DNSTargets {
+ if len(s.cfg.RegionIngress) > 0 {
+ return DNSTargets{EdgeIPs: s.edgeIPs(ctx), ConfiguredIngress: true}
+ }
return DNSTargets{EdgeIPs: s.edgeIPs(ctx), SteeringHost: s.steeringHost}
}
-// edgeIPs is the deployment's edge addresses as this console will tell a
-// member to point at: the operator's configured list UNIONED with the live
-// fold, configured addresses first.
-//
-// Union, not replacement, in both directions. A console whose bucket read
-// fails still offers PLATFORM_EDGE_IPS rather than none — an empty guidance
-// string is worse than a partial one. And a multi-region deployment's other
-// edges appear even though this console's env var predates them, which is
-// the whole point: the same set the domains reconcile pass now judges
-// "pointing" against, so guidance and verdict cannot disagree.
+// edgeIPs is the DNS address union. Configured ingress is deployment-wide:
+// it suppresses every box file, including non-HA regions. Agents must already
+// recognize this public set through PLATFORM_EDGE_IPS before it is enabled.
+// Unset ingress preserves the legacy fold and its shared cache.
func (s *Server) edgeIPs(ctx context.Context) []string {
+ if len(s.cfg.RegionIngress) > 0 {
+ var out []string
+ for _, ip := range append(append([]string(nil), s.cfg.EdgeIPs...), s.cfg.RegionIngress...) {
+ if !slices.Contains(out, ip) {
+ out = append(out, ip)
+ }
+ }
+ return out
+ }
out := append([]string(nil), s.cfg.EdgeIPs...)
for _, ip := range s.foldedEdgeIPs(ctx) {
if ip != "" && !slices.Contains(out, ip) {
diff --git a/internal/console/server_test.go b/internal/console/server_test.go
index 60db93aa7..53a58ee41 100644
--- a/internal/console/server_test.go
+++ b/internal/console/server_test.go
@@ -1662,13 +1662,13 @@ func TestDomainGuidanceSteering(t *testing.T) {
{"unsteered, no edge IPs", "kass.training", DNSTargets{},
"Point an A record for kass.training at this deployment's edge IP. Checks run every few minutes."},
{"steered subdomain is offered the CNAME", "www.kass.training", steered,
- "Point a CNAME for www.kass.training at edge.oncarlos.com — visitors then reach the nearest healthy edge, and a failed edge is withdrawn automatically. An A record at 203.0.113.7, 198.51.100.9 works too, but round-robins without latency bias. Checks run every few minutes."},
+ "Point a CNAME for www.kass.training at edge.oncarlos.com. The steering service chooses a healthy edge. An A record for www.kass.training at 203.0.113.7, 198.51.100.9 also works. It distributes requests across the listed edges without choosing by location. Checks run every few minutes."},
{"steered apex keeps A records, honestly", "kass.training", steered,
"Point an A record for kass.training at 203.0.113.7, 198.51.100.9. kass.training is an apex domain and cannot carry a CNAME, so its A records round-robin across the edges without latency bias. Checks run every few minutes."},
{"multi-label public suffix is still an apex", "kass.co.uk", steered,
"Point an A record for kass.co.uk at 203.0.113.7, 198.51.100.9. kass.co.uk is an apex domain and cannot carry a CNAME, so its A records round-robin across the edges without latency bias. Checks run every few minutes."},
{"three labels under a plain TLD is a subdomain", "app.kass.co.uk", steered,
- "Point a CNAME for app.kass.co.uk at edge.oncarlos.com — visitors then reach the nearest healthy edge, and a failed edge is withdrawn automatically. An A record at 203.0.113.7, 198.51.100.9 works too, but round-robins without latency bias. Checks run every few minutes."},
+ "Point a CNAME for app.kass.co.uk at edge.oncarlos.com. The steering service chooses a healthy edge. An A record for app.kass.co.uk at 203.0.113.7, 198.51.100.9 also works. It distributes requests across the listed edges without choosing by location. Checks run every few minutes."},
}
for _, c := range cases {
t.Run(c.name, func(t *testing.T) {
diff --git a/internal/console/view.go b/internal/console/view.go
index a53c7ef02..e38f57ed6 100644
--- a/internal/console/view.go
+++ b/internal/console/view.go
@@ -9,6 +9,7 @@ import (
"crypto/ed25519"
"encoding/json"
"errors"
+ "fmt"
"log"
"os"
"sort"
@@ -159,19 +160,11 @@ func (d DomainView) Explain() string {
// only on a deployment that STEERS (multi-region ingress spec, Part 4) —
// the steering hostname a non-apex host may CNAME to instead.
type DNSTargets struct {
- // EdgeIPs is PLATFORM_EDGE_IPS unioned with the deployment's live fold
- // of every box's edges file (Server.edgeIPs). nil is legal: guidance
- // then says "this deployment's edge IP" rather than inventing an
- // address.
- //
- // Once a deployment steers, this list must name EVERY armed edge's EIP,
- // not just the local box's: the DNS check that stamps "pointing"
- // compares a resolved address against it, and a steered name resolves
- // to whichever edge the resolver is nearest. The fold is what makes
- // that true without the operator re-setting an env var on every box
- // each time a region arms — and it is the SAME fold the domains
- // reconcile pass judges "pointing" with, so what a member is told to do
- // and what the platform then grades them on cannot drift apart.
+ // ConfiguredIngress suppresses legacy steering and names the public union.
+ ConfiguredIngress bool
+ // EdgeIPs is the DNS-only union chosen by Server.edgeIPs: static public
+ // ingress when configured, otherwise PLATFORM_EDGE_IPS plus live boxes.
+ // nil retains the legacy generic guidance.
EdgeIPs []string
// SteeringHost is the deployment's steering hostname (edge.<apps-domain>,
// itself latency-routed with one record per armed edge). "" — every
@@ -180,22 +173,10 @@ type DNSTargets struct {
SteeringHost string
}
-// domainGuidance is the point-your-DNS-here instruction a custom host that
-// is not pointing at this deployment yet gets shown — shared by domainView
-// (a routed custom host) and claimDomainView (a claim with no route yet), so
-// the two rows never drift into different wording for the same instruction.
-//
-// With steering armed the CNAME is the RECOMMENDED form for a subdomain:
-// it inherits the steering hostname's latency records and its health
-// checks, so visitors reach the nearest healthy edge and a dead edge stops
-// being handed out within ~90s. An apex cannot carry a CNAME at all (the
-// spec's honesty rule, Part 4: "apexes cannot CNAME, so apex guidance
-// remains A-records-to-all-EIPs — round-robin without latency bias,
-// documented as such in attach guidance"), so an apex is told the truth
-// about what its A records do rather than being offered an impossible
-// option. Apex-ness is decided by the public suffix list, not by counting
-// labels: "example.co.uk" is an apex and "app.example.com" is not, and both
-// have three.
+// domainGuidance is shared by routed and claim-only custom domains. Ingress
+// mode uses only the configured public A-record union; legacy steering still
+// offers a CNAME for subdomains. The public suffix list decides apexes, where
+// a CNAME cannot coexist with the zone's SOA and NS records.
func domainGuidance(host string, t DNSTargets) string {
target := "this deployment's edge IP"
if len(t.EdgeIPs) > 0 {
@@ -203,14 +184,16 @@ func domainGuidance(host string, t DNSTargets) string {
}
aRecord := "Point an A record for " + host + " at " + target + "."
switch {
+ case t.ConfiguredIngress:
+ if isApexDomain(host) {
+ return fmt.Sprintf("%s is an apex domain and cannot use a CNAME. Point its A record at the configured public ingress addresses: %s. Checks run every few minutes.", host, target)
+ }
case t.SteeringHost == "":
// No steering: exactly the sentence this deployment has always shown.
case isApexDomain(host):
aRecord += " " + host + " is an apex domain and cannot carry a CNAME, so its A records round-robin across the edges without latency bias."
default:
- aRecord = "Point a CNAME for " + host + " at " + t.SteeringHost +
- " — visitors then reach the nearest healthy edge, and a failed edge is withdrawn automatically." +
- " An A record at " + target + " works too, but round-robins without latency bias."
+ aRecord = fmt.Sprintf("Point a CNAME for %s at %s. The steering service chooses a healthy edge. An A record for %s at %s also works. It distributes requests across the listed edges without choosing by location.", host, t.SteeringHost, host, target)
}
return aRecord + " Checks run every few minutes."
}