siderolabs / talos

Talos Linux is a modern Linux distribution built for Kubernetes.
https://www.talos.dev
Mozilla Public License 2.0
6.89k stars 555 forks source link

feat: implement image cache configuration #9768

Closed smira closed 15 hours ago

smira commented 1 day ago

Implement a feature flag, a resource which controls the flow.

This controls the volume configuration, mounting, etc.

Fixes #9767

smira commented 1 day ago

Totally WIP at the moment.

smira commented 15 hours ago

Example machine config patch to activate this feature:

machine:
  features:
    imageCache: true
---
apiVersion: v1alpha1
kind: VolumeConfig
name: IMAGECACHE
provisioning:
    diskSelector:
        match: disk.transport == "nvme" && !system_disk
smira commented 15 hours ago
# talosctl -n 172.20.0.5 get imagecacheconfig -o yaml 
node: 172.20.0.5
metadata:
    namespace: cri
    type: ImageCacheConfigs.cri.talos.dev
    id: image-cache
    version: 4
    owner: cri.ImageCacheConfigController
    phase: running
    created: 2024-11-21T17:21:14Z
    updated: 2024-11-21T17:21:17Z
spec:
    status: ready
    roots:
        - /system/imagecache/disk
smira commented 15 hours ago
$ talosctl -n 172.20.0.5 get mountstatus                  
NODE         NAMESPACE   TYPE          ID           VERSION   SOURCE           TARGET                    FILESYSTEM TYPE
172.20.0.5   runtime     MountStatus   EPHEMERAL    1         /dev/vda6        /var                      xfs
172.20.0.5   runtime     MountStatus   IMAGECACHE   1         /dev/nvme0n1p1   /system/imagecache/disk   ext4
172.20.0.5   runtime     MountStatus   STATE        1         /dev/vda5        /system/state             xfs
smira commented 15 hours ago

/m