| index 4dd9ef44a..089d7f78d 100644 |
| --- a/internal/status/snapshot.go |
| +++ b/internal/status/snapshot.go |
| @@ -159,6 +159,13 @@ type Probes struct { |
| // than guess at a mode. Hostname-keyed, like Aliases and RouteVersions |
| // above, which is why it lands in Box.Metrics and nowhere else. |
| Layout *LayoutReport |
| + // FlatExec is the box's flat-exec policy report (sidecar isolation D12 |
| + // to D15): the policy in force, its spawn record and the inventory of |
| + // what refuse would stop, built by the caller from the same routes it |
| + // listed for Layout. nil means no policy is armed (no agent on this |
| + // box), carried through as nothing to report. Hostname-bearing, so it |
| + // lands in Box.Metrics and nowhere else. |
| + FlatExec *FlatExecReport |
| // ConfigRefusals is the instances this box is CURRENTLY refusing to take |
| // because it cannot provide their config (amadan #213), as the host's |
| // config guard reports them; nil when it refuses nothing. They land in |
| @@ -251,6 +258,69 @@ type LayoutReport struct { |
| // box whose Mode is none. Both additive; an old reader ignores them. |
| Default bool `json:"default,omitempty"` |
| DefaultBlocked string `json:"default_blocked,omitempty"` |
| + // Workers is the box's workers readiness (sidecar isolation D11, D14), |
| + // one of the closed words nested, off, waiting_for_prev, blocked: |
| + // whether this agent mints and moves worker rows nested. "nested" only |
| + // when the start-time readiness holds, the effective intent is nested, |
| + // the nested gate answers and claim mode is off; "blocked" is the |
| + // readiness holding while one of the other three does not, with |
| + // WorkersReason saying which (a private diagnostic, never member |
| + // text). Both additive and omitted by a box that predates them. |
| + Workers string `json:"workers,omitempty"` |
| + WorkersReason string `json:"workers_reason,omitempty"` |
| +} |
| + |
| +// FlatExecReport is the box's flat-exec policy and what it has done or |
| +// would do (sidecar isolation D12 to D15). PRIVATE, like everything under |
| +// Box.Metrics: Refusals and Inventory name real hosts. |
| +// |
| +// Mode is the policy in force, refuse or report, and Allow the exact hosts |
| +// CARLOS_FLAT_EXEC_ALLOW names; Dropped is the entries it named that were |
| +// not valid host shapes, so an operator sees a typo. Intent is the box's |
| +// effective layout intent with its source, one of the closed words |
| +// nested, flat_choice, flat_fallback, unknown. Refusals is the spawn |
| +// record: per host, the last refusal or would-be refusal. Inventory is |
| +// what refuse would stop, read from the registry at this snapshot (R4-3): |
| +// every row the agent could spawn through a seam that classifies flat or |
| +// foreign and is not allowlisted, awake or asleep; InventoryUnknown says |
| +// why it could not be computed, and an unknown inventory is never empty |
| +// and never closed. FlatWorkers counts the worker rows classifying flat. |
| +// Closed is D15's closure check: refuse in force, an empty allowlist, the |
| +// inventory known, and no worker row flat or foreign. |
| +type FlatExecReport struct { |
| + Mode string `json:"mode"` |
| + Allow []string `json:"allow,omitempty"` |
| + Dropped []string `json:"dropped,omitempty"` |
| + Intent string `json:"intent"` |
| + Refusals []FlatExecRefusal `json:"refusals,omitempty"` |
| + Inventory []FlatExecRow `json:"inventory,omitempty"` |
| + InventoryUnknown string `json:"inventory_unknown,omitempty"` |
| + FlatWorkers int `json:"flat_workers"` |
| + Closed bool `json:"closed"` |
| +} |
| + |
| +// FlatExecRefusal is one host's last refusal or would-be refusal under the |
| +// flat-exec policy (D14), the shape ConfigRefusal has: Reason is a closed |
| +// word (flat_refused, foreign_refused, flat_reported, foreign_reported), |
| +// never error text; Since is the first record in this stretch, Last the |
| +// most recent, Count how many spawns were refused or reported. PRIVATE: |
| +// Host is a real route name. |
| +type FlatExecRefusal struct { |
| + Host string `json:"host"` |
| + Reason string `json:"reason"` |
| + Since time.Time `json:"since"` |
| + Last time.Time `json:"last"` |
| + Count int `json:"count"` |
| +} |
| + |
| +// FlatExecRow is one row of the flat-exec inventory (D14): a host the |
| +// policy would refuse, its layout word (flat or foreign), and whether it |
| +// is a worker row, which the closure check counts. PRIVATE: Host is a |
| +// real route name. |
| +type FlatExecRow struct { |
| + Host string `json:"host"` |
| + Layout string `json:"layout"` |
| + Worker bool `json:"worker,omitempty"` |
| } |
| |
| // ConfigRefusal is one host this box is refusing to take because it cannot |
| @@ -598,6 +668,13 @@ type BoxMetrics struct { |
| // never reach the public fleet.json. nil (the field absent) means the |
| // box has no layout pass armed, not "every route reports flat". |
| Layout *LayoutReport `json:"layout,omitempty"` |
| + // FlatExec is Probes.FlatExec carried straight through: the box's |
| + // flat-exec policy, spawn record and inventory (sidecar isolation D14), |
| + // hostname-bearing and private for the identical reason Layout is. |
| + // nil (absent) means no policy is armed on the box, which no agent at |
| + // or above this release leaves it, so an old box is told apart from a |
| + // box under report. |
| + FlatExec *FlatExecReport `json:"flat_exec,omitempty"` |
| // ConfigRefusals is the hosts this box is refusing to take because it |
| // cannot provide their config (amadan #213). It is how an operator sees |
| // that a box is keyless, or holds the wrong key, without reading its |
| @@ -1043,7 +1120,7 @@ func CollectBox(routes []registry.Route, p Probes, now time.Time) Box { |
| p.DiskFreeBytes != nil || p.Release != "" || p.Tunnel != "" || |
| p.InstanceID != "" || p.Platform != "" || p.SystemChannel != "" || p.System != nil || |
| len(routeVersions) > 0 || len(routeServing) > 0 || len(aliasReadings) > 0 || len(p.Upstreams) > 0 || |
| - len(routeDBBytes) > 0 || p.Layout != nil || len(p.ConfigRefusals) > 0 || len(p.ReleaseRefusals) > 0 || len(p.ProofWaits) > 0 || p.Rollout != nil || p.ConfigGuard != "" || |
| + len(routeDBBytes) > 0 || p.Layout != nil || p.FlatExec != nil || len(p.ConfigRefusals) > 0 || len(p.ReleaseRefusals) > 0 || len(p.ProofWaits) > 0 || p.Rollout != nil || p.ConfigGuard != "" || |
| p.Alerts != nil || p.GeoIP != nil || len(p.BuildStates) > 0 || p.BuildStatesErr != "" || |
| p.UpdateSettings != 0 || len(p.Updates) > 0 { |
| box.Metrics = &BoxMetrics{ |
| @@ -1076,6 +1153,7 @@ func CollectBox(routes []registry.Route, p Probes, now time.Time) Box { |
| Upstreams: p.Upstreams, |
| RouteDBBytes: routeDBBytes, |
| Layout: p.Layout, |
| + FlatExec: p.FlatExec, |
| // A fresh copy: the guard's own slice is its to mutate. |
| ConfigRefusals: append([]ConfigRefusal(nil), p.ConfigRefusals...), |
| ConfigRefusalsTotal: p.ConfigRefusalsTotal, |