Skip to content

feat(uds)!: csi.aether.io is the only UDS socket carrier — emptyDir carrier removed (proposal 039 Phase 2, BREAKING, chart 2.0.0) - #1092

Merged
bpalermo merged 2 commits into
mainfrom
feat/039-uds-csi-phase2
Sep 30, 2026
Merged

bpalermo merged 2 commits into
mainfrom
feat/039-uds-csi-phase2

Conversation

@bpalermo

Copy link
Copy Markdown
Owner

Proposal 039 Phase 2: the breaking cut-over of UDS delivery (proposal 034) from the kubelet emptyDir carrier to the csi.aether.io CSI carrier that Phase 1 shipped in #1090. It is one PR, a hard cut-over, with no coexistence, no compatibility flag and no deprecation window (owner decision 2026-09-27/30).

What breaks

  • A UDS workload's socket volume must be csi: {driver: csi.aether.io}, and the pod must set securityContext.fsGroup. An emptyDir is no longer a carrier.

  • Removed:

    • udspath.Resolve (the kubernetes.io~empty-dir resolver);
    • the agent's --kubelet-pods-dir, replaced by --uds-csi-root (default /run/aether/uds);
    • the proxy's /var/lib/kubelet/pods hostPath mount;
    • the chart value proxy.udsWorkloads.
  • udsCsi.enabled now defaults to true. That one switch covers:

    • the plugin DaemonSet and the CSIDriver;
    • the agent's --uds-csi-root;
    • the proxy's read-only mount of udsCsi.root;
    • the agent's EndpointPolicy RBAC.

    On nodes with no UDS workloads the plugin is an idle DaemonSet requesting 5m CPU and 16Mi memory.

  • Chart versions: aether 2.0.0 (major bump for the breaking change), crds 1.1.0 (the EndpointPolicy description changed), udsecho 2.0.0 (moved to the CSI carrier).

Operator migration

Every UDS workload must switch before the chart upgrade, or in the same rollout:

spec:
  securityContext: {fsGroup: 65532}   # new, required
  volumes:
    - name: s
      csi: {driver: csi.aether.io}    # was: emptyDir: {}

A workload that misses the switch is not deleted:

  • New pods carrying the annotation are denied at admission, and the message names the fix.
  • Running pods, and pods declared by an EndpointPolicy, fall back to TCP. A UDS-only app then stays unpromoted, and each one is counted as aether_agent_uds_resolve_failures_total{reason="not_csi"}.

The runbook has the steps under §7 Upgrading to chart 2.0.0 (find-affected commands and a post-upgrade check), and the reason table under §8. For talos-main, charts/udsecho (the soak's UDS workloads) is migrated in this PR. It has to be upgraded together with aether 2.0.0; that is Phase 3.

What changed

  • CNIPod gains three fields, all recorded by enhanceCNIPod and persisted so storage replay needs no API server:

    • uds_csi_volume = 12, as specified;
    • volumes = 13;
    • uds_csi_volumes = 14.

    Deviation from the plan: with only the volume name, the agent cannot tell not_csi (the volume is an emptyDir) from volume_not_declared, or a pod with two carriers from a pod with none.

  • udspath.ResolveCSI(udsRoot, podUID, csiVolume, request) resolves to <root>/<uid>/<file>. It also takes the CSI volume name, which it needs in order to require volume == uds_csi_volume.

    • udspath.ResolvePod adds not_csi and multiple_csi_volumes.
    • Every failure is a typed Reason.
  • aether.agent.uds.resolve_failures{reason}:

    • Reasons: not_csi, volume_not_declared, bad_file, path_too_long, multiple_csi_volumes, no_uid, bad_request, disabled.
    • Every reason is seeded at 0.
    • Counted and logged once per pod per reason, because delivery clusters are rebuilt on every policy change.
    • The fallback is TCP, as before, so 034's failure semantics are unchanged.
  • Admission. The /mutate pod webhook denies, for mesh-managed pods:

    • a uds-socket annotation whose volume is not the pod's csi.aether.io volume (for example an emptyDir);
    • a socket file over the byte budget;
    • a csi.aether.io volume without fsGroup;
    • two csi.aether.io volumes.

    The EndpointPolicy webhook checks the CSI byte budget. Precedence and other CRD semantics are unchanged.

  • Chart.

    • udsCsi.root is the single source of truth: it renders the plugin's --root, the agent's --uds-csi-root and the proxy mount.
    • New helm template tests: default-on renders the DaemonSet and CSIDriver, the agent gets --uds-csi-root, and the proxy mounts uds-root readOnly with HostToContainer.
    • Also asserted: no /var/lib/kubelet anywhere in the proxy or agent templates; the root override moves all three paths together; udsCsi.enabled=false renders none of them and passes --uds-csi-root=.
  • Docs.

    • Proposal 034 gets a supersession note.
    • Proposal 039 is marked Phase 2 implemented, with a Phase 2 as built section.
    • The CSI contract replaces the emptyDir one in configuration, workload-requirements, runbook (upgrade note and reason table), getting-started, README and CLAUDE.md.

Read-only proxy mount: verified on kind

I chose an explicit udsCsi.root mount on the proxy: readOnly: true, mountPropagation: HostToContainer. It is the only root the proxy mounts. The proposal said no new mount was needed, because /run/aether already covers the default root; the explicit mount still works if udsCsi.root moves elsewhere.

Kernel check (kind node, kernel 6.8), in a private mount namespace:

--- per-mount flags of the view we connect through ---
4549 4518 0:951 / /tmp/rotest/robind ro,relatime - tmpfs tmpfs rw,inode64
--- (1) read-only BIND mount (MS_RDONLY on the mount, the proxy's readOnly: true) ---
connect OK via /tmp/rotest/robind/app.sock -> pong
--- control: creating a file through the same view ---
touch: cannot touch '/tmp/rotest/robind/x': Read-only file system
--- (2) read-only SUPERBLOCK (remount the tmpfs itself ro) ---
connect OK via /tmp/rotest/src/app.sock -> pong
--- (3) socket inode mode 0000: root still connects (CAP_DAC_OVERRIDE) ---
connect OK via /tmp/rotest/robind/app.sock -> pong

connect(2) checks write permission on the socket inode, and root passes. The read-only flag (sb_permission/EROFS) only gates regular files, directories and symlinks. The comment in the 034-era chart claimed a read-only mount makes connect fail with EROFS. That was wrong, and the comment is removed.

Envoy's own mount view on kind (/proc/<envoy>/mountinfo):

3925 3903 0:96 /aether/uds /run/aether/uds ro,relatime master:972 - tmpfs tmpfs rw,mode=755,inode64
3406 3925 0:617 / /run/aether/uds/45058e1b-… rw,nosuid,nodev,noexec,relatime,nosymfollow master:1263 - tmpfs tmpfs rw,size=1024k,mode=2770,gid=65532,inode64
  • There are 0 /var/lib/kubelet entries (R2).
  • The per-pod tmpfs mounts propagate in as clones that keep their own flags, including nosymfollow. readOnly only stops the proxy creating anything in the root directory itself.
  • Delivery (a) and (b) are green through this view.

Byte budget

udspath.MaxFileLen = MaxPipePathLen (107) − len(DefaultCSIRoot) (15) − 1 − PodUIDLen (36) − 1 = 54

It is derived from constants, and TestMaxFileLen pins it at 54. The volume name is no longer part of the path. Admission checks the budget exactly: default root, worst-case 36-byte UID. The agent re-checks against its own --uds-csi-root.

Evidence

Unit gates: red without the code, then green

With the budget check, the enhanceCNIPod recording, the resolve-failure reporting, the pod-webhook call and the EndpointPolicy ValidateRequest each removed:

//agent/internal/cni/server:server_test                  FAILED
//agent/internal/xds/cache:cache_test                    FAILED
//common/udspath:udspath_test                            FAILED
//controller/internal/endpointpolicy:endpointpolicy_test FAILED
//controller/internal/podmutate:podmutate_test           FAILED
--- FAIL: TestAddPod_UDSCarrierSurvivesStorageReplay
--- FAIL: TestAddPod_UDSFallsBackToTCP
--- FAIL: TestEnhanceCNIPod_RecordsUDSCarrier
--- FAIL: TestMutator_UDSCarrier
--- FAIL: TestResolveCSI_PathLength
--- FAIL: TestResolveCSI_Rejections
--- FAIL: TestUDSResolveFailure_Recovery
--- FAIL: TestUDSResolveFailure_ReportedOncePerPodPerReason
--- FAIL: TestUDSServicePolicy_EmptyDirVolumeIsNotCSI
--- FAIL: TestValidate
--- FAIL: TestValidateRequest

All of them pass once the code is restored:

(g)/(h) red on origin/main

A kind cluster built from origin/main, running the new (g)/(h) legs (with otel.enabled=true, so the agent's exporter was on and served 69 aether_agent_* series):

✗ a pod declaring its UDS socket on an emptyDir was ADMITTED (pod webhook not in the path, or not checking the carrier): pod/legacy-carrier created
✗ no agent exports aether_agent_uds_resolve_failures_total{reason="volume_not_declared"} — the counter must be seeded (a zero, not an absent series)
legacy-echo (emptyDir via policy) on main: 200

e2e/uds.sh on this branch (a–h, full build + up + verify)

✓ uds-echo served over its Unix socket (HTTP 200, body from the UDS app; it binds no TCP port)
✓ uds-cr-echo served over the socket declared by its EndpointPolicy (HTTP 200)
✓ uds-echo keeps serving (3/3 checks): the pod annotation wins over the service-scoped policy
✓ over-budget EndpointPolicy rejected … is 108 bytes, over the 107-byte AF_UNIX limit: shorten the socket file name (at most 54 bytes under /run/aether/uds)
✓ EndpointPolicy with targetRef.kind=ConfigMap rejected
✓ tcp-echo stopped serving (503): the endpoint is unpromoted … — not blackholed
✓ uds-echo and uds-cr-echo keep serving: the bad policy affected only its own service
✓ tcp-echo recovered (HTTP 200) once the policy was removed
✓ netconf otlp_endpoint pinned to the ClusterIP / the collector received aether.cni.operations / no resolver errors
✓ emptyDir-carrier pod denied, naming the fix: admission webhook "ndots.pods.aether.io" denied the request: endpoint.aether.io/uds-socket="s/a.sock" cannot be delivered (not_csi): … change the volume's source to `csi: {driver: csi.aether.io}` and set the pod's securityContext.fsGroup
✓ aether_agent_uds_resolve_failures_total{reason="volume_not_declared"} is exported (= 0 before the drift below)
✓ resolve_failures{reason="not_csi"} = 1
✓ the agent logged the refusal once for the pod (reason not_csi, pod legacy-echo-*)
✓ legacy-echo is not delivered (503): the endpoint stays unpromoted, the 034 failure semantics
✓ resolve_failures{reason="volume_not_declared"} = 1
✓ tcp-echo keeps serving over TCP (3/3): an unresolvable policy never reaches the data plane
==> all assertions passed

e2e/uds-csi.sh also passes (i–iv) on the same images.

Notes on the e2e changes

  • In (e), the drift target tcp-echo now mounts an unused csi.aether.io volume, so the drifting policy still reaches the data plane. A policy naming an undeclared volume now never resolves; that case is covered in (h).
  • uds.sh installs with otel.enabled=true and no endpoint, so the agent's Prometheus exporter is on.
  • The kind e2e workflow needed only comment changes: it already loads the uds-csi image.

🤖 Generated with Claude Code

https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr

bpalermo and others added 2 commits September 30, 2026 20:23
…the emptyDir carrier is removed (proposal 039 Phase 2)

BREAKING CHANGE: UDS delivery (proposal 034) no longer reads sockets out of
an emptyDir through the kubelet's pod-volumes tree. A workload's socket volume
must be an inline `csi: {driver: csi.aether.io}` volume and the pod must set
securityContext.fsGroup. Removed: the emptyDir resolver (udspath.Resolve), the
agent's --kubelet-pods-dir, the proxy's /var/lib/kubelet/pods hostPath mount
and the chart's proxy.udsWorkloads value. udsCsi.enabled now defaults to true.
A pod still declaring an emptyDir socket is denied at admission; a running or
policy-declared one falls back to TCP (unpromoted), counted as
aether.agent.uds.resolve_failures{reason="not_csi"}. Chart 2.0.0.

- CNIPod gains uds_csi_volume (12), volumes (13) and uds_csi_volumes (14),
  recorded by enhanceCNIPod and persisted, so storage replay resolves without
  the API server and every failure is attributable.
- udspath.ResolveCSI / ResolvePod: <uds-csi-root>/<uid>/<file>, classified
  Reasons, a 54-byte file budget derived from constants (MaxFileLen).
- aether.agent.uds.resolve_failures{reason}: seeded at zero per reason,
  counted and logged once per pod per reason.
- Admission: the /mutate pod webhook denies an emptyDir (or undeclared)
  carrier, a file over budget, a csi.aether.io volume without fsGroup, and
  two of them; the EndpointPolicy webhook checks the CSI budget.
- Chart: --uds-csi-root and the proxy's read-only HostToContainer mount both
  render from udsCsi.root; crds 1.1.0 (docs), udsecho 2.0.0 (CSI carrier).
- e2e/uds.sh: every leg on the CSI carrier, plus (g) emptyDir pod denied and
  (h) not_csi / volume_not_declared counted.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
@bpalermo
bpalermo merged commit 75caf0f into main Sep 30, 2026
24 checks passed
@bpalermo
bpalermo deleted the feat/039-uds-csi-phase2 branch September 30, 2026 23:35
bpalermo added a commit that referenced this pull request Oct 1, 2026
) (#1117)

Status Implemented: Phase 1 (#1090) and Phase 2 (#1092, chart 2.0.0)
shipped; Phase 3 complete except the node reboot (#1106). Phase 0a
(#1083) was not run and is recorded as superseded; the confused-deputy
finding stays as the motivation, with what now prevents it. Adds a
Phase 3 as-built section (deploy, first 8 h soak, plugin roll under
load), the #1111 inode cap and #1112 soak harness follow-ups, the
second-volume_id rejection superseded by the admission webhook, and
034 Phase 2 as unblocked but deferred (also in 034's supersession note).


Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr

Co-authored-by: Claude Fable 5.1 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant