-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
crio: basic support for rootless mode
Allow to run it in an user namespace. This is only a first step but I was able to run a pod and some basic containers. Leave it undocumented for now as we don't want to stick with this API. Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
- Loading branch information
Showing
3 changed files
with
51 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package server | ||
|
||
import ( | ||
"strings" | ||
|
||
rspec "github.com/opencontainers/runtime-spec/specs-go" | ||
"github.com/opencontainers/runtime-tools/generate" | ||
) | ||
|
||
func makeOCIConfigurationRootless(g *generate.Generator) error { | ||
g.Config.Linux.Resources = nil | ||
g.Config.Process.OOMScoreAdj = nil | ||
g.Config.Process.ApparmorProfile = "" | ||
g.Config.Process.SelinuxLabel = "" | ||
|
||
for i := range g.Config.Mounts { | ||
var newOptions []string | ||
for _, o := range g.Config.Mounts[i].Options { | ||
if strings.HasPrefix(o, "gid=") { | ||
continue | ||
} | ||
newOptions = append(newOptions, o) | ||
} | ||
g.Config.Mounts[i].Options = newOptions | ||
} | ||
|
||
g.RemoveMount("/sys") | ||
sysMnt := rspec.Mount{ | ||
Destination: "/sys", | ||
Type: "bind", | ||
Source: "/sys", | ||
Options: []string{"nosuid", "noexec", "nodev", "ro", "rbind"}, | ||
} | ||
g.AddMount(sysMnt) | ||
|
||
g.SetLinuxCgroupsPath("") | ||
|
||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters