summaryrefslogtreecommitdiff
path: root/pkg/specgen/generate/container_create.go
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/specgen/generate/container_create.go')
-rw-r--r--pkg/specgen/generate/container_create.go37
1 files changed, 13 insertions, 24 deletions
diff --git a/pkg/specgen/generate/container_create.go b/pkg/specgen/generate/container_create.go
index 6a611e854..5667a02e8 100644
--- a/pkg/specgen/generate/container_create.go
+++ b/pkg/specgen/generate/container_create.go
@@ -8,7 +8,6 @@ import (
cdi "github.com/container-orchestrated-devices/container-device-interface/pkg/cdi"
"github.com/containers/common/libimage"
- "github.com/containers/common/pkg/cgroups"
"github.com/containers/podman/v4/libpod"
"github.com/containers/podman/v4/libpod/define"
"github.com/containers/podman/v4/pkg/namespaces"
@@ -184,32 +183,19 @@ func MakeContainer(ctx context.Context, rt *libpod.Runtime, s *specgen.SpecGener
if err != nil {
return nil, nil, nil, err
}
-
- switch {
- case s.ResourceLimits.CPU != nil:
- runtimeSpec.Linux.Resources.CPU = s.ResourceLimits.CPU
- case s.ResourceLimits.Memory != nil:
- runtimeSpec.Linux.Resources.Memory = s.ResourceLimits.Memory
- case s.ResourceLimits.BlockIO != nil:
- runtimeSpec.Linux.Resources.BlockIO = s.ResourceLimits.BlockIO
- case s.ResourceLimits.Devices != nil:
- runtimeSpec.Linux.Resources.Devices = s.ResourceLimits.Devices
- }
-
- cgroup2, err := cgroups.IsCgroup2UnifiedMode()
- if err != nil {
- return nil, nil, nil, err
- }
- if cgroup2 && s.ResourceLimits.Memory != nil && s.ResourceLimits.Memory.Swappiness != nil { // conf.Spec.Linux contains memory swappiness established after the spec process we need to remove that
- s.ResourceLimits.Memory.Swappiness = nil
- if runtimeSpec.Linux.Resources.Memory != nil {
- runtimeSpec.Linux.Resources.Memory.Swappiness = nil
+ if s.ResourceLimits != nil {
+ switch {
+ case s.ResourceLimits.CPU != nil:
+ runtimeSpec.Linux.Resources.CPU = s.ResourceLimits.CPU
+ case s.ResourceLimits.Memory != nil:
+ runtimeSpec.Linux.Resources.Memory = s.ResourceLimits.Memory
+ case s.ResourceLimits.BlockIO != nil:
+ runtimeSpec.Linux.Resources.BlockIO = s.ResourceLimits.BlockIO
+ case s.ResourceLimits.Devices != nil:
+ runtimeSpec.Linux.Resources.Devices = s.ResourceLimits.Devices
}
}
}
- if err != nil {
- return nil, nil, nil, err
- }
if len(s.HostDeviceList) > 0 {
options = append(options, libpod.WithHostDevice(s.HostDeviceList))
}
@@ -286,6 +272,9 @@ func createContainerOptions(ctx context.Context, rt *libpod.Runtime, s *specgen.
if s.Volatile {
options = append(options, libpod.WithVolatile())
}
+ if s.PasswdEntry != "" {
+ options = append(options, libpod.WithPasswdEntry(s.PasswdEntry))
+ }
useSystemd := false
switch s.Systemd {