spegel-org / spegel

Stateless cluster local OCI registry mirror.
MIT License
1.31k stars 71 forks source link

Support microk8s containerdRegistryConfigPath #567

Open danielluke opened 3 months ago

danielluke commented 3 months ago

Hi, I've got things setup on my local 5-node microk8s setup, and things seem to be working really well.

One catch is that I'd like to use a containerdRegistryConfigPath like /var/snap/microk8s/current/args/certs.d so that I don't have to update the config whenever I update my microk8s snap (otherwise the path looks like /var/snap/microk8s/6872/args/certs.d ).

However - https://github.com/spegel-org/spegel/blob/77de00d660d35011c0237e613c02801a2bc7d8cd/pkg/oci/containerd.go#L129

this section doesn't like it if I don't use /var/snap/microk8s/6872/args/certs.d

the path with 'current' in it is a symlink to the currently installed snap version's path:

$ ls -l /var/snap/microk8s/current
lrwxrwxrwx 1 root root 4 Jun  3 00:02 /var/snap/microk8s/current -> 6872

Otherwise, I just did a helm install with these values:

spegel:
  containerdSock: "/var/snap/microk8s/common/run/containerd.sock"
  containerdRegistryConfigPath: "/var/snap/microk8s/6872/args/certs.d"
  containerdContentPath: "/var/snap/microk8s/common/var/lib/containerd/io.containerd.content.v1.content"

and edited /var/snap/microk8s/current/args/containerd-template.toml to include 'discard_unpacked_layers = false'

phillebaba commented 3 months ago

I am not familiar with how snap works with the dynamic directory paths, but I understand why you would want to use symlinks to get a static path. Adding a secondary check with symlinks is easy enough, and there are probably others out there who would want this in the future.