summaryrefslogtreecommitdiff
path: root/cmd/podman
diff options
context:
space:
mode:
authorcdoern <cdoern@redhat.com>2022-01-18 15:46:11 -0500
committercdoern <cdoern@redhat.com>2022-02-03 09:30:17 -0500
commit9eb88ea474c3f6160090573c4bae3fe4c5ece016 (patch)
tree3aaef20e0da547c9a1c0658707b1260a44eefae3 /cmd/podman
parent55ad6188b067ba6594819c318dd2ae92dea2f27e (diff)
downloadpodman-9eb88ea474c3f6160090573c4bae3fe4c5ece016.tar.gz
podman-9eb88ea474c3f6160090573c4bae3fe4c5ece016.tar.bz2
podman-9eb88ea474c3f6160090573c4bae3fe4c5ece016.zip
Podman pod create --share-parent vs --share=cgroup
separated cgroupNS sharing from setting the pod as the cgroup parent, made a new flag --share-parent which sets the pod as the cgroup parent for all containers entering the pod remove cgroup from the default kernel namespaces since we want the same default behavior as before which is just the cgroup parent. resolves #12765 Signed-off-by: cdoern <cdoern@redhat.com> Signed-off-by: cdoern <cbdoer23@g.holycross.edu> Signed-off-by: cdoern <cdoern@redhat.com>
Diffstat (limited to 'cmd/podman')
-rw-r--r--cmd/podman/pods/create.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/cmd/podman/pods/create.go b/cmd/podman/pods/create.go
index 5d8a5aeab..8222ec8e2 100644
--- a/cmd/podman/pods/create.go
+++ b/cmd/podman/pods/create.go
@@ -17,6 +17,7 @@ import (
"github.com/containers/podman/v4/cmd/podman/parse"
"github.com/containers/podman/v4/cmd/podman/registry"
"github.com/containers/podman/v4/cmd/podman/validate"
+ "github.com/containers/podman/v4/libpod/define"
"github.com/containers/podman/v4/pkg/domain/entities"
"github.com/containers/podman/v4/pkg/errorhandling"
"github.com/containers/podman/v4/pkg/specgen"
@@ -52,6 +53,7 @@ var (
podIDFile string
replace bool
share string
+ shareParent bool
)
func init() {
@@ -88,6 +90,9 @@ func init() {
flags.StringVar(&share, shareFlagName, specgen.DefaultKernelNamespaces, "A comma delimited list of kernel namespaces the pod will share")
_ = createCommand.RegisterFlagCompletionFunc(shareFlagName, common.AutocompletePodShareNamespace)
+ shareParentFlagName := "share-parent"
+ flags.BoolVar(&shareParent, shareParentFlagName, true, "Set the pod's cgroup as the cgroup parent for all containers joining the pod")
+
flags.SetNormalizeFunc(aliasNetworkFlag)
}
@@ -147,7 +152,11 @@ func create(cmd *cobra.Command, args []string) error {
if err != nil {
return err
}
+ if strings.Contains(share, "cgroup") && shareParent {
+ return errors.Wrapf(define.ErrInvalidArg, "cannot define the pod as the cgroup parent at the same time as joining the infra container's cgroupNS")
+ }
createOptions.Share = strings.Split(share, ",")
+ createOptions.ShareParent = &shareParent
if cmd.Flag("infra-command").Changed {
// Only send content to server side if user changed defaults
cmdIn, err := cmd.Flags().GetString("infra-command")