Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

podman pod create --uidmap patch #14344

Merged
merged 1 commit into from
Jun 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions pkg/specgen/podspecgen.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"net"

"github.com/containers/common/libnetwork/types"
storageTypes "github.com/containers/storage/types"
spec "github.com/opencontainers/runtime-spec/specs-go"
)

Expand Down Expand Up @@ -222,6 +223,10 @@ type PodResourceConfig struct {

type PodSecurityConfig struct {
SecurityOpt []string `json:"security_opt,omitempty"`
// IDMappings are UID and GID mappings that will be used by user
// namespaces.
// Required if UserNS is private.
IDMappings *storageTypes.IDMappingOptions `json:"idmappings,omitempty"`
}

// NewPodSpecGenerator creates a new pod spec
Expand Down
4 changes: 3 additions & 1 deletion test/system/170-run-userns.bats
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,12 @@ function _require_crun() {

@test "rootful pod with custom ID mapping" {
skip_if_rootless "does not work rootless - rootful feature"
skip_if_remote "remote --uidmap is broken (see #14233)"
random_pod_name=$(random_string 30)
run_podman pod create --uidmap 0:200000:5000 --name=$random_pod_name
run_podman pod start $random_pod_name
run_podman pod inspect --format '{{.InfraContainerID}}' $random_pod_name
run podman inspect --format '{{.HostConfig.IDMappings.UIDMap}}' $output
is "$output" ".*0:200000:5000" "UID Map Successful"

# Remove the pod and the pause image
run_podman pod rm $random_pod_name
Expand Down