File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -146,6 +146,26 @@ func TestLinuxSandboxContainerSpec(t *testing.T) {
146146 })
147147 },
148148 },
149+ "spec shouldn't have ping_group_range if userns are in use" : {
150+ configChange : func (c * runtime.PodSandboxConfig ) {
151+ c .Linux .SecurityContext = & runtime.LinuxSandboxSecurityContext {
152+ NamespaceOptions : & runtime.NamespaceOption {
153+ UsernsOptions : & runtime.UserNamespace {
154+ Mode : runtime .NamespaceMode_POD ,
155+ Uids : []* runtime.IDMapping {& idMap },
156+ Gids : []* runtime.IDMapping {& idMap },
157+ },
158+ },
159+ }
160+ },
161+ specCheck : func (t * testing.T , spec * runtimespec.Spec ) {
162+ require .NotNil (t , spec .Linux )
163+ assert .Contains (t , spec .Linux .Namespaces , runtimespec.LinuxNamespace {
164+ Type : runtimespec .UserNamespace ,
165+ })
166+ assert .NotContains (t , spec .Linux .Sysctl ["net.ipv4.ping_group_range" ], "0 2147483647" )
167+ },
168+ },
149169 "host namespace" : {
150170 configChange : func (c * runtime.PodSandboxConfig ) {
151171 c .Linux .SecurityContext = & runtime.LinuxSandboxSecurityContext {
You can’t perform that action at this time.
0 commit comments