mirror of
https://github.com/containers/podman.git
synced 2025-06-03 20:33:20 +08:00
pods: do not to join a userns if there is not any
do not attempt to join the user namespace if the pod is running in the host user namespace. Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
This commit is contained in:
@ -492,14 +492,28 @@ func (r *LocalRuntime) PlayKubeYAML(ctx context.Context, c *cliconfig.KubePlayVa
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
hasUserns := false
|
||||
if podInfraID != "" {
|
||||
podCtr, err := r.GetContainer(podInfraID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
mappings, err := podCtr.IDMappings()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
hasUserns = len(mappings.UIDMap) > 0
|
||||
}
|
||||
|
||||
namespaces := map[string]string{
|
||||
// Disabled during code review per mheon
|
||||
//"pid": fmt.Sprintf("container:%s", podInfraID),
|
||||
"net": fmt.Sprintf("container:%s", podInfraID),
|
||||
"user": fmt.Sprintf("container:%s", podInfraID),
|
||||
"ipc": fmt.Sprintf("container:%s", podInfraID),
|
||||
"uts": fmt.Sprintf("container:%s", podInfraID),
|
||||
"net": fmt.Sprintf("container:%s", podInfraID),
|
||||
"ipc": fmt.Sprintf("container:%s", podInfraID),
|
||||
"uts": fmt.Sprintf("container:%s", podInfraID),
|
||||
}
|
||||
if hasUserns {
|
||||
namespaces["user"] = fmt.Sprintf("container:%s", podInfraID)
|
||||
}
|
||||
if !c.Quiet {
|
||||
writer = os.Stderr
|
||||
|
Reference in New Issue
Block a user