mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-29 22:46:12 +00:00
Fixes after runc libcontainer and docker update
- libcontainer renamed `github.com/opencontainers/runc/libcontainer/configs` to `github.com/opencontainers/runc/libcontainer/devices` so use the new references - Update `dockershim` `ContainerCreate` call after docker update to v20.10.2
This commit is contained in:
parent
b5dd78da3d
commit
904cb67267
@ -31,6 +31,7 @@ import (
|
||||
cgroupfs2 "github.com/opencontainers/runc/libcontainer/cgroups/fs2"
|
||||
cgroupsystemd "github.com/opencontainers/runc/libcontainer/cgroups/systemd"
|
||||
libcontainerconfigs "github.com/opencontainers/runc/libcontainer/configs"
|
||||
libcontainerdevices "github.com/opencontainers/runc/libcontainer/devices"
|
||||
"k8s.io/klog/v2"
|
||||
v1helper "k8s.io/kubernetes/pkg/apis/core/v1/helper"
|
||||
|
||||
@ -468,13 +469,13 @@ func setResourcesV2(cgroupConfig *libcontainerconfigs.Cgroup) error {
|
||||
if err := propagateControllers(cgroupConfig.Path); err != nil {
|
||||
return err
|
||||
}
|
||||
cgroupConfig.Resources.Devices = []*libcontainerconfigs.DeviceRule{
|
||||
cgroupConfig.Resources.Devices = []*libcontainerdevices.Rule{
|
||||
{
|
||||
Type: 'a',
|
||||
Permissions: "rwm",
|
||||
Allow: true,
|
||||
Minor: libcontainerconfigs.Wildcard,
|
||||
Major: libcontainerconfigs.Wildcard,
|
||||
Minor: libcontainerdevices.Wildcard,
|
||||
Major: libcontainerdevices.Wildcard,
|
||||
},
|
||||
}
|
||||
cgroupConfig.Resources.SkipDevices = true
|
||||
@ -499,13 +500,13 @@ func setResourcesV2(cgroupConfig *libcontainerconfigs.Cgroup) error {
|
||||
|
||||
func (m *cgroupManagerImpl) toResources(resourceConfig *ResourceConfig) *libcontainerconfigs.Resources {
|
||||
resources := &libcontainerconfigs.Resources{
|
||||
Devices: []*libcontainerconfigs.DeviceRule{
|
||||
Devices: []*libcontainerdevices.Rule{
|
||||
{
|
||||
Type: 'a',
|
||||
Permissions: "rwm",
|
||||
Allow: true,
|
||||
Minor: libcontainerconfigs.Wildcard,
|
||||
Major: libcontainerconfigs.Wildcard,
|
||||
Minor: libcontainerdevices.Wildcard,
|
||||
Major: libcontainerdevices.Wildcard,
|
||||
},
|
||||
},
|
||||
SkipDevices: true,
|
||||
|
@ -38,6 +38,7 @@ import (
|
||||
utilio "k8s.io/utils/io"
|
||||
utilpath "k8s.io/utils/path"
|
||||
|
||||
libcontainerdevices "github.com/opencontainers/runc/libcontainer/devices"
|
||||
v1 "k8s.io/api/core/v1"
|
||||
"k8s.io/apimachinery/pkg/api/resource"
|
||||
utilerrors "k8s.io/apimachinery/pkg/util/errors"
|
||||
@ -392,13 +393,13 @@ func createManager(containerName string) (cgroups.Manager, error) {
|
||||
Parent: "/",
|
||||
Name: containerName,
|
||||
Resources: &configs.Resources{
|
||||
Devices: []*configs.DeviceRule{
|
||||
Devices: []*libcontainerdevices.Rule{
|
||||
{
|
||||
Type: 'a',
|
||||
Permissions: "rwm",
|
||||
Allow: true,
|
||||
Minor: configs.Wildcard,
|
||||
Major: configs.Wildcard,
|
||||
Minor: libcontainerdevices.Wildcard,
|
||||
Major: libcontainerdevices.Wildcard,
|
||||
},
|
||||
},
|
||||
SkipDevices: true,
|
||||
|
@ -28,6 +28,7 @@ import (
|
||||
"github.com/opencontainers/runc/libcontainer/cgroups"
|
||||
cgroupfs "github.com/opencontainers/runc/libcontainer/cgroups/fs"
|
||||
"github.com/opencontainers/runc/libcontainer/configs"
|
||||
libcontainerdevices "github.com/opencontainers/runc/libcontainer/devices"
|
||||
utilversion "k8s.io/apimachinery/pkg/util/version"
|
||||
"k8s.io/apimachinery/pkg/util/wait"
|
||||
"k8s.io/klog/v2"
|
||||
@ -126,10 +127,10 @@ func createCgroupManager(name string) (cgroups.Manager, error) {
|
||||
Memory: int64(memoryLimit),
|
||||
MemorySwap: -1,
|
||||
SkipDevices: true,
|
||||
Devices: []*configs.DeviceRule{
|
||||
Devices: []*libcontainerdevices.Rule{
|
||||
{
|
||||
Minor: configs.Wildcard,
|
||||
Major: configs.Wildcard,
|
||||
Minor: libcontainerdevices.Wildcard,
|
||||
Major: libcontainerdevices.Wildcard,
|
||||
Type: 'a',
|
||||
Permissions: "rwm",
|
||||
Allow: true,
|
||||
|
@ -145,7 +145,7 @@ func (d *kubeDockerClient) CreateContainer(opts dockertypes.ContainerCreateConfi
|
||||
if opts.HostConfig != nil && opts.HostConfig.ShmSize <= 0 {
|
||||
opts.HostConfig.ShmSize = defaultShmSize
|
||||
}
|
||||
createResp, err := d.client.ContainerCreate(ctx, opts.Config, opts.HostConfig, opts.NetworkingConfig, opts.Name)
|
||||
createResp, err := d.client.ContainerCreate(ctx, opts.Config, opts.HostConfig, opts.NetworkingConfig, nil, opts.Name)
|
||||
if ctxErr := contextError(ctx); ctxErr != nil {
|
||||
return nil, ctxErr
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user