@@ -31,6 +31,7 @@ import (
31
31
32
32
"github.com/onsi/ginkgo/v2"
33
33
libcontainercgroups "github.com/opencontainers/runc/libcontainer/cgroups"
34
+ "k8s.io/utils/ptr"
34
35
)
35
36
36
37
type testCase struct {
@@ -211,6 +212,16 @@ func getOOMTargetContainer(name string) v1.Container {
211
212
v1 .ResourceMemory : resource .MustParse ("15Mi" ),
212
213
},
213
214
},
215
+ SecurityContext : & v1.SecurityContext {
216
+ SeccompProfile : & v1.SeccompProfile {
217
+ Type : v1 .SeccompProfileTypeRuntimeDefault ,
218
+ },
219
+ AllowPrivilegeEscalation : ptr .To (false ),
220
+ RunAsUser : ptr.To [int64 ](999 ),
221
+ RunAsGroup : ptr.To [int64 ](999 ),
222
+ RunAsNonRoot : ptr .To (true ),
223
+ Capabilities : & v1.Capabilities {Drop : []v1.Capability {"ALL" }},
224
+ },
214
225
}
215
226
}
216
227
@@ -234,6 +245,16 @@ func getOOMTargetContainerMultiProcess(name string) v1.Container {
234
245
v1 .ResourceMemory : resource .MustParse ("15Mi" ),
235
246
},
236
247
},
248
+ SecurityContext : & v1.SecurityContext {
249
+ SeccompProfile : & v1.SeccompProfile {
250
+ Type : v1 .SeccompProfileTypeRuntimeDefault ,
251
+ },
252
+ AllowPrivilegeEscalation : ptr .To (false ),
253
+ RunAsUser : ptr.To [int64 ](999 ),
254
+ RunAsGroup : ptr.To [int64 ](999 ),
255
+ RunAsNonRoot : ptr .To (true ),
256
+ Capabilities : & v1.Capabilities {Drop : []v1.Capability {"ALL" }},
257
+ },
237
258
}
238
259
}
239
260
@@ -249,5 +270,15 @@ func getOOMTargetContainerWithoutLimit(name string) v1.Container {
249
270
// use the dd tool to attempt to allocate huge block of memory which exceeds the node allocatable
250
271
"sleep 5 && dd if=/dev/zero of=/dev/null iflag=fullblock count=10 bs=10G" ,
251
272
},
273
+ SecurityContext : & v1.SecurityContext {
274
+ SeccompProfile : & v1.SeccompProfile {
275
+ Type : v1 .SeccompProfileTypeRuntimeDefault ,
276
+ },
277
+ AllowPrivilegeEscalation : ptr .To (false ),
278
+ RunAsUser : ptr.To [int64 ](999 ),
279
+ RunAsGroup : ptr.To [int64 ](999 ),
280
+ RunAsNonRoot : ptr .To (true ),
281
+ Capabilities : & v1.Capabilities {Drop : []v1.Capability {"ALL" }},
282
+ },
252
283
}
253
284
}
0 commit comments