Skip to content

Commit 9b23137

Browse files
authored
Merge pull request containerd#9782 from kinvolk/rata/userns-update-podSandboxStatus
Include userns info in cri/server PodSandboxStatus
2 parents 1b67dd7 + 06ed897 commit 9b23137

File tree

2 files changed

+18
-5
lines changed

2 files changed

+18
-5
lines changed

internal/cri/server/sandbox_status.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -134,11 +134,7 @@ func toCRISandboxStatus(meta sandboxstore.Metadata, status string, createdAt tim
134134
},
135135
Linux: &runtime.LinuxPodSandboxStatus{
136136
Namespaces: &runtime.Namespace{
137-
Options: &runtime.NamespaceOption{
138-
Network: nsOpts.GetNetwork(),
139-
Pid: nsOpts.GetPid(),
140-
Ipc: nsOpts.GetIpc(),
141-
},
137+
Options: nsOpts,
142138
},
143139
},
144140
Labels: meta.Config.GetLabels(),

internal/cri/server/sandbox_status_test.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,13 @@ func TestPodSandboxStatus(t *testing.T) {
3131
id = "test-id"
3232
ip = "10.10.10.10"
3333
)
34+
idmap := []*runtime.IDMapping{
35+
{
36+
ContainerId: 0,
37+
HostId: 100,
38+
Length: 1,
39+
},
40+
}
3441
additionalIPs := []string{"8.8.8.8", "2001:db8:85a3::8a2e:370:7334"}
3542
createdAt := time.Now()
3643
config := &runtime.PodSandboxConfig{
@@ -46,6 +53,11 @@ func TestPodSandboxStatus(t *testing.T) {
4653
Network: runtime.NamespaceMode_NODE,
4754
Pid: runtime.NamespaceMode_CONTAINER,
4855
Ipc: runtime.NamespaceMode_POD,
56+
UsernsOptions: &runtime.UserNamespace{
57+
Uids: idmap,
58+
Gids: idmap,
59+
Mode: runtime.NamespaceMode_POD,
60+
},
4961
},
5062
},
5163
},
@@ -80,6 +92,11 @@ func TestPodSandboxStatus(t *testing.T) {
8092
Network: runtime.NamespaceMode_NODE,
8193
Pid: runtime.NamespaceMode_CONTAINER,
8294
Ipc: runtime.NamespaceMode_POD,
95+
UsernsOptions: &runtime.UserNamespace{
96+
Uids: idmap,
97+
Gids: idmap,
98+
Mode: runtime.NamespaceMode_POD,
99+
},
83100
},
84101
},
85102
},

0 commit comments

Comments
 (0)