Skip to content

feat: refactor /etc mounts#13558

Open
frezbo wants to merge 1 commit into
siderolabs:mainfrom
frezbo:feat/etc-refactor
Open

feat: refactor /etc mounts#13558
frezbo wants to merge 1 commit into
siderolabs:mainfrom
frezbo:feat/etc-refactor

Conversation

@frezbo

@frezbo frezbo commented Jun 10, 2026

Copy link
Copy Markdown
Member

Stop using individual bind mounts for /etc files and use an overlay backed by rootfs /etc and an anonymous tmpfs. This allows in future to support files under /etc as machine config documents.

Drop all bind mount support, containers now also follow same pattern.

Also move /etc/cni and /etc/kuberentes as tmpfs, since we cannot have a nested overlay over size of two, when system has an extension(s), /etc being an overlay means, it's already two levels in, so /etc/cni and /etc/kubernetes cannot be overlayed on top again.

Copilot AI review requested due to automatic review settings June 10, 2026 17:53
@github-project-automation github-project-automation Bot moved this to To Do in Planning Jun 10, 2026
@talos-bot talos-bot moved this from To Do to In Review in Planning Jun 10, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Refactors Talos’ /etc handling to stop using per-file bind mounts and instead compose /etc as a read-only overlay backed by the static rootfs /etc plus a writable (anonymous) tmpfs, with /etc/cni and /etc/kubernetes mounted as standalone tmpfs due to overlay stacking limits (especially when extensions add additional overlay layers).

Changes:

  • Added fsopen support for ordered FSCONFIG_SET_FD parameters and introduced an overlay helper that builds overlay lower layers from mount FDs.
  • Added machined runtime logic to seed required /etc files/dirs and mount the /etc overlay early, then mount writable tmpfs on /etc/cni and /etc/kubernetes.
  • Removed /etc bind-mount machinery in controllers/tests and adjusted SELinux policy + rootfs build steps to match the new /etc model.

Reviewed changes

Copilot reviewed 14 out of 15 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
pkg/xfs/fsopen/options_linux.go Adds WithFdParameter option to pass FSCONFIG_SET_FD parameters into fsopen.
pkg/xfs/fsopen/fsopen_linux.go Stores ordered fd params and applies them via unix.FsconfigSetFd during filesystem creation.
pkg/machinery/constants/constants.go Removes /etc/cni and /etc/kubernetes from the generic overlay mount list.
internal/pkg/selinux/policy/selinux/services/kubelet.cil Allows filesystem association for k8s_conf_t to support context-labeled tmpfs mounts.
internal/pkg/selinux/policy/selinux/services/cri.cil Adds tmpfs association for cni_conf_t and allows container runtime remount behavior for k8s_conf_t.
internal/pkg/selinux/policy/selinux/common/files.cil Labels managed /etc tmpfs as etc_t, adds filesystem association, and introduces a neverallow guard against non-init writes to etc_t.
internal/pkg/mount/v3/helpers.go Adds helper to mount read-only overlay using layer file descriptors (fsconfig lowerdir+ via FD).
internal/app/machined/pkg/runtime/v1alpha2/v1alpha2_controller.go Switches /etc to a managed tmpfs + overlay model and wires in overlay setup.
internal/app/machined/pkg/runtime/v1alpha2/etc_overlay.go New implementation that seeds /etc, mounts the /etc overlay, and mounts writable tmpfs at /etc/cni and /etc/kubernetes.
internal/app/machined/pkg/controllers/files/etcfile.go Removes per-file bind mounts; writes directly into the managed /etc tmpfs root.
internal/app/machined/pkg/controllers/files/etcfile_test.go Updates tests to validate writes into EtcRoot only (overlay surfacing is now machined’s responsibility).
internal/app/machined/pkg/controllers/files/cri_registry_config.go Drops bind mount creation for CRI hosts directory; relies on overlay surfacing.
internal/app/machined/pkg/controllers/block/internal/volumes/volumeconfig/system_volumes.go Minor formatting change while iterating overlay volume resources.
Dockerfile Stops pre-creating many /etc placeholders in the rootfs; only keeps extensions.yaml placeholder.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread internal/app/machined/pkg/controllers/files/etcfile.go Outdated
Comment thread internal/pkg/mount/v3/helpers.go Outdated
Comment thread internal/app/machined/pkg/runtime/v1alpha2/etc_overlay.go Outdated
Comment thread internal/app/machined/pkg/runtime/v1alpha2/etc_overlay.go Outdated
@frezbo frezbo added the integration/release-gate Run all release-gate integration tests label Jun 10, 2026
@rothgar

rothgar commented Jun 10, 2026

Copy link
Copy Markdown
Member

Would storing /etc/cni as tmpfs mean cni plugins would need to be re-copied on every system reboot?

@frezbo

frezbo commented Jun 11, 2026

Copy link
Copy Markdown
Member Author

Would storing /etc/cni as tmpfs mean cni plugins would need to be re-copied on every system reboot?

no, plugins are in /opt

@frezbo frezbo force-pushed the feat/etc-refactor branch from 923ca81 to f8ea540 Compare June 11, 2026 19:11
@frezbo frezbo changed the title feat: /etc refactor feat: refactor /etc mounts Jun 11, 2026
@frezbo frezbo requested a review from Copilot June 11, 2026 19:12

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 17 out of 18 changed files in this pull request and generated 3 comments.

Comment thread internal/app/machined/pkg/runtime/v1alpha2/etc_overlay.go Outdated
Comment thread internal/app/machined/pkg/runtime/v1alpha2/etc_overlay.go Outdated
Comment thread internal/pkg/mount/v3/helpers.go
@frezbo frezbo force-pushed the feat/etc-refactor branch 5 times, most recently from 5c6bbea to dc025e9 Compare June 13, 2026 11:22
@frezbo frezbo removed the integration/release-gate Run all release-gate integration tests label Jun 17, 2026
@frezbo frezbo force-pushed the feat/etc-refactor branch from dc025e9 to 12fce05 Compare June 17, 2026 18:25
Stop using individual bind mounts for `/etc` files and use a writable overlay
backed by rootfs `/etc`. This allows in future to support
files under `/etc` as machine config documents.

Drop all bind mount support, containers now also follow same pattern.

Also move `/etc/cni` and `/etc/kuberentes` as tmpfs, since we cannot have
a nested overlay over size of two, when system has an extension(s), `/etc`
being an overlay means, it's already two levels in, so `/etc/cni` and
`/etc/kubernetes` cannot be overlayed on top again.

Signed-off-by: Noel Georgi <git@frezbo.dev>
@frezbo frezbo force-pushed the feat/etc-refactor branch from 12fce05 to 617aa63 Compare June 18, 2026 11:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: In Review

Development

Successfully merging this pull request may close these issues.

4 participants