Skip to content

feat(uds-csi): the csi.aether.io node plugin, its image and chart wiring (proposal 039 Phase 1) - #1090

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

bpalermo merged 3 commits into
mainfrom
feat/039-uds-csi-phase1

Conversation

@bpalermo

@bpalermo bpalermo commented Sep 30, 2026 •

Copy link
Copy Markdown
Owner

Note

The quay.io/aethermesh/uds-csi repository (public, release robot write) was created 2026-09-30, so //charts/aether:aether.push_images can publish the new image on merge.

What

Proposal 039 Phase 1: the csi.aether.io CSI node plugin, its uds-csi image and its charts/aether wiring. It ships off (udsCsi.enabled: false) and nothing consumes it yet. Phase 2, the breaking cut-over that makes it the only UDS carrier, is a later PR.

Design

Node plugin (agent/cmd/uds-csi, logic in agent/internal/udscsi). It is stateless and serves CSI Identity (GetPluginInfo, GetPluginCapabilities = none, Probe) and Node (NodeGetInfo, NodeGetCapabilities = VOLUME_MOUNT_GROUP, NodePublishVolume, NodeUnpublishVolume). It takes ephemeral inline volumes only and has no Controller service.

  • Publish: validate the request, then mount a fresh tmpfs at <root>/<pod-uid> (default /run/aether/uds) with MS_NOSUID|MS_NODEV|MS_NOEXEC|MS_NOSYMFOLLOW and data mode=2770,uid=0,gid=<volume_mount_group>,size=<bytes>, then bind it onto target_path. The plugin creates target_path if needed. The call is idempotent: if the target is already our tmpfs bind, it returns OK.
  • Rejections (all InvalidArgument, which the pod shows as FailedMount):
    • no volume_mount_group, i.e. the pod has no fsGroup. The message names the fix: set pod.spec.securityContext.fsGroup.
    • not ephemeral=true
    • a missing or malformed pod UID
    • any volumeAttributes
    • readonly
    • a block volume
    • a target_path outside <kubelet-root>/pods/<that-uid>/
  • Unpublish: unmount the target, remove it, lazily detach the per-pod tmpfs (MNT_DETACH) and rmdir it. Each step tolerates "already done". The pod UID comes from target_path, so the plugin keeps no state. The per-pod directory is derived from the kubelet-supplied pod UID only: never from the volume id, the volume name, or any other context value.
  • Mounter interface: every mount, unmount, mkdir and mountpoint check (via /proc/self/mountinfo) goes through it, using x/sys/unix directly (distroless has no mount). Unit tests use a fake and need no root.
  • Kubelet registration without node-driver-registrar:
    • api/aether/kubelet/pluginregistration/v1/api.proto is copied from k8s.io/kubelet and converted to edition 2023 with implicit presence, so the wire format is identical. The proto package stays pluginregistration, because the kubelet dials /pluginregistration.Registration/*. bazel/lint/buf.yaml scopes the naming-rule ignore_only to that one file.
    • The plugin serves Registration on <kubelet-root>/plugins_registry/csi.aether.io-reg.sock and CSI on <kubelet-root>/plugins/csi.aether.io/csi.sock.
    • GetInfo returns CSIPlugin / csi.aether.io / the CSI socket path / ["1.0.0"]. NotifyRegistrationStatus with an error logs it and ends Serve with that error, so the process exits 1.
    • At start the plugin removes stale socket files, but refuses to delete anything at a socket path that is not a socket. The CSI socket listens before the registration socket appears. On SIGTERM the registration socket is removed first.
  • Flags: --kubelet-root, --csi-socket, --registration-socket (both derived from the kubelet root), --node-id (defaults to $NODE_NAME), --root, --size, --debug, and --probe (the exec liveness probe: exit 0 iff the CSI socket exists). Flags are parsed with stdlib flag.
  • Small binary: ~11.4 MiB. //agent/cmd/uds-csi:deps_test checks the linked ELF and scripts/check-uds-csi-deps.sh checks the build graph. Both forbid controller-runtime, client-go, apimachinery, k8s.io/api, gateway-api, go-control-plane, go-spiffe, miekg/dns, cobra and the OTel SDK. The script is wired into ci.yaml and main.yaml next to the proxy-supervisor guard. SPIRE is not involved anywhere; the e2e runs with spire.enabled=false.

Why MS_NOSYMFOLLOW is a mount(2) flag and not mount_setattr. The first kind run used mount_setattr(MOUNT_ATTR_NOSYMFOLLOW) after the mount. The host's copy of the per-pod tmpfs came out rw,nosuid,nodev,noexec,relatime without nosymfollow, and root on the host followed a symlink the app had planted (cat /run/aether/uds/<uid>/link printed the node's hostname).

The cause: the plugin mounts in its own mount namespace, and the copy that Bidirectional propagation creates on the host keeps the flags the mount had when it propagated. A later mount_setattr only changes the plugin's own copy. The host copy is what the node proxy's HostToContainer /run/aether view clones.

So the flag now goes into mount(2) itself. On a kernel older than 5.10 that returns EINVAL, the plugin retries without it and logs a warning. The same run showed that the app's view does not carry per-mount flags: the container runtime re-binds target_path with flags it chooses, and the pod sees plain rw. Only the superblock options (size, mode, gid) reach the pod. That is enough, because the confused deputy is the proxy, so the e2e asserts the per-mount flags on the host.

Image: quay.io/aethermesh/uds-csi (proposal 040 naming). It is added to every place images are listed:

  • AETHER_IMAGES, so aether.push_images publishes it and signs it through the shared list
  • REGISTRY_IMAGE_COMPONENTS in scripts/registry-lib.sh
  • bazel/img _COMPONENTS
  • //tools/buildid:release_build_ids
  • Makefile (build-/load-/push-uds-csi-image, load-all, push-all)
  • the nightly e2e build artifact
  • the conformance and script-driven e2e IMAGES= lists and helm img overrides. These are inert while the plugin is off, and they pre-wire Phase 2's default flip.

The image uses the same distroless base as every aether image. The chart runs the container privileged with runAsUser: 0, the way it runs the agent, proxy and mesh-dns containers on that base.

publish-verify: with the ninth image, the sweep would have reported uds-csi MISSING for every push head in the day before this merge. The verifier now reads REGISTRY_IMAGE_COMPONENTS as of each commit (registry_image_components_at, in registry-lib.sh), the same way it already reads registry.bzl and chart versions per commit. The expected-red control counts per base the same way. Harness counts are 20 → 22 lines and 12 → 13 witnesses. check-publish-verify-control.sh passes 20/20, check-registry-lookup.sh 43/43, check-registry-config.sh OK and check-proxy-pin.sh 27/27.

Chart (charts/aether, 1.0.15 → 1.0.16):

  • uds-csi-daemonset.yaml:
    • privileged, root, readOnlyRootFilesystem, drop: [ALL]
    • Bidirectional on <kubeletRoot>/pods and on udsCsi.root
    • hostPath == mountPath for pods, plugins/csi.aether.io and plugins_registry
    • system-node-critical, maxSurge: 0 / maxUnavailable: 1
    • the aether.io/agent-not-ready toleration plus udsCsi.tolerations
    • agent ServiceAccount with automountServiceAccountToken: false (no RBAC)
    • liveness /uds-csi --probe
  • uds-csi-csidriver.yaml: attachRequired: false, podInfoOnMount: true, volumeLifecycleModes: [Ephemeral], fsGroupPolicy: File, requiresRepublish: false, seLinuxMount: false.
  • Values: udsCsi.{enabled (false), image, kubeletRoot (/var/lib/kubelet; Talos uses the default), root, size (1Mi), debug, nodeSelector, tolerations, resources}. The chart fails a non-absolute kubeletRoot or root.
  • Tests:
    • default off renders nothing. This needed a new helm_template_absent_test rule in bazel/helm/defs.bzl, with a control string so an empty render cannot pass, and it was seen red by flipping the default.
    • enabled renders the DaemonSet with Bidirectional on both mounts and the CSIDriver with fsGroupPolicy: File and podInfoOnMount.
    • kubeletRoot moves the flag, the hostPaths and the mountPaths together.
    • a relative kubeletRoot is refused.
  • Docs: docs/configuration.md (the udsCsi values and the uds-csi flags), proposal 039 (Phase 1 implemented, Phase 2 pending, with a Phase 1 as built section), and CLAUDE.md.

Tests: seen red, then green

Unit, //agent/internal/udscsi:udscsi_test. With the fsGroup check replaced by a gid 0 fallback, and OnFailure never called:

--- FAIL: TestNodePublishVolume_NoFsGroupFailsWithTheFix (0.00s)
        Error:      	An error is expected but got nil.
--- FAIL: TestRegistration_KubeletErrorEndsServe (5.02s)
    serve_test.go:125: Serve kept running after the kubelet reported a registration error

With the real code both pass, plus the rest:

  • exact mode=2770,uid=0,gid=65532,size=1048576 and flags MS_NOSUID|MS_NODEV|MS_NOEXEC|MS_NOSYMFOLLOW
  • InvalidArgument for non-ephemeral, and for each other rejection
  • idempotent publish and unpublish
  • the pod dir is never derived from the volume id or any context value
  • a kernel without MS_NOSYMFOLLOW retries without it
  • GetInfo fields, then NodeGetInfo on the endpoint it names, over a real UDS
  • the registration-error exit path
  • stale-socket handling
  • the mountinfo parser

bazel test --config=race //agent/internal/udscsi:all is green.

Kind, e2e/uds-csi.sh, against mutant images built from this branch:

  • Registration not served where the kubelet looks:
    ==> (i) the kubelet registered csi.aether.io through the plugin's own registration socket
      ✗ CSINode uds-csi-control-plane lists [] — the kubelet never registered csi.aether.io
    
  • fsGroup check disabled. The pod mounted with gid 0, the app crash-looped, and no FailedMount was raised:
    ==> (iii) a pod WITHOUT an fsGroup is refused with a FailedMount naming the fix
      ✗ no FailedMount event on pod no-fsgroup (uid 7ef5e5b8-…) within 120s
    
    Before that run, this assertion passed vacuously against the mutant: it matched events by pod name, and an hour-old FailedMount from the previous run's same-named pod satisfied it. It now matches involvedObject.uid and also requires that no container ever started.
  • mount_setattr instead of MS_NOSYMFOLLOW:
      ✗ host mount /run/aether/uds/24767881-… lacks nosymfollow: '… rw,nosuid,nodev,noexec,relatime shared:1429 - tmpfs tmpfs rw,size=1024k,mode=2770,gid=65532,inode64'
    

Green on the real image:

==> (i) the kubelet registered csi.aether.io through the plugin's own registration socket
  ✓ CSINode uds-csi-control-plane lists: csi.aether.io
  ✓ CSIDriver csi.aether.io: fsGroupPolicy=File podInfoOnMount=true volumeLifecycleModes=[Ephemeral]
  ✓ no node-driver-registrar sidecar (containers: uds-csi)
==> (ii) a pod with fsGroup 65532 gets a mesh-owned per-pod tmpfs
  ✓ with-fsgroup: /s is mode 2770, group 65532 (stat: 2770 65532)
  ✓ with-fsgroup: /s is the plugin's tmpfs (tmpfs /s tmpfs rw,relatime,size=1024k,mode=2770,gid=65532,inode64 0 0)
  ✓ with-fsgroup: the nonroot app bound /s/a.sock (group 65532) and it answers: served-by-with-fsgroup pod=with-fsgroup socket=/s/a.sock path=/
  ✓ host: /run/aether/uds/6c410c99-… is the pod's tmpfs (2770, gid 65532, holds a.sock), mounted rw,nosuid,nodev,noexec,relatime,nosymfollow
  ✓ host: a symlink the app planted is not followed (Too many levels of symbolic links)
  ✓ with-fsgroup deleted: the host tmpfs /run/aether/uds/6c410c99-… is unmounted and removed
==> (iii) a pod WITHOUT an fsGroup is refused with a FailedMount naming the fix
  ✓ pod no-fsgroup (uid a842fb7c-…) is Pending, no container started; FailedMount: csi.aether.io needs the pod's fsGroup to own the socket directory, and this pod has none: set pod.spec.securityContext.fsGroup
==> (iv) a rollout restart of the plugin re-registers and still publishes
  ✓ after the roll CSINode uds-csi-control-plane still lists: csi.aether.io
  ✓ after-roll: /s is mode 2770, group 65532 (stat: 2770 65532)
  ✓ after-roll: … tmpfs … size=1024k,mode=2770,gid=65532
  ✓ after-roll: the nonroot app bound /s/a.sock (group 65532) and it answers
  ✓ host: … mounted rw,nosuid,nodev,noexec,relatime,nosymfollow
  ✓ host: a symlink the app planted is not followed (Too many levels of symbolic links)
  ✓ after-roll deleted: the host tmpfs … is unmounted and removed
==> all assertions passed

A nightly uds-csi job in e2e.yaml runs the same script.

Also green locally:

  • bazel test //... --test_tag_filters=-integration: 152/152
  • bazel build --config=lint --@aspect_rules_lint//lint:fail_on_violation //... (buf, buildifier, shellcheck, gocognit)
  • make deps-audit OK. The CSI spec is a direct require, github.com/container-storage-interface/spec v1.13.0, added with bazel run @rules_go//go get + bazel mod tidy.
  • make gazelle and make format leave no diff
  • scripts/check-uds-csi-deps.sh OK
  • //agent/cmd/uds-csi:image_test (container structure) passes

Not in this PR

  • Phase 2: the agent resolver, CNIPod.uds_csi_volume, removing the emptyDir carrier, flipping the default.
  • Rejecting a second, different volume_id for the same pod UID (proposal text). It needs state; a second volume of one pod reuses that pod's tmpfs.
  • A root-only mount unit test in the kernel-gate lane. The kind leg exercises the real mounts end to end.

🤖 Generated with Claude Code

https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr

…ing (proposal 039 Phase 1)

A stateless CSI node plugin (Identity + Node, ephemeral inline volumes only)
that gives a UDS-served pod a mesh-owned socket directory: on
NodePublishVolume it mounts a fresh tmpfs at /run/aether/uds/<pod-uid>
(nosuid,nodev,noexec,nosymfollow, mode=2770,uid=0,gid=<fsGroup>, size cap)
and binds it onto the kubelet's target path. A pod without an fsGroup is
refused with InvalidArgument (FailedMount naming the fix). The per-pod
directory is derived from the kubelet-supplied pod UID only; unpublish
recovers it from target_path, so the plugin keeps no state.

The plugin serves the kubelet's plugin-registration API itself (a copy of
k8s.io/kubelet's pluginregistration/v1 api.proto, edition 2023, package kept
as `pluginregistration`), so there is no node-driver-registrar sidecar. A
kubelet-reported registration error exits the process non-zero.

MS_NOSYMFOLLOW is passed to mount(2) rather than applied with a later
mount_setattr(2): the plugin mounts in its own mount namespace and the host
copy made by Bidirectional propagation keeps the flags the mount had when it
propagated. Seen on kind: with mount_setattr the host mount lacked
nosymfollow and followed a symlink the app planted.

- agent/cmd/uds-csi + agent/internal/udscsi (Mounter interface; unit tests
  against a fake need no root; registration tested over a real UDS)
- //agent/cmd/uds-csi:deps_test + scripts/check-uds-csi-deps.sh (CI): no
  client-go, controller-runtime, apimachinery, SPIRE or go-control-plane
- image quay.io/aethermesh/uds-csi, added to every image enumeration
  (chart images, registry-lib, build IDs, Makefile, e2e); publish-verify
  now reads the image component list as of each commit, so heads that
  predate uds-csi are not reported MISSING
- charts/aether: udsCsi values (default OFF), uds-csi-daemonset.yaml,
  uds-csi-csidriver.yaml (fsGroupPolicy File, podInfoOnMount), chart 1.0.16,
  helm template tests incl. a new helm_template_absent_test rule
- e2e/uds-csi.sh + nightly uds-csi job: CSINode registration, publish,
  host-side nosymfollow, unpublish, fsGroup refusal, plugin roll

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
@bpalermo
bpalermo force-pushed the feat/039-uds-csi-phase1 branch from c85e20c to 3c9bf67 Compare September 30, 2026 21:49
bpalermo and others added 2 commits September 30, 2026 18:52
Resolve docs/proposals/039_uds-csi-driver.md against #1084's decisions:
keep main's decision text verbatim, add the Phase 1 implementation line
under it, and cut "Phase 1 as built" down to the departures from the
design (MS_NOSYMFOLLOW at mount time, registration-error exit path,
validation details, value names, gate).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
Resolve docs/configuration.md against #1081's docs refresh: keep main's
new `identity-ready` CLI section verbatim and follow it with the
`uds-csi` section (the two were inserted at the same point). CLAUDE.md
and docs/runbook.md merged cleanly.

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

Proposal 039 designs the per-pod tmpfs with size=<small>,nr_inodes=<small>;
Phase 1 as built (#1090) passed only mode/uid/gid/size, so the inode cap was
the kernel default (half the node's RAM pages), and a workload could fill its
socket directory with empty files far past anything `size` bounds.

- uds-csi: new --inodes flag (default 64, at least 8, validated in
  NewDriver); the mount data string is now exactly
  mode=2770,uid=0,gid=<fsGroup>,size=<bytes>,nr_inodes=<n>.
- chart: udsCsi.inodes (default 64) renders --inodes as a plain integer
  and fails the install below 8. Chart 2.1.0.
- e2e/uds-csi.sh: the host mount carries nr_inodes=64 (findmnt) and df
  reports 64 inodes; filling /s fails with ENOSPC at file 62 (root dir,
  socket and the symlink leg hold the other three), 0 inodes free, and the
  socket still answers.
- docs: configuration.md (value + flag) and the proposal's Phase 1 as built.

Closes #1107


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

Co-authored-by: Claude Fable 5.1 <[email protected]>
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