Repository navigation
perf(proxy): ship the supervisor as its own 15 MiB binary instead of the 65 MiB agent (#772) - #790
Merged
Merged
Conversation
…#772) (B2) The aether-proxy pod ran the whole 65 MiB agent binary to supervise a child process. `agent proxy-supervisor` was a subcommand of //agent/cmd/agent, so the install-supervisor initContainer self-copied that binary onto the pod's shared volume and the proxy container ran it as PID 1 — controller-runtime, client-go, go-control-plane, SPIRE, Gateway API and miekg/dns, none of which it executes. Its real work (//agent/internal/proxy/hotrestart + //common/readymarker) needs 24 modules and no Kubernetes, no xDS, no SPIRE. That cost is paid in Go package init(), which runs before main() is entered, on every supervisor start and every hot-restart epoch. #673 measured the same binary's init() at >=31% of this container's CPU when it was additionally re-exec'd as the readiness probe, and carved out //agent/cmd/proxy-ready for it. The supervisor was the remaining instance of the pattern. Measured (fastbuild, stripped; `go version -m` for modules; single-manifest zstd tarball for the image, so it is the real pull cost): binary //agent/cmd/proxy-supervisor 16,153,100 B (15.4 MiB), 24 modules //agent/cmd/agent 68,418,284 B (65.2 MiB), 105 modules -> -52,265,184 B (-49.8 MiB, -76.4%), -81 modules per proxy pod image proxy-supervisor 8,188,416 B (7.81 MiB) agent 22,928,384 B (21.87 MiB) -> -14,739,968 B (-14.06 MiB, -64.3%) What changed: - New //agent/cmd/proxy-supervisor binary; the cobra command moves to //agent/internal/supervisorcmd behind New(version), with per-call flag state instead of package-level vars so the binary and the alias cannot share it. The only heavy coupling was supervisor.go:56 `manager.SetupLogging` — its one heavy act (ctrl.SetLogger) is meaningless in a process with no controller-runtime manager, so it is `log.Named(log.NewLogger(debug), name)` from //common/log (0 external modules). Log output is unchanged. main.go uses //common/signals (#777) rather than ctrl.SetupSignalHandler(), same semantics. Every flag name and default is unchanged — the chart passes them literally. - `agent proxy-supervisor` is KEPT as a deprecated alias for one release. A forward rolling upgrade does not need it: the initContainer's image and the proxy container's command change atomically within one chart revision, and `supervisor-bin` is a per-pod emptyDir, so a surged-in successor stages its own binary and no old/new pair ever shares one. ROLLBACK does: `helm rollback` to a chart predating this re-issues `agent proxy-supervisor --install-path=…` against the deployed agent image, and without the alias that initContainer dies on "unknown command" and the rollback silently fails to take effect on the proxy DaemonSet — during an incident, which is when rollbacks happen. It costs nothing: hotrestart is agent-internal code the agent already linked, so the agent stays 105 modules / 65.2 MiB. The /proxy-ready tars_layer stays on the agent image for the same window; both are marked for removal together. - New multi-arch image //agent/cmd/proxy-supervisor:proxy-supervisor_image (ghcr.io/bpalermo/aether/proxy-supervisor), carrying /proxy-ready as an extra layer. container_structure_test asserts both binaries and the absence of /agent. Wired into //charts/aether AETHER_IMAGES (that alone digest-pins the values.yaml placeholder and publishes it — publish.yaml needs no new step), //tools/buildid:release_build_ids (it is PID 1 of the proxy container, so the continuous profiler needs its symbols under a unique build-ID), the Makefile load/push targets, and every kind harness that pre-loads images (e2e.yaml's image_load loop, docker save list, both kind load loops and both helm install lines; e2e/multicluster_{config,replicator,waypoint}.sh). - Chart: the initContainer runs `proxy.supervisor.image` with no subcommand argv, and the proxy container's command loses the `proxy-supervisor` word. proxy-ready is untouched, probe timings are untouched. The values.yaml note that this DaemonSet "is COUPLED TO THE AGENT IMAGE" is retired — it no longer is. Chart 0.92.21 -> 0.92.22. - Guards, because the whole value of this binary is what it does not link: //agent/cmd/proxy-supervisor:deps_test scans the linked ELF for controller-runtime / client-go / apimachinery / gateway-api / go-control-plane / go-spiffe / miekg-dns and enforces a 24 MiB bloat ceiling (with a control test that the scan is not vacuous); scripts/check-proxy-supervisor-deps.sh is the build-graph half, wired into ci.yaml and main.yaml beside the existing proxy-ready guard. //agent/internal/supervisorcmd:supervisorcmd_test gains TestFlagsCoverTheChartContract, which reads the actual DaemonSet template and asserts every flag the chart passes is defined — the split had to preserve them byte-for-byte, and the failure mode otherwise is the whole proxy fleet exiting on "unknown flag" at rollout time. Verification: `bazel build //... //test/e2e:e2e_test`; `bazel test //...` (107/107 pass); `bazel run //:format.check`; `bazel build --config=lint --@aspect_rules_lint//lint:fail_on_violation //...`; `bazel run //:gazelle` no churn; `bazel mod tidy` idempotent; `scripts/go-deps-audit.sh` exit 0; check-proxy-ready-deps.sh and check-proxy-supervisor-deps.sh both OK; //tools/buildid:release_build_ids all-distinct. `helm template` before/after diffs exactly and only: the chart version label, the initContainer image (agent -> proxy-supervisor), the two removed `proxy-supervisor` argv words, and comments. Smoke-tested both entrypoints: the new binary self-installs 16 MiB, the alias warns and still self-installs 68 MiB. CLUSTER VALIDATION (data-path adjacent — the supervisor drives hot restarts). Needs a hitless proxy roll plus a delete-pod check on talos-main. Watch: - handoff duration per node (expect the usual 23-26 s; the 09-06 profiling pass measured a roll at exactly zero prober errors — anything above that is this change); - ready-marker transitions: the successor must HOLD readiness until it is the live epoch, so maxUnavailable:0 keeps the predecessor serving; - aether_supervisor_* counters keyed by k8s.node.name — no wedge, no unexpected epoch churn, and the OTLP push must still arrive (telemetry setup moved packages); - the external prober SLI across the roll: http_error and timeouts must stay at the no-roll baseline on both mesh and mesh_dns targets; - delete-pod: #771's --termination-grace fallback still drains Envoy when no successor can appear. The initContainer is the new failure surface: if the proxy-supervisor image is missing from the registry it CrashLoopBackOffs, and maxUnavailable:0 correctly keeps the old pods serving — check `kubectl -n aether-system describe ds aether-proxy` before concluding anything about the data path. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
bpalermo
force-pushed
the
perf/772-b2-proxy-supervisor-binary
branch
from
September 16, 2026 01:35
aed7722 to
4db5716
Compare
bpalermo
added a commit
that referenced
this pull request
Sep 20, 2026
#772/#790 split the hot-restart supervisor into its own image and its own chart value, `proxy.supervisor.image`, whose values.yaml defaults are release-time substitution placeholders. It updated the workflow and the three multicluster harnesses to build, kind-load and `--set` the new image -- but not e2e/uds.sh. So the placeholder went to the kubelet verbatim and the aether-proxy DaemonSet pod sat in Init:InvalidImageName, which is why the `uds` nightly job has answered 000000 for its very first assertion every night since 2026-09-16 while `waypoint` and `replicator` stayed green. Mirror the sibling harnesses exactly: proxy-supervisor in IMAGES, its :image_load target in build_images, and $(img proxy.supervisor proxy-supervisor) on the helm install. Fixes #860 Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr Co-authored-by: Claude Opus 5 <[email protected]>
bpalermo
added a commit
that referenced
this pull request
Sep 30, 2026
…lias, supervisor and mesh-dns --readiness-check (#1080) - Drop the `agent proxy-supervisor` alias (#772/#790) and the /proxy-ready layer on the agent image that only it read; the chart stages proxy-ready from the proxy-supervisor image. The agent image test now asserts /proxy-ready is absent, and a test pins the subcommand as retired. - Drop the supervisor's deprecated --readiness-check (#673/#775); replace TestDeprecatedFlagsStayRegistered with TestRetiredFlagsGone. - Drop mesh-dns's deprecated --readiness-check (#683), with a matching TestRetiredFlagsGone, and fix the stale meshdns.WithReadyMarker comment. - Update docs/configuration.md, CLAUDE.md, AGENTS.md and common/readymarker comments accordingly. charts/ is intentionally untouched. Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr Co-authored-by: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Phase B2 of #772 (dep-tree R3). Data-path adjacent: validated on talos-main with a hitless proxy roll + delete-pod check.
perf(proxy): split the hot-restart supervisor out of the agent binary (#772) (B2)
The aether-proxy pod ran the whole 65 MiB agent binary to supervise a child
process.
agent proxy-supervisorwas a subcommand of //agent/cmd/agent, so theinstall-supervisor initContainer self-copied that binary onto the pod's shared
volume and the proxy container ran it as PID 1 — controller-runtime, client-go,
go-control-plane, SPIRE, Gateway API and miekg/dns, none of which it executes.
Its real work (//agent/internal/proxy/hotrestart + //common/readymarker) needs
24 modules and no Kubernetes, no xDS, no SPIRE.
That cost is paid in Go package init(), which runs before main() is entered, on
every supervisor start and every hot-restart epoch. #673 measured the same
binary's init() at >=31% of this container's CPU when it was additionally
re-exec'd as the readiness probe, and carved out //agent/cmd/proxy-ready for it.
The supervisor was the remaining instance of the pattern.
Measured (fastbuild, stripped;
go version -mfor modules; single-manifestzstd tarball for the image, so it is the real pull cost):
binary //agent/cmd/proxy-supervisor 16,153,100 B (15.4 MiB), 24 modules
//agent/cmd/agent 68,418,284 B (65.2 MiB), 105 modules
-> -52,265,184 B (-49.8 MiB, -76.4%), -81 modules per proxy pod
image proxy-supervisor 8,188,416 B (7.81 MiB)
agent 22,928,384 B (21.87 MiB)
-> -14,739,968 B (-14.06 MiB, -64.3%)
What changed:
New //agent/cmd/proxy-supervisor binary; the cobra command moves to
//agent/internal/supervisorcmd behind New(version), with per-call flag state
instead of package-level vars so the binary and the alias cannot share it.
The only heavy coupling was supervisor.go:56
manager.SetupLogging— its oneheavy act (ctrl.SetLogger) is meaningless in a process with no
controller-runtime manager, so it is
log.Named(log.NewLogger(debug), name)from //common/log (0 external modules). Log output is unchanged. main.go uses
//common/signals (perf: drop controller-runtime from cni-install and prober (25→5 MiB, 40→15 MiB) via common/signals + slog (#772) #777) rather than ctrl.SetupSignalHandler(), same semantics.
Every flag name and default is unchanged — the chart passes them literally.
agent proxy-supervisoris KEPT as a deprecated alias for one release. Aforward rolling upgrade does not need it: the initContainer's image and the
proxy container's command change atomically within one chart revision, and
supervisor-binis a per-pod emptyDir, so a surged-in successor stages itsown binary and no old/new pair ever shares one. ROLLBACK does:
helm rollbackto a chart predating this re-issues
agent proxy-supervisor --install-path=…against the deployed agent image, and without the alias that initContainer
dies on "unknown command" and the rollback silently fails to take effect on
the proxy DaemonSet — during an incident, which is when rollbacks happen. It
costs nothing: hotrestart is agent-internal code the agent already linked, so
the agent stays 105 modules / 65.2 MiB. The /proxy-ready tars_layer stays on
the agent image for the same window; both are marked for removal together.
New multi-arch image //agent/cmd/proxy-supervisor:proxy-supervisor_image
(ghcr.io/bpalermo/aether/proxy-supervisor), carrying /proxy-ready as an extra
layer. container_structure_test asserts both binaries and the absence of
/agent. Wired into //charts/aether AETHER_IMAGES (that alone digest-pins the
values.yaml placeholder and publishes it — publish.yaml needs no new step),
//tools/buildid:release_build_ids (it is PID 1 of the proxy container, so the
continuous profiler needs its symbols under a unique build-ID), the Makefile
load/push targets, and every kind harness that pre-loads images (e2e.yaml's
image_load loop, docker save list, both kind load loops and both helm install
lines; e2e/multicluster_{config,replicator,waypoint}.sh).
Chart: the initContainer runs
proxy.supervisor.imagewith no subcommandargv, and the proxy container's command loses the
proxy-supervisorword.proxy-ready is untouched, probe timings are untouched. The values.yaml note
that this DaemonSet "is COUPLED TO THE AGENT IMAGE" is retired — it no longer
is. Chart 0.92.21 -> 0.92.22.
Guards, because the whole value of this binary is what it does not link:
//agent/cmd/proxy-supervisor:deps_test scans the linked ELF for
controller-runtime / client-go / apimachinery / gateway-api / go-control-plane
/ go-spiffe / miekg-dns and enforces a 24 MiB bloat ceiling (with a control
test that the scan is not vacuous); scripts/check-proxy-supervisor-deps.sh is
the build-graph half, wired into ci.yaml and main.yaml beside the existing
proxy-ready guard. //agent/internal/supervisorcmd:supervisorcmd_test gains
TestFlagsCoverTheChartContract, which reads the actual DaemonSet template and
asserts every flag the chart passes is defined — the split had to preserve
them byte-for-byte, and the failure mode otherwise is the whole proxy fleet
exiting on "unknown flag" at rollout time.
Verification:
bazel build //... //test/e2e:e2e_test;bazel test //...(107/107 pass);
bazel run //:format.check;bazel build --config=lint --@aspect_rules_lint//lint:fail_on_violation //...;bazel run //:gazellenochurn;
bazel mod tidyidempotent;scripts/go-deps-audit.shexit 0;check-proxy-ready-deps.sh and check-proxy-supervisor-deps.sh both OK;
//tools/buildid:release_build_ids all-distinct.
helm templatebefore/afterdiffs exactly and only: the chart version label, the initContainer image
(agent -> proxy-supervisor), the two removed
proxy-supervisorargv words, andcomments. Smoke-tested both entrypoints: the new binary self-installs 16 MiB,
the alias warns and still self-installs 68 MiB.
CLUSTER VALIDATION (data-path adjacent — the supervisor drives hot restarts).
Needs a hitless proxy roll plus a delete-pod check on talos-main. Watch:
pass measured a roll at exactly zero prober errors — anything above that is
this change);
live epoch, so maxUnavailable:0 keeps the predecessor serving;
unexpected epoch churn, and the OTLP push must still arrive (telemetry
setup moved packages);
at the no-roll baseline on both mesh and mesh_dns targets;
successor can appear.
The initContainer is the new failure surface: if the proxy-supervisor image is
missing from the registry it CrashLoopBackOffs, and maxUnavailable:0 correctly
keeps the old pods serving — check
kubectl -n aether-system describe ds aether-proxybefore concluding anything about the data path.🤖 Generated with Claude Code
https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr