File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed
pkg/runtime-tools/generate Expand file tree Collapse file tree 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 {
117117 g .AdjustDevices (adjust .GetLinux ().GetDevices ())
118118 g .AdjustCgroupsPath (adjust .GetLinux ().GetCgroupsPath ())
119119 g .AdjustOomScoreAdj (adjust .GetLinux ().GetOomScoreAdj ())
120+ g .AdjustNamespaces (adjust .GetLinux ().GetNamespaces ())
120121
121122 resources := adjust .GetLinux ().GetResources ()
122123 if err := g .AdjustResources (resources ); err != nil {
@@ -332,6 +333,21 @@ func (g *Generator) AdjustOomScoreAdj(score *nri.OptionalInt) {
332333 }
333334}
334335
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+
335351// AdjustDevices adjusts the (Linux) devices in the OCI Spec.
336352func (g * Generator ) AdjustDevices (devices []* nri.LinuxDevice ) {
337353 for _ , d := range devices {
You can’t perform that action at this time.
0 commit comments