Merge pull request #126 from miaoyq/change-defaut-spec
Replace the original default spec with containerd default spec
This commit is contained in:
commit
86a0f6a59b
@ -22,6 +22,7 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/containerd/containerd"
|
||||||
"github.com/containerd/containerd/containers"
|
"github.com/containerd/containerd/containers"
|
||||||
prototypes "github.com/gogo/protobuf/types"
|
prototypes "github.com/gogo/protobuf/types"
|
||||||
"github.com/golang/glog"
|
"github.com/golang/glog"
|
||||||
@ -181,7 +182,11 @@ func (c *criContainerdService) CreateContainer(ctx context.Context, r *runtime.C
|
|||||||
func (c *criContainerdService) generateContainerSpec(id string, sandboxPid uint32, config *runtime.ContainerConfig,
|
func (c *criContainerdService) generateContainerSpec(id string, sandboxPid uint32, config *runtime.ContainerConfig,
|
||||||
sandboxConfig *runtime.PodSandboxConfig, imageConfig *imagespec.ImageConfig, extraMounts []*runtime.Mount) (*runtimespec.Spec, error) {
|
sandboxConfig *runtime.PodSandboxConfig, imageConfig *imagespec.ImageConfig, extraMounts []*runtime.Mount) (*runtimespec.Spec, error) {
|
||||||
// Creates a spec Generator with the default spec.
|
// Creates a spec Generator with the default spec.
|
||||||
g := generate.New()
|
spec, err := containerd.GenerateSpec()
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
g := generate.NewFromSpec(spec)
|
||||||
|
|
||||||
// Set the relative path to the rootfs of the container from containerd's
|
// Set the relative path to the rootfs of the container from containerd's
|
||||||
// pre-defined directory.
|
// pre-defined directory.
|
||||||
|
@ -23,6 +23,7 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/containerd/containerd"
|
||||||
"github.com/containerd/containerd/api/services/tasks/v1"
|
"github.com/containerd/containerd/api/services/tasks/v1"
|
||||||
"github.com/containerd/containerd/api/types"
|
"github.com/containerd/containerd/api/types"
|
||||||
"github.com/containerd/containerd/containers"
|
"github.com/containerd/containerd/containers"
|
||||||
@ -241,7 +242,11 @@ func (c *criContainerdService) generateSandboxContainerSpec(id string, config *r
|
|||||||
imageConfig *imagespec.ImageConfig) (*runtimespec.Spec, error) {
|
imageConfig *imagespec.ImageConfig) (*runtimespec.Spec, error) {
|
||||||
// Creates a spec Generator with the default spec.
|
// Creates a spec Generator with the default spec.
|
||||||
// TODO(random-liu): [P1] Compare the default settings with docker and containerd default.
|
// TODO(random-liu): [P1] Compare the default settings with docker and containerd default.
|
||||||
g := generate.New()
|
spec, err := containerd.GenerateSpec()
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
g := generate.NewFromSpec(spec)
|
||||||
|
|
||||||
// Apply default config from image config.
|
// Apply default config from image config.
|
||||||
if err := addImageEnvs(&g, imageConfig.Env); err != nil {
|
if err := addImageEnvs(&g, imageConfig.Env); err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user