diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2021-09-24 08:20:54 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-24 08:20:54 -0400 |
commit | 9c48947c73b3bac33c18cb94aa6e1c4abc709cca (patch) | |
tree | 5ce84552942b0914dc0cdfb923871d1e4907c34b /libpod | |
parent | 800d594afa160353cc7134ef912bf82f266a122c (diff) | |
parent | 6095c4fac0ff275d01a969d1c48aace1ac673aea (diff) | |
download | podman-9c48947c73b3bac33c18cb94aa6e1c4abc709cca.tar.gz podman-9c48947c73b3bac33c18cb94aa6e1c4abc709cca.tar.bz2 podman-9c48947c73b3bac33c18cb94aa6e1c4abc709cca.zip |
Merge pull request #11733 from Luap99/xdg
rootful: do not set XDG_RUNTIME_DIR for cni plugins
Diffstat (limited to 'libpod')
-rw-r--r-- | libpod/network/cni/cni_exec.go | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/libpod/network/cni/cni_exec.go b/libpod/network/cni/cni_exec.go index c4d7f49f7..ae857bcfb 100644 --- a/libpod/network/cni/cni_exec.go +++ b/libpod/network/cni/cni_exec.go @@ -30,6 +30,7 @@ import ( "github.com/containernetworking/cni/pkg/invoke" "github.com/containernetworking/cni/pkg/version" + "github.com/containers/podman/v3/pkg/rootless" ) type cniExec struct { @@ -67,6 +68,17 @@ func (e *cniExec) ExecPlugin(ctx context.Context, pluginPath string, stdinData [ c.Stdout = stdout c.Stderr = stderr + // The dnsname plugin tries to use XDG_RUNTIME_DIR to store files. + // podman run will have XDG_RUNTIME_DIR set and thus the cni plugin can use + // it. The problem is that XDG_RUNTIME_DIR is unset for the conmon process + // for rootful users. This causes issues since the cleanup process is spawned + // by conmon and thus not have XDG_RUNTIME_DIR set to same value as podman run. + // Because of it dnsname will not find the config files and cannot correctly cleanup. + // To fix this we should also unset XDG_RUNTIME_DIR for the cni plugins as rootful. + if !rootless.IsRootless() { + c.Env = append(c.Env, "XDG_RUNTIME_DIR=") + } + err := c.Run() if err != nil { return nil, annotatePluginError(err, pluginPath, stdout.Bytes(), stderr.Bytes()) |