From dbc9c967ddebac0ac14a5ab3ba7cb73a86b23b15 Mon Sep 17 00:00:00 2001 From: Ludo Stellingwerff Date: Wed, 2 Oct 2024 14:26:44 +0200 Subject: [PATCH] New commit with the actual change, nicely simple thanks to Brandon's advice Signed-off-by: Ludo Stellingwerff --- pkg/rootless/rootless.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkg/rootless/rootless.go b/pkg/rootless/rootless.go index f584e7b4a7cd..558c923c7576 100644 --- a/pkg/rootless/rootless.go +++ b/pkg/rootless/rootless.go @@ -32,6 +32,7 @@ var ( enableIPv6Env = "K3S_ROOTLESS_ENABLE_IPV6" portDriverEnv = "K3S_ROOTLESS_PORT_DRIVER" disableLoopbackEnv = "K3S_ROOTLESS_DISABLE_HOST_LOOPBACK" + copyUpDirsEnv = "K3S_ROOTLESS_COPYUPDIRS" ) func Rootless(stateDir string, enableIPv6 bool) error { @@ -218,6 +219,9 @@ func createChildOpt(driver portDriver) (*child.Opt, error) { opt.NetworkDriver = slirp4netns.NewChildDriver() opt.PortDriver = driver.NewChildDriver() opt.CopyUpDirs = []string{"/etc", "/var/run", "/run", "/var/lib"} + if copyUpDirs := os.Getenv(copyUpDirsEnv); copyUpDirs != "" { + opt.CopyUpDirs = append(opt.CopyUpDirs, strings.Split(copyUpDirs, ",")...) + } opt.CopyUpDriver = tmpfssymlink.NewChildDriver() opt.MountProcfs = true opt.Reaper = true