Skip to content

feat: add cachefilesd extension - #1183

Open
ChristianJacobsen wants to merge 3 commits into
siderolabs:mainfrom
ChristianJacobsen:cachefilesd
Open

feat: add cachefilesd extension#1183
ChristianJacobsen wants to merge 3 commits into
siderolabs:mainfrom
ChristianJacobsen:cachefilesd

Conversation

@ChristianJacobsen

Copy link
Copy Markdown

Adds cachefilesd: NFS mounts with the fsc option cache reads on local disk.

Depends on: siderolabs/pkgs#1636

Add cachefilesd (FS-Cache backend daemon) and the cachefiles kernel
module under storage/. With an NFS mount using the "fsc" option,
reads are cached on the node's local disk.

Requires a kernel with CONFIG_FSCACHE=y and CONFIG_NFS_FSCACHE=y.

Signed-off-by: Christian A. Jacobsen <christian@jenkins.no>
@talos-bot talos-bot moved this to In Review in Planning Aug 4, 2026
Comment thread storage/cachefilesd/cachefilesd.yaml Outdated
- bind
- ro
# cachefilesd binary
- source: /usr/local/sbin

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

do we need it to be on the host? or can it be self-contained contianer rootfs?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Yeah, that is probably the better solution. I mirrored what was done in lldpd so everything is in a self-contained rootfs now.

- bind
- ro
# cache root, rw: the cachefiles kernel module sets xattrs on it
- source: /var/cache/fscache

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I understand that Talos at the moment doesn't support a nice way to handle this, but it almost feels like this is too restrictive, e.g. this doesn't allow a user volume to be used for the cache.

I might need to think a bit more about this specific usecase

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Agreed it's restrictive. /var being ephemeral works for my use case, but yes - it would be strictly better with a user volume. I'm not hitched to any solution, so I'll go with whatever suggestion you think is best. You know this stack better than I.

Comment thread storage/cachefilesd/cachefilesd.yaml Outdated
- bind
- ro
# config file
- source: /usr/local/etc/cachefilesd.conf

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Talos now supports custom EtcFileConfig to allow users to override configuration, I wonder if the extension shouldn't ship any, and instead bind-mount the file from /etc which is user-managed...

@ChristianJacobsen ChristianJacobsen Aug 5, 2026

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Looked at this and ran into a wrinkle: machined os.MkdirAlls any missing bind-mount source, so a bind-mounted /etc/cachefilesd.conf would be created as a directory when the user doesn't supply one, which would break the daemon. So the default config now lives in the container rootfs, and users can override it via ExtensionServiceConfig. I'm happy to switch to depends: configuration: true with no defaults if you prefer that instead.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

you need to add a file dependency, so when etcfileconfig creates only the service tries to start

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Ahh, I see. That makes more sense. I hope I got it right this time. At least it works "as intended" in a Qemu cluster on my Mac 😄

@smira smira left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

please add yourself to MAINTAINERS for this extension

Signed-off-by: Christian A. Jacobsen <christian@jenkins.no>
@ChristianJacobsen

Copy link
Copy Markdown
Author

I'll squash any fixups before merge, but it's easier to track the fixes this way instead of force-pushing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In Review

Development

Successfully merging this pull request may close these issues.

4 participants