From 83334fb4e71f08b8aea8e8f709461a295aba27c8 Mon Sep 17 00:00:00 2001 From: Giuseppe Scrivano Date: Wed, 6 Sep 2023 21:24:06 +0200 Subject: [PATCH] specgen: allow --share-parent with --infra=false This allows to use --share-parent with --infra=false, so that the containers in the pod can share the parent cgroup. Signed-off-by: Giuseppe Scrivano --- pkg/specgen/generate/pod_create.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pkg/specgen/generate/pod_create.go b/pkg/specgen/generate/pod_create.go index d8759a9314..a8136ba490 100644 --- a/pkg/specgen/generate/pod_create.go +++ b/pkg/specgen/generate/pod_create.go @@ -123,11 +123,12 @@ func createPodOptions(p *specgen.PodSpecGenerator) ([]libpod.PodCreateOption, er var ( options []libpod.PodCreateOption ) + + if p.ShareParent == nil || (p.ShareParent != nil && *p.ShareParent) { + options = append(options, libpod.WithPodParent()) + } if !p.NoInfra { options = append(options, libpod.WithInfraContainer()) - if p.ShareParent == nil || (p.ShareParent != nil && *p.ShareParent) { - options = append(options, libpod.WithPodParent()) - } nsOptions, err := GetNamespaceOptions(p.SharedNamespaces, p.InfraContainerSpec.NetNS.IsHost()) if err != nil { return nil, err