File tree 1 file changed +16
-0
lines changed
pkg/runtime-tools/generate
1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -117,6 +117,7 @@ func (g *Generator) Adjust(adjust *nri.ContainerAdjustment) error {
117
117
g .AdjustDevices (adjust .GetLinux ().GetDevices ())
118
118
g .AdjustCgroupsPath (adjust .GetLinux ().GetCgroupsPath ())
119
119
g .AdjustOomScoreAdj (adjust .GetLinux ().GetOomScoreAdj ())
120
+ g .AdjustNamespaces (adjust .GetLinux ().GetNamespaces ())
120
121
121
122
resources := adjust .GetLinux ().GetResources ()
122
123
if err := g .AdjustResources (resources ); err != nil {
@@ -332,6 +333,21 @@ func (g *Generator) AdjustOomScoreAdj(score *nri.OptionalInt) {
332
333
}
333
334
}
334
335
336
+ // AdjustNamespaces adds or replaces namespaces in the OCI Spec.
337
+ func (g * Generator ) AdjustNamespaces (namespaces []* nri.LinuxNamespace ) error {
338
+ for _ , n := range namespaces {
339
+ if n == nil {
340
+ continue
341
+ }
342
+ if key , marked := n .IsMarkedForRemoval (); marked {
343
+ g .RemoveLinuxNamespace (key )
344
+ } else {
345
+ g .AddOrReplaceLinuxNamespace (n .Type , n .Path )
346
+ }
347
+ }
348
+ return nil
349
+ }
350
+
335
351
// AdjustDevices adjusts the (Linux) devices in the OCI Spec.
336
352
func (g * Generator ) AdjustDevices (devices []* nri.LinuxDevice ) {
337
353
for _ , d := range devices {
You can’t perform that action at this time.
0 commit comments