move links for cri-containerd to cri
Signed-off-by: Mike Brown <brownwm@us.ibm.com>
This commit is contained in:
parent
135f667963
commit
d4e7154625
18
Makefile
18
Makefile
@ -16,12 +16,12 @@ GO := go
|
|||||||
GOOS := $(shell $(GO) env GOOS)
|
GOOS := $(shell $(GO) env GOOS)
|
||||||
GOARCH := $(shell $(GO) env GOARCH)
|
GOARCH := $(shell $(GO) env GOARCH)
|
||||||
EPOCH_TEST_COMMIT := f9e02affccd51702191e5312665a16045ffef8ab
|
EPOCH_TEST_COMMIT := f9e02affccd51702191e5312665a16045ffef8ab
|
||||||
PROJECT := github.com/containerd/cri-containerd
|
PROJECT := github.com/containerd/cri
|
||||||
BINDIR := ${DESTDIR}/usr/local/bin
|
BINDIR := ${DESTDIR}/usr/local/bin
|
||||||
BUILD_DIR := _output
|
BUILD_DIR := _output
|
||||||
# VERSION is derived from the current tag for HEAD plus amends. Version is used
|
# VERSION is derived from the current tag for HEAD plus amends. Version is used
|
||||||
# to set/overide the CRIContainerdVersion variable in the verison package for
|
# to set/overide the CRIContainerdVersion variable in the verison package for
|
||||||
# cri-containerd.
|
# cri plugin.
|
||||||
VERSION := $(shell git describe --tags --dirty --always)
|
VERSION := $(shell git describe --tags --dirty --always)
|
||||||
# strip the first char of the tag if it's a `v`
|
# strip the first char of the tag if it's a `v`
|
||||||
VERSION := $(VERSION:v%=%)
|
VERSION := $(VERSION:v%=%)
|
||||||
@ -50,17 +50,17 @@ help:
|
|||||||
@echo " * 'install-containerd' - Install customized containerd to system location"
|
@echo " * 'install-containerd' - Install customized containerd to system location"
|
||||||
@echo " * 'release' - Build release tarball"
|
@echo " * 'release' - Build release tarball"
|
||||||
@echo " * 'push' - Push release tarball to GCS"
|
@echo " * 'push' - Push release tarball to GCS"
|
||||||
@echo " * 'test' - Test cri-containerd with unit test"
|
@echo " * 'test' - Test cri with unit test"
|
||||||
@echo " * 'test-integration' - Test cri-containerd with integration test"
|
@echo " * 'test-integration' - Test cri with integration test"
|
||||||
@echo " * 'test-cri' - Test cri-containerd with cri validation test"
|
@echo " * 'test-cri' - Test cri with cri validation test"
|
||||||
@echo " * 'test-e2e-node' - Test cri-containerd with Kubernetes node e2e test"
|
@echo " * 'test-e2e-node' - Test cri with Kubernetes node e2e test"
|
||||||
@echo " * 'clean' - Clean artifacts"
|
@echo " * 'clean' - Clean artifacts"
|
||||||
@echo " * 'verify' - Execute the source code verification tools"
|
@echo " * 'verify' - Execute the source code verification tools"
|
||||||
@echo " * 'proto' - Update protobuf of cri-containerd api"
|
@echo " * 'proto' - Update protobuf of the cri plugin api"
|
||||||
@echo " * 'install.tools' - Install tools used by verify"
|
@echo " * 'install.tools' - Install tools used by verify"
|
||||||
@echo " * 'install.deps' - Install dependencies of cri-containerd (containerd, runc, cni) Note: BUILDTAGS defaults to 'seccomp apparmor' for runc build"
|
@echo " * 'install.deps' - Install dependencies of cri (Note: BUILDTAGS defaults to 'seccomp apparmor' for runc build")
|
||||||
@echo " * 'uninstall' - Remove installed binaries from system locations"
|
@echo " * 'uninstall' - Remove installed binaries from system locations"
|
||||||
@echo " * 'version' - Print current cri-containerd release version"
|
@echo " * 'version' - Print current cri plugin release version"
|
||||||
@echo " * 'update-vendor' - Syncs containerd/vendor.conf -> vendor.conf and sorts vendor.conf"
|
@echo " * 'update-vendor' - Syncs containerd/vendor.conf -> vendor.conf and sorts vendor.conf"
|
||||||
|
|
||||||
verify: lint gofmt boiler
|
verify: lint gofmt boiler
|
||||||
|
@ -37,7 +37,7 @@ import (
|
|||||||
_ "github.com/containerd/containerd/services/tasks"
|
_ "github.com/containerd/containerd/services/tasks"
|
||||||
_ "github.com/containerd/containerd/services/version"
|
_ "github.com/containerd/containerd/services/version"
|
||||||
_ "github.com/containerd/containerd/snapshots/overlay"
|
_ "github.com/containerd/containerd/snapshots/overlay"
|
||||||
_ "github.com/containerd/cri-containerd"
|
_ "github.com/containerd/cri"
|
||||||
|
|
||||||
"github.com/containerd/containerd/cmd/containerd/command"
|
"github.com/containerd/containerd/cmd/containerd/command"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
|
@ -24,16 +24,16 @@ import (
|
|||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
"github.com/spf13/pflag"
|
"github.com/spf13/pflag"
|
||||||
|
|
||||||
"github.com/containerd/cri-containerd/pkg/version"
|
"github.com/containerd/cri/pkg/version"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
// Add \u200B to avoid the space trimming.
|
// Add \u200B to avoid the space trimming.
|
||||||
desc = "\u200B" + ` __ _
|
desc = "\u200B" + ` __ _
|
||||||
_____/ /________________(_)
|
_____/ /________________(_)
|
||||||
/ ___/ __/ ___/ ___/ ___/ /
|
/ ___/ __/ ___/ ___/ ___/ /
|
||||||
/ /__/ /_/ / / /__/ / / /
|
/ /__/ /_/ / / /__/ / / /
|
||||||
\___/\__/_/ \___/_/ /_/
|
\___/\__/_/ \___/_/ /_/
|
||||||
|
|
||||||
containerd CRI plugin CLI
|
containerd CRI plugin CLI
|
||||||
`
|
`
|
||||||
|
@ -25,8 +25,8 @@ import (
|
|||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
"golang.org/x/net/context"
|
"golang.org/x/net/context"
|
||||||
|
|
||||||
api "github.com/containerd/cri-containerd/pkg/api/v1"
|
api "github.com/containerd/cri/pkg/api/v1"
|
||||||
"github.com/containerd/cri-containerd/pkg/client"
|
"github.com/containerd/cri/pkg/client"
|
||||||
)
|
)
|
||||||
|
|
||||||
func dedent(s string) string {
|
func dedent(s string) string {
|
||||||
|
6
cri.go
6
cri.go
@ -37,9 +37,9 @@ import (
|
|||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
|
|
||||||
criconfig "github.com/containerd/cri-containerd/pkg/config"
|
criconfig "github.com/containerd/cri/pkg/config"
|
||||||
"github.com/containerd/cri-containerd/pkg/constants"
|
"github.com/containerd/cri/pkg/constants"
|
||||||
"github.com/containerd/cri-containerd/pkg/server"
|
"github.com/containerd/cri/pkg/server"
|
||||||
)
|
)
|
||||||
|
|
||||||
// TODO(random-liu): Use github.com/pkg/errors for our errors.
|
// TODO(random-liu): Use github.com/pkg/errors for our errors.
|
||||||
|
@ -62,7 +62,7 @@ RUNC_PKG=github.com/opencontainers/runc
|
|||||||
CNI_PKG=github.com/containernetworking/plugins
|
CNI_PKG=github.com/containernetworking/plugins
|
||||||
CONTAINERD_PKG=github.com/containerd/containerd
|
CONTAINERD_PKG=github.com/containerd/containerd
|
||||||
CRITOOL_PKG=github.com/kubernetes-incubator/cri-tools
|
CRITOOL_PKG=github.com/kubernetes-incubator/cri-tools
|
||||||
CRI_CONTAINERD_PKG=github.com/containerd/cri-containerd
|
CRI_CONTAINERD_PKG=github.com/containerd/cri
|
||||||
|
|
||||||
# Create a temporary GOPATH for make install.deps.
|
# Create a temporary GOPATH for make install.deps.
|
||||||
TMPGOPATH=$(mktemp -d /tmp/cri-containerd-install-deps.XXXX)
|
TMPGOPATH=$(mktemp -d /tmp/cri-containerd-install-deps.XXXX)
|
||||||
|
@ -27,7 +27,7 @@ import (
|
|||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
runtime "k8s.io/kubernetes/pkg/kubelet/apis/cri/runtime/v1alpha2"
|
runtime "k8s.io/kubernetes/pkg/kubelet/apis/cri/runtime/v1alpha2"
|
||||||
|
|
||||||
api "github.com/containerd/cri-containerd/pkg/api/v1"
|
api "github.com/containerd/cri/pkg/api/v1"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Test to load an image from tarball.
|
// Test to load an image from tarball.
|
||||||
@ -50,14 +50,14 @@ func TestImageLoad(t *testing.T) {
|
|||||||
output, err = exec.Command("docker", "save", testImage, "-o", tar).CombinedOutput()
|
output, err = exec.Command("docker", "save", testImage, "-o", tar).CombinedOutput()
|
||||||
require.NoError(t, err, "output: %q", output)
|
require.NoError(t, err, "output: %q", output)
|
||||||
|
|
||||||
t.Logf("make sure no such image in cri-containerd")
|
t.Logf("make sure no such image in cri")
|
||||||
img, err := imageService.ImageStatus(&runtime.ImageSpec{Image: testImage})
|
img, err := imageService.ImageStatus(&runtime.ImageSpec{Image: testImage})
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
if img != nil {
|
if img != nil {
|
||||||
require.NoError(t, imageService.RemoveImage(&runtime.ImageSpec{Image: testImage}))
|
require.NoError(t, imageService.RemoveImage(&runtime.ImageSpec{Image: testImage}))
|
||||||
}
|
}
|
||||||
|
|
||||||
t.Logf("load image in cri-containerd")
|
t.Logf("load image in cri")
|
||||||
res, err := criContainerdClient.LoadImage(context.Background(), &api.LoadImageRequest{FilePath: tar})
|
res, err := criContainerdClient.LoadImage(context.Background(), &api.LoadImageRequest{FilePath: tar})
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
require.Equal(t, []string{loadedImage}, res.GetImages())
|
require.Equal(t, []string{loadedImage}, res.GetImages())
|
||||||
|
@ -31,10 +31,10 @@ import (
|
|||||||
runtime "k8s.io/kubernetes/pkg/kubelet/apis/cri/runtime/v1alpha2"
|
runtime "k8s.io/kubernetes/pkg/kubelet/apis/cri/runtime/v1alpha2"
|
||||||
"k8s.io/kubernetes/pkg/kubelet/remote"
|
"k8s.io/kubernetes/pkg/kubelet/remote"
|
||||||
|
|
||||||
api "github.com/containerd/cri-containerd/pkg/api/v1"
|
api "github.com/containerd/cri/pkg/api/v1"
|
||||||
"github.com/containerd/cri-containerd/pkg/client"
|
"github.com/containerd/cri/pkg/client"
|
||||||
"github.com/containerd/cri-containerd/pkg/constants"
|
"github.com/containerd/cri/pkg/constants"
|
||||||
"github.com/containerd/cri-containerd/pkg/util"
|
"github.com/containerd/cri/pkg/util"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -48,7 +48,7 @@ func TestTruncIndex(t *testing.T) {
|
|||||||
// if you add n images at least two will share the same leading digit.
|
// if you add n images at least two will share the same leading digit.
|
||||||
// "sha256:n" where n is the a number from 0-9 where two images have the same trunc,
|
// "sha256:n" where n is the a number from 0-9 where two images have the same trunc,
|
||||||
// for example sha256:9
|
// for example sha256:9
|
||||||
// https://github.com/containerd/cri-containerd/pull/352
|
// https://github.com/containerd/cri/pull/352
|
||||||
// I am thinking how I get the two image which have same trunc.
|
// I am thinking how I get the two image which have same trunc.
|
||||||
|
|
||||||
// TODO(yanxuean): add test case for ListImages
|
// TODO(yanxuean): add test case for ListImages
|
||||||
|
@ -23,7 +23,7 @@ import (
|
|||||||
"google.golang.org/grpc"
|
"google.golang.org/grpc"
|
||||||
"k8s.io/kubernetes/pkg/kubelet/util"
|
"k8s.io/kubernetes/pkg/kubelet/util"
|
||||||
|
|
||||||
api "github.com/containerd/cri-containerd/pkg/api/v1"
|
api "github.com/containerd/cri/pkg/api/v1"
|
||||||
)
|
)
|
||||||
|
|
||||||
// NewCRIContainerdClient creates grpc client of cri-containerd
|
// NewCRIContainerdClient creates grpc client of cri-containerd
|
||||||
|
@ -36,8 +36,8 @@ import (
|
|||||||
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
|
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
|
|
||||||
ctrdutil "github.com/containerd/cri-containerd/pkg/containerd/util"
|
ctrdutil "github.com/containerd/cri/pkg/containerd/util"
|
||||||
"github.com/containerd/cri-containerd/pkg/util"
|
"github.com/containerd/cri/pkg/util"
|
||||||
)
|
)
|
||||||
|
|
||||||
// This code reuses the docker import code from containerd/containerd#1602.
|
// This code reuses the docker import code from containerd/containerd#1602.
|
||||||
|
@ -22,7 +22,7 @@ import (
|
|||||||
"github.com/containerd/containerd/namespaces"
|
"github.com/containerd/containerd/namespaces"
|
||||||
"golang.org/x/net/context"
|
"golang.org/x/net/context"
|
||||||
|
|
||||||
"github.com/containerd/cri-containerd/pkg/constants"
|
"github.com/containerd/cri/pkg/constants"
|
||||||
)
|
)
|
||||||
|
|
||||||
// deferCleanupTimeout is the default timeout for containerd cleanup operations
|
// deferCleanupTimeout is the default timeout for containerd cleanup operations
|
||||||
|
@ -24,7 +24,7 @@ import (
|
|||||||
containerdmount "github.com/containerd/containerd/mount"
|
containerdmount "github.com/containerd/containerd/mount"
|
||||||
"golang.org/x/net/context"
|
"golang.org/x/net/context"
|
||||||
|
|
||||||
osInterface "github.com/containerd/cri-containerd/pkg/os"
|
osInterface "github.com/containerd/cri/pkg/os"
|
||||||
)
|
)
|
||||||
|
|
||||||
// CalledDetail is the struct contains called function name and arguments.
|
// CalledDetail is the struct contains called function name and arguments.
|
||||||
|
@ -26,7 +26,7 @@ import (
|
|||||||
"k8s.io/client-go/tools/remotecommand"
|
"k8s.io/client-go/tools/remotecommand"
|
||||||
runtime "k8s.io/kubernetes/pkg/kubelet/apis/cri/runtime/v1alpha2"
|
runtime "k8s.io/kubernetes/pkg/kubelet/apis/cri/runtime/v1alpha2"
|
||||||
|
|
||||||
cio "github.com/containerd/cri-containerd/pkg/server/io"
|
cio "github.com/containerd/cri/pkg/server/io"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Attach prepares a streaming endpoint to attach to a running container, and returns the address.
|
// Attach prepares a streaming endpoint to attach to a running container, and returns the address.
|
||||||
|
@ -44,12 +44,12 @@ import (
|
|||||||
"golang.org/x/sys/unix"
|
"golang.org/x/sys/unix"
|
||||||
runtime "k8s.io/kubernetes/pkg/kubelet/apis/cri/runtime/v1alpha2"
|
runtime "k8s.io/kubernetes/pkg/kubelet/apis/cri/runtime/v1alpha2"
|
||||||
|
|
||||||
"github.com/containerd/cri-containerd/pkg/annotations"
|
"github.com/containerd/cri/pkg/annotations"
|
||||||
customopts "github.com/containerd/cri-containerd/pkg/containerd/opts"
|
customopts "github.com/containerd/cri/pkg/containerd/opts"
|
||||||
ctrdutil "github.com/containerd/cri-containerd/pkg/containerd/util"
|
ctrdutil "github.com/containerd/cri/pkg/containerd/util"
|
||||||
cio "github.com/containerd/cri-containerd/pkg/server/io"
|
cio "github.com/containerd/cri/pkg/server/io"
|
||||||
containerstore "github.com/containerd/cri-containerd/pkg/store/container"
|
containerstore "github.com/containerd/cri/pkg/store/container"
|
||||||
"github.com/containerd/cri-containerd/pkg/util"
|
"github.com/containerd/cri/pkg/util"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@ -69,7 +69,7 @@ const (
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
typeurl.Register(&containerstore.Metadata{},
|
typeurl.Register(&containerstore.Metadata{},
|
||||||
"github.com/containerd/cri-containerd/pkg/store/container", "Metadata")
|
"github.com/containerd/cri/pkg/store/container", "Metadata")
|
||||||
}
|
}
|
||||||
|
|
||||||
// CreateContainer creates a new container in the given PodSandbox.
|
// CreateContainer creates a new container in the given PodSandbox.
|
||||||
|
@ -32,9 +32,9 @@ import (
|
|||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
runtime "k8s.io/kubernetes/pkg/kubelet/apis/cri/runtime/v1alpha2"
|
runtime "k8s.io/kubernetes/pkg/kubelet/apis/cri/runtime/v1alpha2"
|
||||||
|
|
||||||
"github.com/containerd/cri-containerd/pkg/annotations"
|
"github.com/containerd/cri/pkg/annotations"
|
||||||
ostesting "github.com/containerd/cri-containerd/pkg/os/testing"
|
ostesting "github.com/containerd/cri/pkg/os/testing"
|
||||||
"github.com/containerd/cri-containerd/pkg/util"
|
"github.com/containerd/cri/pkg/util"
|
||||||
)
|
)
|
||||||
|
|
||||||
func checkMount(t *testing.T, mounts []runtimespec.Mount, src, dest, typ string,
|
func checkMount(t *testing.T, mounts []runtimespec.Mount, src, dest, typ string,
|
||||||
|
@ -31,10 +31,10 @@ import (
|
|||||||
"k8s.io/client-go/tools/remotecommand"
|
"k8s.io/client-go/tools/remotecommand"
|
||||||
runtime "k8s.io/kubernetes/pkg/kubelet/apis/cri/runtime/v1alpha2"
|
runtime "k8s.io/kubernetes/pkg/kubelet/apis/cri/runtime/v1alpha2"
|
||||||
|
|
||||||
ctrdutil "github.com/containerd/cri-containerd/pkg/containerd/util"
|
ctrdutil "github.com/containerd/cri/pkg/containerd/util"
|
||||||
cioutil "github.com/containerd/cri-containerd/pkg/ioutil"
|
cioutil "github.com/containerd/cri/pkg/ioutil"
|
||||||
cio "github.com/containerd/cri-containerd/pkg/server/io"
|
cio "github.com/containerd/cri/pkg/server/io"
|
||||||
"github.com/containerd/cri-containerd/pkg/util"
|
"github.com/containerd/cri/pkg/util"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ExecSync executes a command in the container, and returns the stdout output.
|
// ExecSync executes a command in the container, and returns the stdout output.
|
||||||
|
@ -21,7 +21,7 @@ import (
|
|||||||
|
|
||||||
runtime "k8s.io/kubernetes/pkg/kubelet/apis/cri/runtime/v1alpha2"
|
runtime "k8s.io/kubernetes/pkg/kubelet/apis/cri/runtime/v1alpha2"
|
||||||
|
|
||||||
containerstore "github.com/containerd/cri-containerd/pkg/store/container"
|
containerstore "github.com/containerd/cri/pkg/store/container"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ListContainers lists all containers matching the filter.
|
// ListContainers lists all containers matching the filter.
|
||||||
|
@ -25,8 +25,8 @@ import (
|
|||||||
"golang.org/x/net/context"
|
"golang.org/x/net/context"
|
||||||
runtime "k8s.io/kubernetes/pkg/kubelet/apis/cri/runtime/v1alpha2"
|
runtime "k8s.io/kubernetes/pkg/kubelet/apis/cri/runtime/v1alpha2"
|
||||||
|
|
||||||
containerstore "github.com/containerd/cri-containerd/pkg/store/container"
|
containerstore "github.com/containerd/cri/pkg/store/container"
|
||||||
sandboxstore "github.com/containerd/cri-containerd/pkg/store/sandbox"
|
sandboxstore "github.com/containerd/cri/pkg/store/sandbox"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestToCRIContainer(t *testing.T) {
|
func TestToCRIContainer(t *testing.T) {
|
||||||
|
@ -23,7 +23,7 @@ import (
|
|||||||
runtime "k8s.io/kubernetes/pkg/kubelet/apis/cri/runtime/v1alpha2"
|
runtime "k8s.io/kubernetes/pkg/kubelet/apis/cri/runtime/v1alpha2"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ReopenContainerLog asks cri-containerd to reopen the stdout/stderr log file for the container.
|
// ReopenContainerLog asks the cri plugin to reopen the stdout/stderr log file for the container.
|
||||||
// This is often called after the log file has been rotated.
|
// This is often called after the log file has been rotated.
|
||||||
func (c *criContainerdService) ReopenContainerLog(ctx context.Context, r *runtime.ReopenContainerLogRequest) (*runtime.ReopenContainerLogResponse, error) {
|
func (c *criContainerdService) ReopenContainerLog(ctx context.Context, r *runtime.ReopenContainerLogRequest) (*runtime.ReopenContainerLogResponse, error) {
|
||||||
container, err := c.containerStore.Get(r.GetContainerId())
|
container, err := c.containerStore.Get(r.GetContainerId())
|
||||||
|
@ -26,9 +26,9 @@ import (
|
|||||||
"golang.org/x/net/context"
|
"golang.org/x/net/context"
|
||||||
runtime "k8s.io/kubernetes/pkg/kubelet/apis/cri/runtime/v1alpha2"
|
runtime "k8s.io/kubernetes/pkg/kubelet/apis/cri/runtime/v1alpha2"
|
||||||
|
|
||||||
"github.com/containerd/cri-containerd/pkg/log"
|
"github.com/containerd/cri/pkg/log"
|
||||||
"github.com/containerd/cri-containerd/pkg/store"
|
"github.com/containerd/cri/pkg/store"
|
||||||
containerstore "github.com/containerd/cri-containerd/pkg/store/container"
|
containerstore "github.com/containerd/cri/pkg/store/container"
|
||||||
)
|
)
|
||||||
|
|
||||||
// RemoveContainer removes the container.
|
// RemoveContainer removes the container.
|
||||||
|
@ -22,7 +22,7 @@ import (
|
|||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
|
|
||||||
containerstore "github.com/containerd/cri-containerd/pkg/store/container"
|
containerstore "github.com/containerd/cri/pkg/store/container"
|
||||||
)
|
)
|
||||||
|
|
||||||
// TestSetContainerRemoving tests setContainerRemoving sets removing
|
// TestSetContainerRemoving tests setContainerRemoving sets removing
|
||||||
|
@ -28,10 +28,10 @@ import (
|
|||||||
"golang.org/x/net/context"
|
"golang.org/x/net/context"
|
||||||
runtime "k8s.io/kubernetes/pkg/kubelet/apis/cri/runtime/v1alpha2"
|
runtime "k8s.io/kubernetes/pkg/kubelet/apis/cri/runtime/v1alpha2"
|
||||||
|
|
||||||
ctrdutil "github.com/containerd/cri-containerd/pkg/containerd/util"
|
ctrdutil "github.com/containerd/cri/pkg/containerd/util"
|
||||||
cio "github.com/containerd/cri-containerd/pkg/server/io"
|
cio "github.com/containerd/cri/pkg/server/io"
|
||||||
containerstore "github.com/containerd/cri-containerd/pkg/store/container"
|
containerstore "github.com/containerd/cri/pkg/store/container"
|
||||||
sandboxstore "github.com/containerd/cri-containerd/pkg/store/sandbox"
|
sandboxstore "github.com/containerd/cri/pkg/store/sandbox"
|
||||||
)
|
)
|
||||||
|
|
||||||
// StartContainer starts the container.
|
// StartContainer starts the container.
|
||||||
|
@ -26,7 +26,7 @@ import (
|
|||||||
"golang.org/x/net/context"
|
"golang.org/x/net/context"
|
||||||
runtime "k8s.io/kubernetes/pkg/kubelet/apis/cri/runtime/v1alpha2"
|
runtime "k8s.io/kubernetes/pkg/kubelet/apis/cri/runtime/v1alpha2"
|
||||||
|
|
||||||
containerstore "github.com/containerd/cri-containerd/pkg/store/container"
|
containerstore "github.com/containerd/cri/pkg/store/container"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ListContainerStats returns stats of all running containers.
|
// ListContainerStats returns stats of all running containers.
|
||||||
|
@ -25,7 +25,7 @@ import (
|
|||||||
"golang.org/x/net/context"
|
"golang.org/x/net/context"
|
||||||
runtime "k8s.io/kubernetes/pkg/kubelet/apis/cri/runtime/v1alpha2"
|
runtime "k8s.io/kubernetes/pkg/kubelet/apis/cri/runtime/v1alpha2"
|
||||||
|
|
||||||
containerstore "github.com/containerd/cri-containerd/pkg/store/container"
|
containerstore "github.com/containerd/cri/pkg/store/container"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ContainerStatus inspects the container and returns the status.
|
// ContainerStatus inspects the container and returns the status.
|
||||||
|
@ -24,8 +24,8 @@ import (
|
|||||||
"golang.org/x/net/context"
|
"golang.org/x/net/context"
|
||||||
runtime "k8s.io/kubernetes/pkg/kubelet/apis/cri/runtime/v1alpha2"
|
runtime "k8s.io/kubernetes/pkg/kubelet/apis/cri/runtime/v1alpha2"
|
||||||
|
|
||||||
containerstore "github.com/containerd/cri-containerd/pkg/store/container"
|
containerstore "github.com/containerd/cri/pkg/store/container"
|
||||||
imagestore "github.com/containerd/cri-containerd/pkg/store/image"
|
imagestore "github.com/containerd/cri/pkg/store/image"
|
||||||
)
|
)
|
||||||
|
|
||||||
func getContainerStatusTestData() (*containerstore.Metadata, *containerstore.Status,
|
func getContainerStatusTestData() (*containerstore.Metadata, *containerstore.Status,
|
||||||
|
@ -28,7 +28,7 @@ import (
|
|||||||
"golang.org/x/sys/unix"
|
"golang.org/x/sys/unix"
|
||||||
runtime "k8s.io/kubernetes/pkg/kubelet/apis/cri/runtime/v1alpha2"
|
runtime "k8s.io/kubernetes/pkg/kubelet/apis/cri/runtime/v1alpha2"
|
||||||
|
|
||||||
containerstore "github.com/containerd/cri-containerd/pkg/store/container"
|
containerstore "github.com/containerd/cri/pkg/store/container"
|
||||||
)
|
)
|
||||||
|
|
||||||
// killContainerTimeout is the timeout that we wait for the container to
|
// killContainerTimeout is the timeout that we wait for the container to
|
||||||
|
@ -23,7 +23,7 @@ import (
|
|||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"golang.org/x/net/context"
|
"golang.org/x/net/context"
|
||||||
|
|
||||||
containerstore "github.com/containerd/cri-containerd/pkg/store/container"
|
containerstore "github.com/containerd/cri/pkg/store/container"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestWaitContainerStop(t *testing.T) {
|
func TestWaitContainerStop(t *testing.T) {
|
||||||
|
@ -29,9 +29,9 @@ import (
|
|||||||
"golang.org/x/net/context"
|
"golang.org/x/net/context"
|
||||||
runtime "k8s.io/kubernetes/pkg/kubelet/apis/cri/runtime/v1alpha2"
|
runtime "k8s.io/kubernetes/pkg/kubelet/apis/cri/runtime/v1alpha2"
|
||||||
|
|
||||||
ctrdutil "github.com/containerd/cri-containerd/pkg/containerd/util"
|
ctrdutil "github.com/containerd/cri/pkg/containerd/util"
|
||||||
containerstore "github.com/containerd/cri-containerd/pkg/store/container"
|
containerstore "github.com/containerd/cri/pkg/store/container"
|
||||||
"github.com/containerd/cri-containerd/pkg/util"
|
"github.com/containerd/cri/pkg/util"
|
||||||
)
|
)
|
||||||
|
|
||||||
// UpdateContainerResources updates ContainerConfig of the container.
|
// UpdateContainerResources updates ContainerConfig of the container.
|
||||||
|
@ -27,10 +27,10 @@ import (
|
|||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
"golang.org/x/net/context"
|
"golang.org/x/net/context"
|
||||||
|
|
||||||
ctrdutil "github.com/containerd/cri-containerd/pkg/containerd/util"
|
ctrdutil "github.com/containerd/cri/pkg/containerd/util"
|
||||||
"github.com/containerd/cri-containerd/pkg/store"
|
"github.com/containerd/cri/pkg/store"
|
||||||
containerstore "github.com/containerd/cri-containerd/pkg/store/container"
|
containerstore "github.com/containerd/cri/pkg/store/container"
|
||||||
sandboxstore "github.com/containerd/cri-containerd/pkg/store/sandbox"
|
sandboxstore "github.com/containerd/cri/pkg/store/sandbox"
|
||||||
)
|
)
|
||||||
|
|
||||||
// eventMonitor monitors containerd event and updates internal state correspondingly.
|
// eventMonitor monitors containerd event and updates internal state correspondingly.
|
||||||
|
@ -39,9 +39,9 @@ import (
|
|||||||
runtime "k8s.io/kubernetes/pkg/kubelet/apis/cri/runtime/v1alpha2"
|
runtime "k8s.io/kubernetes/pkg/kubelet/apis/cri/runtime/v1alpha2"
|
||||||
"k8s.io/kubernetes/pkg/util/sysctl"
|
"k8s.io/kubernetes/pkg/util/sysctl"
|
||||||
|
|
||||||
"github.com/containerd/cri-containerd/pkg/store"
|
"github.com/containerd/cri/pkg/store"
|
||||||
imagestore "github.com/containerd/cri-containerd/pkg/store/image"
|
imagestore "github.com/containerd/cri/pkg/store/image"
|
||||||
"github.com/containerd/cri-containerd/pkg/util"
|
"github.com/containerd/cri/pkg/util"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -22,7 +22,7 @@ import (
|
|||||||
imagedigest "github.com/opencontainers/go-digest"
|
imagedigest "github.com/opencontainers/go-digest"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
|
|
||||||
"github.com/containerd/cri-containerd/pkg/util"
|
"github.com/containerd/cri/pkg/util"
|
||||||
)
|
)
|
||||||
|
|
||||||
// TestGetUserFromImage tests the logic of getting image uid or user name of image user.
|
// TestGetUserFromImage tests the logic of getting image uid or user name of image user.
|
||||||
|
@ -20,7 +20,7 @@ import (
|
|||||||
"golang.org/x/net/context"
|
"golang.org/x/net/context"
|
||||||
runtime "k8s.io/kubernetes/pkg/kubelet/apis/cri/runtime/v1alpha2"
|
runtime "k8s.io/kubernetes/pkg/kubelet/apis/cri/runtime/v1alpha2"
|
||||||
|
|
||||||
imagestore "github.com/containerd/cri-containerd/pkg/store/image"
|
imagestore "github.com/containerd/cri/pkg/store/image"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ListImages lists existing images.
|
// ListImages lists existing images.
|
||||||
|
@ -25,7 +25,7 @@ import (
|
|||||||
"golang.org/x/net/context"
|
"golang.org/x/net/context"
|
||||||
runtime "k8s.io/kubernetes/pkg/kubelet/apis/cri/runtime/v1alpha2"
|
runtime "k8s.io/kubernetes/pkg/kubelet/apis/cri/runtime/v1alpha2"
|
||||||
|
|
||||||
imagestore "github.com/containerd/cri-containerd/pkg/store/image"
|
imagestore "github.com/containerd/cri/pkg/store/image"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestListImages(t *testing.T) {
|
func TestListImages(t *testing.T) {
|
||||||
|
@ -24,9 +24,9 @@ import (
|
|||||||
|
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
|
|
||||||
api "github.com/containerd/cri-containerd/pkg/api/v1"
|
api "github.com/containerd/cri/pkg/api/v1"
|
||||||
"github.com/containerd/cri-containerd/pkg/containerd/importer"
|
"github.com/containerd/cri/pkg/containerd/importer"
|
||||||
imagestore "github.com/containerd/cri-containerd/pkg/store/image"
|
imagestore "github.com/containerd/cri/pkg/store/image"
|
||||||
)
|
)
|
||||||
|
|
||||||
// LoadImage loads a image into containerd.
|
// LoadImage loads a image into containerd.
|
||||||
|
@ -30,9 +30,9 @@ import (
|
|||||||
"golang.org/x/net/context"
|
"golang.org/x/net/context"
|
||||||
runtime "k8s.io/kubernetes/pkg/kubelet/apis/cri/runtime/v1alpha2"
|
runtime "k8s.io/kubernetes/pkg/kubelet/apis/cri/runtime/v1alpha2"
|
||||||
|
|
||||||
containerdresolver "github.com/containerd/cri-containerd/pkg/containerd/resolver"
|
containerdresolver "github.com/containerd/cri/pkg/containerd/resolver"
|
||||||
imagestore "github.com/containerd/cri-containerd/pkg/store/image"
|
imagestore "github.com/containerd/cri/pkg/store/image"
|
||||||
"github.com/containerd/cri-containerd/pkg/util"
|
"github.com/containerd/cri/pkg/util"
|
||||||
)
|
)
|
||||||
|
|
||||||
// For image management:
|
// For image management:
|
||||||
@ -66,9 +66,9 @@ import (
|
|||||||
// an error occurrs during the pulling, should we remove the entry from metadata
|
// an error occurrs during the pulling, should we remove the entry from metadata
|
||||||
// store? Or should we leave it there until next startup (resource leakage)?
|
// store? Or should we leave it there until next startup (resource leakage)?
|
||||||
//
|
//
|
||||||
// 3) CRI-containerd only exposes "READY" (successfully pulled and unpacked) images
|
// 3) The cri plugin only exposes "READY" (successfully pulled and unpacked) images
|
||||||
// to the user, which are maintained in the in-memory metadata index. However, it's
|
// to the user, which are maintained in the in-memory metadata index. However, it's
|
||||||
// still possible that someone else removes the content or snapshot by-pass cri-containerd,
|
// still possible that someone else removes the content or snapshot by-pass the cri plugin,
|
||||||
// how do we detect that and update the in-memory metadata correspondingly? Always
|
// how do we detect that and update the in-memory metadata correspondingly? Always
|
||||||
// check whether corresponding snapshot is ready when reporting image status?
|
// check whether corresponding snapshot is ready when reporting image status?
|
||||||
//
|
//
|
||||||
|
@ -56,7 +56,7 @@ func (c *criContainerdService) RemoveImage(ctx context.Context, r *runtime.Remov
|
|||||||
// We can only get image id by reading Config from content.
|
// We can only get image id by reading Config from content.
|
||||||
// If the config is missing, we will fail to get image id,
|
// If the config is missing, we will fail to get image id,
|
||||||
// So we won't be able to remove the image forever,
|
// So we won't be able to remove the image forever,
|
||||||
// and cri-containerd always report the image is ok.
|
// and the cri plugin always reports the image is ok.
|
||||||
// But we also don't check it by manifest,
|
// But we also don't check it by manifest,
|
||||||
// It's possible that two manifest digests have the same image ID in theory.
|
// It's possible that two manifest digests have the same image ID in theory.
|
||||||
// In theory it's possible that an image is compressed with different algorithms,
|
// In theory it's possible that an image is compressed with different algorithms,
|
||||||
|
@ -24,7 +24,7 @@ import (
|
|||||||
"golang.org/x/net/context"
|
"golang.org/x/net/context"
|
||||||
runtime "k8s.io/kubernetes/pkg/kubelet/apis/cri/runtime/v1alpha2"
|
runtime "k8s.io/kubernetes/pkg/kubelet/apis/cri/runtime/v1alpha2"
|
||||||
|
|
||||||
imagestore "github.com/containerd/cri-containerd/pkg/store/image"
|
imagestore "github.com/containerd/cri/pkg/store/image"
|
||||||
imagespec "github.com/opencontainers/image-spec/specs-go/v1"
|
imagespec "github.com/opencontainers/image-spec/specs-go/v1"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ import (
|
|||||||
"golang.org/x/net/context"
|
"golang.org/x/net/context"
|
||||||
runtime "k8s.io/kubernetes/pkg/kubelet/apis/cri/runtime/v1alpha2"
|
runtime "k8s.io/kubernetes/pkg/kubelet/apis/cri/runtime/v1alpha2"
|
||||||
|
|
||||||
imagestore "github.com/containerd/cri-containerd/pkg/store/image"
|
imagestore "github.com/containerd/cri/pkg/store/image"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestImageStatus(t *testing.T) {
|
func TestImageStatus(t *testing.T) {
|
||||||
|
@ -25,7 +25,7 @@ import (
|
|||||||
"golang.org/x/net/context"
|
"golang.org/x/net/context"
|
||||||
runtime "k8s.io/kubernetes/pkg/kubelet/apis/cri/runtime/v1alpha2"
|
runtime "k8s.io/kubernetes/pkg/kubelet/apis/cri/runtime/v1alpha2"
|
||||||
|
|
||||||
snapshotstore "github.com/containerd/cri-containerd/pkg/store/snapshot"
|
snapshotstore "github.com/containerd/cri/pkg/store/snapshot"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestImageFsInfo(t *testing.T) {
|
func TestImageFsInfo(t *testing.T) {
|
||||||
|
@ -23,9 +23,9 @@ import (
|
|||||||
"golang.org/x/net/context"
|
"golang.org/x/net/context"
|
||||||
runtime "k8s.io/kubernetes/pkg/kubelet/apis/cri/runtime/v1alpha2"
|
runtime "k8s.io/kubernetes/pkg/kubelet/apis/cri/runtime/v1alpha2"
|
||||||
|
|
||||||
api "github.com/containerd/cri-containerd/pkg/api/v1"
|
api "github.com/containerd/cri/pkg/api/v1"
|
||||||
ctrdutil "github.com/containerd/cri-containerd/pkg/containerd/util"
|
ctrdutil "github.com/containerd/cri/pkg/containerd/util"
|
||||||
"github.com/containerd/cri-containerd/pkg/log"
|
"github.com/containerd/cri/pkg/log"
|
||||||
)
|
)
|
||||||
|
|
||||||
// instrumentedService wraps service with containerd namespace and logs.
|
// instrumentedService wraps service with containerd namespace and logs.
|
||||||
|
@ -25,8 +25,8 @@ import (
|
|||||||
"github.com/containerd/containerd/cio"
|
"github.com/containerd/containerd/cio"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
|
|
||||||
cioutil "github.com/containerd/cri-containerd/pkg/ioutil"
|
cioutil "github.com/containerd/cri/pkg/ioutil"
|
||||||
"github.com/containerd/cri-containerd/pkg/util"
|
"github.com/containerd/cri/pkg/util"
|
||||||
)
|
)
|
||||||
|
|
||||||
// streamKey generates a key for the stream.
|
// streamKey generates a key for the stream.
|
||||||
|
@ -23,7 +23,7 @@ import (
|
|||||||
"github.com/containerd/containerd/cio"
|
"github.com/containerd/containerd/cio"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
|
|
||||||
cioutil "github.com/containerd/cri-containerd/pkg/ioutil"
|
cioutil "github.com/containerd/cri/pkg/ioutil"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ExecIO holds the exec io.
|
// ExecIO holds the exec io.
|
||||||
|
@ -28,7 +28,7 @@ import (
|
|||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
runtime "k8s.io/kubernetes/pkg/kubelet/apis/cri/runtime/v1alpha2"
|
runtime "k8s.io/kubernetes/pkg/kubelet/apis/cri/runtime/v1alpha2"
|
||||||
|
|
||||||
cioutil "github.com/containerd/cri-containerd/pkg/ioutil"
|
cioutil "github.com/containerd/cri/pkg/ioutil"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -27,7 +27,7 @@ import (
|
|||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
runtime "k8s.io/kubernetes/pkg/kubelet/apis/cri/runtime/v1alpha2"
|
runtime "k8s.io/kubernetes/pkg/kubelet/apis/cri/runtime/v1alpha2"
|
||||||
|
|
||||||
cioutil "github.com/containerd/cri-containerd/pkg/ioutil"
|
cioutil "github.com/containerd/cri/pkg/ioutil"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestRedirectLogs(t *testing.T) {
|
func TestRedirectLogs(t *testing.T) {
|
||||||
|
@ -35,14 +35,14 @@ import (
|
|||||||
"golang.org/x/net/context"
|
"golang.org/x/net/context"
|
||||||
runtime "k8s.io/kubernetes/pkg/kubelet/apis/cri/runtime/v1alpha2"
|
runtime "k8s.io/kubernetes/pkg/kubelet/apis/cri/runtime/v1alpha2"
|
||||||
|
|
||||||
cio "github.com/containerd/cri-containerd/pkg/server/io"
|
cio "github.com/containerd/cri/pkg/server/io"
|
||||||
containerstore "github.com/containerd/cri-containerd/pkg/store/container"
|
containerstore "github.com/containerd/cri/pkg/store/container"
|
||||||
imagestore "github.com/containerd/cri-containerd/pkg/store/image"
|
imagestore "github.com/containerd/cri/pkg/store/image"
|
||||||
sandboxstore "github.com/containerd/cri-containerd/pkg/store/sandbox"
|
sandboxstore "github.com/containerd/cri/pkg/store/sandbox"
|
||||||
)
|
)
|
||||||
|
|
||||||
// NOTE: The recovery logic has following assumption: when cri-containerd is down:
|
// NOTE: The recovery logic has following assumption: when the cri plugin is down:
|
||||||
// 1) Files (e.g. root directory, netns) and checkpoint maintained by cri-containerd MUST NOT be
|
// 1) Files (e.g. root directory, netns) and checkpoint maintained by the plugin MUST NOT be
|
||||||
// touched. Or else, recovery logic for those containers/sandboxes may return error.
|
// touched. Or else, recovery logic for those containers/sandboxes may return error.
|
||||||
// 2) Containerd containers may be deleted, but SHOULD NOT be added. Or else, recovery logic
|
// 2) Containerd containers may be deleted, but SHOULD NOT be added. Or else, recovery logic
|
||||||
// for the newly added container/sandbox will return error, because there is no corresponding root
|
// for the newly added container/sandbox will return error, because there is no corresponding root
|
||||||
@ -194,7 +194,7 @@ func loadContainer(ctx context.Context, cntr containerd.Container, containerDir
|
|||||||
switch status.State() {
|
switch status.State() {
|
||||||
case runtime.ContainerState_CONTAINER_CREATED:
|
case runtime.ContainerState_CONTAINER_CREATED:
|
||||||
// NOTE: Another possibility is that we've tried to start the container, but
|
// NOTE: Another possibility is that we've tried to start the container, but
|
||||||
// cri-containerd got restarted just during that. In that case, we still
|
// containerd got restarted during that. In that case, we still
|
||||||
// treat the container as `CREATED`.
|
// treat the container as `CREATED`.
|
||||||
containerIO, err = cio.NewContainerIO(id,
|
containerIO, err = cio.NewContainerIO(id,
|
||||||
cio.WithNewFIFOs(containerDir, meta.Config.GetTty(), meta.Config.GetStdin()),
|
cio.WithNewFIFOs(containerDir, meta.Config.GetTty(), meta.Config.GetStdin()),
|
||||||
@ -215,7 +215,7 @@ func loadContainer(ctx context.Context, cntr containerd.Container, containerDir
|
|||||||
// Task status is found. Update container status based on the up-to-date task status.
|
// Task status is found. Update container status based on the up-to-date task status.
|
||||||
switch s.Status {
|
switch s.Status {
|
||||||
case containerd.Created:
|
case containerd.Created:
|
||||||
// Task has been created, but not started yet. This could only happen if cri-containerd
|
// Task has been created, but not started yet. This could only happen if containerd
|
||||||
// gets restarted during container start.
|
// gets restarted during container start.
|
||||||
// Container must be in `CREATED` state.
|
// Container must be in `CREATED` state.
|
||||||
if _, err := t.Delete(ctx, containerd.WithProcessKill); err != nil && !errdefs.IsNotFound(err) {
|
if _, err := t.Delete(ctx, containerd.WithProcessKill); err != nil && !errdefs.IsNotFound(err) {
|
||||||
@ -226,13 +226,13 @@ func loadContainer(ctx context.Context, cntr containerd.Container, containerDir
|
|||||||
}
|
}
|
||||||
case containerd.Running:
|
case containerd.Running:
|
||||||
// Task is running. Container must be in `RUNNING` state, based on our assuption that
|
// Task is running. Container must be in `RUNNING` state, based on our assuption that
|
||||||
// "task should not be started when cri-containerd is down".
|
// "task should not be started when containerd is down".
|
||||||
switch status.State() {
|
switch status.State() {
|
||||||
case runtime.ContainerState_CONTAINER_EXITED:
|
case runtime.ContainerState_CONTAINER_EXITED:
|
||||||
return container, fmt.Errorf("unexpected container state for running task: %q", status.State())
|
return container, fmt.Errorf("unexpected container state for running task: %q", status.State())
|
||||||
case runtime.ContainerState_CONTAINER_RUNNING:
|
case runtime.ContainerState_CONTAINER_RUNNING:
|
||||||
default:
|
default:
|
||||||
// This may happen if cri-containerd gets restarted after task is started, but
|
// This may happen if containerd gets restarted after task is started, but
|
||||||
// before status is checkpointed.
|
// before status is checkpointed.
|
||||||
status.StartedAt = time.Now().UnixNano()
|
status.StartedAt = time.Now().UnixNano()
|
||||||
status.Pid = t.Pid()
|
status.Pid = t.Pid()
|
||||||
|
@ -20,7 +20,7 @@ import (
|
|||||||
"golang.org/x/net/context"
|
"golang.org/x/net/context"
|
||||||
runtime "k8s.io/kubernetes/pkg/kubelet/apis/cri/runtime/v1alpha2"
|
runtime "k8s.io/kubernetes/pkg/kubelet/apis/cri/runtime/v1alpha2"
|
||||||
|
|
||||||
sandboxstore "github.com/containerd/cri-containerd/pkg/store/sandbox"
|
sandboxstore "github.com/containerd/cri/pkg/store/sandbox"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ListPodSandbox returns a list of Sandbox.
|
// ListPodSandbox returns a list of Sandbox.
|
||||||
|
@ -23,7 +23,7 @@ import (
|
|||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
runtime "k8s.io/kubernetes/pkg/kubelet/apis/cri/runtime/v1alpha2"
|
runtime "k8s.io/kubernetes/pkg/kubelet/apis/cri/runtime/v1alpha2"
|
||||||
|
|
||||||
sandboxstore "github.com/containerd/cri-containerd/pkg/store/sandbox"
|
sandboxstore "github.com/containerd/cri/pkg/store/sandbox"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestToCRISandbox(t *testing.T) {
|
func TestToCRISandbox(t *testing.T) {
|
||||||
|
@ -28,8 +28,8 @@ import (
|
|||||||
"golang.org/x/net/context"
|
"golang.org/x/net/context"
|
||||||
runtime "k8s.io/kubernetes/pkg/kubelet/apis/cri/runtime/v1alpha2"
|
runtime "k8s.io/kubernetes/pkg/kubelet/apis/cri/runtime/v1alpha2"
|
||||||
|
|
||||||
ctrdutil "github.com/containerd/cri-containerd/pkg/containerd/util"
|
ctrdutil "github.com/containerd/cri/pkg/containerd/util"
|
||||||
sandboxstore "github.com/containerd/cri-containerd/pkg/store/sandbox"
|
sandboxstore "github.com/containerd/cri/pkg/store/sandbox"
|
||||||
)
|
)
|
||||||
|
|
||||||
// PortForward prepares a streaming endpoint to forward ports from a PodSandbox, and returns the address.
|
// PortForward prepares a streaming endpoint to forward ports from a PodSandbox, and returns the address.
|
||||||
|
@ -25,9 +25,9 @@ import (
|
|||||||
"golang.org/x/net/context"
|
"golang.org/x/net/context"
|
||||||
runtime "k8s.io/kubernetes/pkg/kubelet/apis/cri/runtime/v1alpha2"
|
runtime "k8s.io/kubernetes/pkg/kubelet/apis/cri/runtime/v1alpha2"
|
||||||
|
|
||||||
"github.com/containerd/cri-containerd/pkg/log"
|
"github.com/containerd/cri/pkg/log"
|
||||||
"github.com/containerd/cri-containerd/pkg/store"
|
"github.com/containerd/cri/pkg/store"
|
||||||
sandboxstore "github.com/containerd/cri-containerd/pkg/store/sandbox"
|
sandboxstore "github.com/containerd/cri/pkg/store/sandbox"
|
||||||
)
|
)
|
||||||
|
|
||||||
// RemovePodSandbox removes the sandbox. If there are running containers in the
|
// RemovePodSandbox removes the sandbox. If there are running containers in the
|
||||||
|
@ -35,17 +35,17 @@ import (
|
|||||||
"golang.org/x/sys/unix"
|
"golang.org/x/sys/unix"
|
||||||
runtime "k8s.io/kubernetes/pkg/kubelet/apis/cri/runtime/v1alpha2"
|
runtime "k8s.io/kubernetes/pkg/kubelet/apis/cri/runtime/v1alpha2"
|
||||||
|
|
||||||
"github.com/containerd/cri-containerd/pkg/annotations"
|
"github.com/containerd/cri/pkg/annotations"
|
||||||
customopts "github.com/containerd/cri-containerd/pkg/containerd/opts"
|
customopts "github.com/containerd/cri/pkg/containerd/opts"
|
||||||
ctrdutil "github.com/containerd/cri-containerd/pkg/containerd/util"
|
ctrdutil "github.com/containerd/cri/pkg/containerd/util"
|
||||||
"github.com/containerd/cri-containerd/pkg/log"
|
"github.com/containerd/cri/pkg/log"
|
||||||
sandboxstore "github.com/containerd/cri-containerd/pkg/store/sandbox"
|
sandboxstore "github.com/containerd/cri/pkg/store/sandbox"
|
||||||
"github.com/containerd/cri-containerd/pkg/util"
|
"github.com/containerd/cri/pkg/util"
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
typeurl.Register(&sandboxstore.Metadata{},
|
typeurl.Register(&sandboxstore.Metadata{},
|
||||||
"github.com/containerd/cri-containerd/pkg/store/sandbox", "Metadata")
|
"github.com/containerd/cri/pkg/store/sandbox", "Metadata")
|
||||||
}
|
}
|
||||||
|
|
||||||
// RunPodSandbox creates and starts a pod-level sandbox. Runtimes should ensure
|
// RunPodSandbox creates and starts a pod-level sandbox. Runtimes should ensure
|
||||||
@ -140,7 +140,7 @@ func (c *criContainerdService) RunPodSandbox(ctx context.Context, r *runtime.Run
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to get network status for sandbox %q: %v", id, err)
|
return nil, fmt.Errorf("failed to get network status for sandbox %q: %v", id, err)
|
||||||
}
|
}
|
||||||
// Certain VM based solutions like clear containers (Issue containerd/cri-containerd#524)
|
// Certain VM based solutions like clear containers (Issue containerd/cri#524)
|
||||||
// rely on the assumption that CRI shim will not be querying the network namespace to check the
|
// rely on the assumption that CRI shim will not be querying the network namespace to check the
|
||||||
// network states such as IP.
|
// network states such as IP.
|
||||||
// In furture runtime implementation should avoid relying on CRI shim implementation details.
|
// In furture runtime implementation should avoid relying on CRI shim implementation details.
|
||||||
@ -258,7 +258,7 @@ func (c *criContainerdService) RunPodSandbox(ctx context.Context, r *runtime.Run
|
|||||||
// and before the end of this function.
|
// and before the end of this function.
|
||||||
// * If `Update` succeeds, sandbox state will become READY in one transaction.
|
// * If `Update` succeeds, sandbox state will become READY in one transaction.
|
||||||
// * If `Update` fails, sandbox will be removed from the store in the defer above.
|
// * If `Update` fails, sandbox will be removed from the store in the defer above.
|
||||||
// * If cri-containerd stops at any point before `Update` finishes, because sandbox
|
// * If containerd stops at any point before `Update` finishes, because sandbox
|
||||||
// state is not checkpointed, it will be recovered from corresponding containerd task
|
// state is not checkpointed, it will be recovered from corresponding containerd task
|
||||||
// status during restart:
|
// status during restart:
|
||||||
// * If the task is running, sandbox state will be READY,
|
// * If the task is running, sandbox state will be READY,
|
||||||
|
@ -20,7 +20,7 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/containerd/cri-containerd/pkg/annotations"
|
"github.com/containerd/cri/pkg/annotations"
|
||||||
"github.com/containerd/typeurl"
|
"github.com/containerd/typeurl"
|
||||||
"github.com/cri-o/ocicni/pkg/ocicni"
|
"github.com/cri-o/ocicni/pkg/ocicni"
|
||||||
imagespec "github.com/opencontainers/image-spec/specs-go/v1"
|
imagespec "github.com/opencontainers/image-spec/specs-go/v1"
|
||||||
@ -29,8 +29,8 @@ import (
|
|||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
runtime "k8s.io/kubernetes/pkg/kubelet/apis/cri/runtime/v1alpha2"
|
runtime "k8s.io/kubernetes/pkg/kubelet/apis/cri/runtime/v1alpha2"
|
||||||
|
|
||||||
ostesting "github.com/containerd/cri-containerd/pkg/os/testing"
|
ostesting "github.com/containerd/cri/pkg/os/testing"
|
||||||
sandboxstore "github.com/containerd/cri-containerd/pkg/store/sandbox"
|
sandboxstore "github.com/containerd/cri/pkg/store/sandbox"
|
||||||
)
|
)
|
||||||
|
|
||||||
func getRunPodSandboxTestData() (*runtime.PodSandboxConfig, *imagespec.ImageConfig, func(*testing.T, string, *runtimespec.Spec)) {
|
func getRunPodSandboxTestData() (*runtime.PodSandboxConfig, *imagespec.ImageConfig, func(*testing.T, string, *runtimespec.Spec)) {
|
||||||
|
@ -26,7 +26,7 @@ import (
|
|||||||
"golang.org/x/net/context"
|
"golang.org/x/net/context"
|
||||||
runtime "k8s.io/kubernetes/pkg/kubelet/apis/cri/runtime/v1alpha2"
|
runtime "k8s.io/kubernetes/pkg/kubelet/apis/cri/runtime/v1alpha2"
|
||||||
|
|
||||||
sandboxstore "github.com/containerd/cri-containerd/pkg/store/sandbox"
|
sandboxstore "github.com/containerd/cri/pkg/store/sandbox"
|
||||||
)
|
)
|
||||||
|
|
||||||
// PodSandboxStatus returns the status of the PodSandbox.
|
// PodSandboxStatus returns the status of the PodSandbox.
|
||||||
|
@ -23,7 +23,7 @@ import (
|
|||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
runtime "k8s.io/kubernetes/pkg/kubelet/apis/cri/runtime/v1alpha2"
|
runtime "k8s.io/kubernetes/pkg/kubelet/apis/cri/runtime/v1alpha2"
|
||||||
|
|
||||||
sandboxstore "github.com/containerd/cri-containerd/pkg/store/sandbox"
|
sandboxstore "github.com/containerd/cri/pkg/store/sandbox"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestPodSandboxStatus(t *testing.T) {
|
func TestPodSandboxStatus(t *testing.T) {
|
||||||
|
@ -28,7 +28,7 @@ import (
|
|||||||
"golang.org/x/net/context"
|
"golang.org/x/net/context"
|
||||||
runtime "k8s.io/kubernetes/pkg/kubelet/apis/cri/runtime/v1alpha2"
|
runtime "k8s.io/kubernetes/pkg/kubelet/apis/cri/runtime/v1alpha2"
|
||||||
|
|
||||||
sandboxstore "github.com/containerd/cri-containerd/pkg/store/sandbox"
|
sandboxstore "github.com/containerd/cri/pkg/store/sandbox"
|
||||||
)
|
)
|
||||||
|
|
||||||
// StopPodSandbox stops the sandbox. If there are any running containers in the
|
// StopPodSandbox stops the sandbox. If there are any running containers in the
|
||||||
@ -75,7 +75,7 @@ func (c *criContainerdService) StopPodSandbox(ctx context.Context, r *runtime.St
|
|||||||
return nil, fmt.Errorf("failed to destroy network for sandbox %q: %v", id, teardownErr)
|
return nil, fmt.Errorf("failed to destroy network for sandbox %q: %v", id, teardownErr)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*TODO:It is still possible that cri-containerd crashes after we teardown the network, but before we remove the network namespace.
|
/*TODO:It is still possible that containerd crashes after we teardown the network, but before we remove the network namespace.
|
||||||
In that case, we'll not be able to remove the sandbox anymore. The chance is slim, but we should be aware of that.
|
In that case, we'll not be able to remove the sandbox anymore. The chance is slim, but we should be aware of that.
|
||||||
In the future, once TearDownPod is idempotent, this will be fixed.*/
|
In the future, once TearDownPod is idempotent, this will be fixed.*/
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ import (
|
|||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"golang.org/x/net/context"
|
"golang.org/x/net/context"
|
||||||
|
|
||||||
sandboxstore "github.com/containerd/cri-containerd/pkg/store/sandbox"
|
sandboxstore "github.com/containerd/cri/pkg/store/sandbox"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestWaitSandboxStop(t *testing.T) {
|
func TestWaitSandboxStop(t *testing.T) {
|
||||||
|
@ -33,16 +33,16 @@ import (
|
|||||||
runtime "k8s.io/kubernetes/pkg/kubelet/apis/cri/runtime/v1alpha2"
|
runtime "k8s.io/kubernetes/pkg/kubelet/apis/cri/runtime/v1alpha2"
|
||||||
"k8s.io/kubernetes/pkg/kubelet/server/streaming"
|
"k8s.io/kubernetes/pkg/kubelet/server/streaming"
|
||||||
|
|
||||||
api "github.com/containerd/cri-containerd/pkg/api/v1"
|
api "github.com/containerd/cri/pkg/api/v1"
|
||||||
"github.com/containerd/cri-containerd/pkg/atomic"
|
"github.com/containerd/cri/pkg/atomic"
|
||||||
criconfig "github.com/containerd/cri-containerd/pkg/config"
|
criconfig "github.com/containerd/cri/pkg/config"
|
||||||
ctrdutil "github.com/containerd/cri-containerd/pkg/containerd/util"
|
ctrdutil "github.com/containerd/cri/pkg/containerd/util"
|
||||||
osinterface "github.com/containerd/cri-containerd/pkg/os"
|
osinterface "github.com/containerd/cri/pkg/os"
|
||||||
"github.com/containerd/cri-containerd/pkg/registrar"
|
"github.com/containerd/cri/pkg/registrar"
|
||||||
containerstore "github.com/containerd/cri-containerd/pkg/store/container"
|
containerstore "github.com/containerd/cri/pkg/store/container"
|
||||||
imagestore "github.com/containerd/cri-containerd/pkg/store/image"
|
imagestore "github.com/containerd/cri/pkg/store/image"
|
||||||
sandboxstore "github.com/containerd/cri-containerd/pkg/store/sandbox"
|
sandboxstore "github.com/containerd/cri/pkg/store/sandbox"
|
||||||
snapshotstore "github.com/containerd/cri-containerd/pkg/store/snapshot"
|
snapshotstore "github.com/containerd/cri/pkg/store/snapshot"
|
||||||
)
|
)
|
||||||
|
|
||||||
// grpcServices are all the grpc services provided by cri containerd.
|
// grpcServices are all the grpc services provided by cri containerd.
|
||||||
|
@ -17,14 +17,14 @@ limitations under the License.
|
|||||||
package server
|
package server
|
||||||
|
|
||||||
import (
|
import (
|
||||||
criconfig "github.com/containerd/cri-containerd/pkg/config"
|
criconfig "github.com/containerd/cri/pkg/config"
|
||||||
ostesting "github.com/containerd/cri-containerd/pkg/os/testing"
|
ostesting "github.com/containerd/cri/pkg/os/testing"
|
||||||
"github.com/containerd/cri-containerd/pkg/registrar"
|
"github.com/containerd/cri/pkg/registrar"
|
||||||
servertesting "github.com/containerd/cri-containerd/pkg/server/testing"
|
servertesting "github.com/containerd/cri/pkg/server/testing"
|
||||||
containerstore "github.com/containerd/cri-containerd/pkg/store/container"
|
containerstore "github.com/containerd/cri/pkg/store/container"
|
||||||
imagestore "github.com/containerd/cri-containerd/pkg/store/image"
|
imagestore "github.com/containerd/cri/pkg/store/image"
|
||||||
sandboxstore "github.com/containerd/cri-containerd/pkg/store/sandbox"
|
sandboxstore "github.com/containerd/cri/pkg/store/sandbox"
|
||||||
snapshotstore "github.com/containerd/cri-containerd/pkg/store/snapshot"
|
snapshotstore "github.com/containerd/cri/pkg/store/snapshot"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -25,8 +25,8 @@ import (
|
|||||||
snapshot "github.com/containerd/containerd/snapshots"
|
snapshot "github.com/containerd/containerd/snapshots"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
|
|
||||||
ctrdutil "github.com/containerd/cri-containerd/pkg/containerd/util"
|
ctrdutil "github.com/containerd/cri/pkg/containerd/util"
|
||||||
snapshotstore "github.com/containerd/cri-containerd/pkg/store/snapshot"
|
snapshotstore "github.com/containerd/cri/pkg/store/snapshot"
|
||||||
)
|
)
|
||||||
|
|
||||||
// snapshotsSyncer syncs snapshot stats periodically. imagefs info and container stats
|
// snapshotsSyncer syncs snapshot stats periodically. imagefs info and container stats
|
||||||
|
@ -28,7 +28,7 @@ import (
|
|||||||
"k8s.io/kubernetes/pkg/kubelet/server/streaming"
|
"k8s.io/kubernetes/pkg/kubelet/server/streaming"
|
||||||
"k8s.io/utils/exec"
|
"k8s.io/utils/exec"
|
||||||
|
|
||||||
ctrdutil "github.com/containerd/cri-containerd/pkg/containerd/util"
|
ctrdutil "github.com/containerd/cri/pkg/containerd/util"
|
||||||
)
|
)
|
||||||
|
|
||||||
func newStreamServer(c *criContainerdService, addr, port string) (streaming.Server, error) {
|
func newStreamServer(c *criContainerdService, addr, port string) (streaming.Server, error) {
|
||||||
|
@ -23,7 +23,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// UpdateRuntimeConfig updates the runtime config. Currently only handles podCIDR updates.
|
// UpdateRuntimeConfig updates the runtime config. Currently only handles podCIDR updates.
|
||||||
// TODO(random-liu): Figure out how to handle pod cidr in cri-containerd.
|
// TODO(random-liu): Figure out how to handle pod cidr in the cri plugin.
|
||||||
func (c *criContainerdService) UpdateRuntimeConfig(ctx context.Context, r *runtime.UpdateRuntimeConfigRequest) (*runtime.UpdateRuntimeConfigResponse, error) {
|
func (c *criContainerdService) UpdateRuntimeConfig(ctx context.Context, r *runtime.UpdateRuntimeConfigRequest) (*runtime.UpdateRuntimeConfigResponse, error) {
|
||||||
return &runtime.UpdateRuntimeConfigResponse{}, nil
|
return &runtime.UpdateRuntimeConfigResponse{}, nil
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@ import (
|
|||||||
"golang.org/x/net/context"
|
"golang.org/x/net/context"
|
||||||
runtime "k8s.io/kubernetes/pkg/kubelet/apis/cri/runtime/v1alpha2"
|
runtime "k8s.io/kubernetes/pkg/kubelet/apis/cri/runtime/v1alpha2"
|
||||||
|
|
||||||
"github.com/containerd/cri-containerd/pkg/constants"
|
"github.com/containerd/cri/pkg/constants"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -23,8 +23,8 @@ import (
|
|||||||
"github.com/docker/docker/pkg/truncindex"
|
"github.com/docker/docker/pkg/truncindex"
|
||||||
runtime "k8s.io/kubernetes/pkg/kubelet/apis/cri/runtime/v1alpha2"
|
runtime "k8s.io/kubernetes/pkg/kubelet/apis/cri/runtime/v1alpha2"
|
||||||
|
|
||||||
cio "github.com/containerd/cri-containerd/pkg/server/io"
|
cio "github.com/containerd/cri/pkg/server/io"
|
||||||
"github.com/containerd/cri-containerd/pkg/store"
|
"github.com/containerd/cri/pkg/store"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Container contains all resources associated with the container. All methods to
|
// Container contains all resources associated with the container. All methods to
|
||||||
|
@ -23,8 +23,8 @@ import (
|
|||||||
assertlib "github.com/stretchr/testify/assert"
|
assertlib "github.com/stretchr/testify/assert"
|
||||||
runtime "k8s.io/kubernetes/pkg/kubelet/apis/cri/runtime/v1alpha2"
|
runtime "k8s.io/kubernetes/pkg/kubelet/apis/cri/runtime/v1alpha2"
|
||||||
|
|
||||||
cio "github.com/containerd/cri-containerd/pkg/server/io"
|
cio "github.com/containerd/cri/pkg/server/io"
|
||||||
"github.com/containerd/cri-containerd/pkg/store"
|
"github.com/containerd/cri/pkg/store"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestContainerStore(t *testing.T) {
|
func TestContainerStore(t *testing.T) {
|
||||||
|
@ -24,7 +24,7 @@ import (
|
|||||||
godigest "github.com/opencontainers/go-digest"
|
godigest "github.com/opencontainers/go-digest"
|
||||||
imagespec "github.com/opencontainers/image-spec/specs-go/v1"
|
imagespec "github.com/opencontainers/image-spec/specs-go/v1"
|
||||||
|
|
||||||
"github.com/containerd/cri-containerd/pkg/store"
|
"github.com/containerd/cri/pkg/store"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Image contains all resources associated with the image. All fields
|
// Image contains all resources associated with the image. All fields
|
||||||
|
@ -23,7 +23,7 @@ import (
|
|||||||
imagespec "github.com/opencontainers/image-spec/specs-go/v1"
|
imagespec "github.com/opencontainers/image-spec/specs-go/v1"
|
||||||
assertlib "github.com/stretchr/testify/assert"
|
assertlib "github.com/stretchr/testify/assert"
|
||||||
|
|
||||||
"github.com/containerd/cri-containerd/pkg/store"
|
"github.com/containerd/cri/pkg/store"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestImageStore(t *testing.T) {
|
func TestImageStore(t *testing.T) {
|
||||||
|
@ -22,7 +22,7 @@ import (
|
|||||||
"github.com/containerd/containerd"
|
"github.com/containerd/containerd"
|
||||||
"github.com/docker/docker/pkg/truncindex"
|
"github.com/docker/docker/pkg/truncindex"
|
||||||
|
|
||||||
"github.com/containerd/cri-containerd/pkg/store"
|
"github.com/containerd/cri/pkg/store"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Sandbox contains all resources associated with the sandbox. All methods to
|
// Sandbox contains all resources associated with the sandbox. All methods to
|
||||||
|
@ -22,7 +22,7 @@ import (
|
|||||||
assertlib "github.com/stretchr/testify/assert"
|
assertlib "github.com/stretchr/testify/assert"
|
||||||
runtime "k8s.io/kubernetes/pkg/kubelet/apis/cri/runtime/v1alpha2"
|
runtime "k8s.io/kubernetes/pkg/kubelet/apis/cri/runtime/v1alpha2"
|
||||||
|
|
||||||
"github.com/containerd/cri-containerd/pkg/store"
|
"github.com/containerd/cri/pkg/store"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestSandboxStore(t *testing.T) {
|
func TestSandboxStore(t *testing.T) {
|
||||||
|
@ -21,7 +21,7 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
// State is the sandbox state we use in cri-containerd.
|
// State is the sandbox state we use in containerd/cri.
|
||||||
// It has unknown state defined.
|
// It has unknown state defined.
|
||||||
type State uint32
|
type State uint32
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ import (
|
|||||||
|
|
||||||
snapshot "github.com/containerd/containerd/snapshots"
|
snapshot "github.com/containerd/containerd/snapshots"
|
||||||
|
|
||||||
"github.com/containerd/cri-containerd/pkg/store"
|
"github.com/containerd/cri/pkg/store"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Snapshot contains the information about the snapshot.
|
// Snapshot contains the information about the snapshot.
|
||||||
|
@ -23,7 +23,7 @@ import (
|
|||||||
snapshot "github.com/containerd/containerd/snapshots"
|
snapshot "github.com/containerd/containerd/snapshots"
|
||||||
assertlib "github.com/stretchr/testify/assert"
|
assertlib "github.com/stretchr/testify/assert"
|
||||||
|
|
||||||
"github.com/containerd/cri-containerd/pkg/store"
|
"github.com/containerd/cri/pkg/store"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestSnapshotStore(t *testing.T) {
|
func TestSnapshotStore(t *testing.T) {
|
||||||
|
@ -22,18 +22,18 @@ import (
|
|||||||
"github.com/blang/semver"
|
"github.com/blang/semver"
|
||||||
)
|
)
|
||||||
|
|
||||||
// CRIContainerdVersion is the version of the cri-containerd.
|
// CRIContainerdVersion is the version of the cri plugin.
|
||||||
var CRIContainerdVersion = "UNKNOWN"
|
var CRIContainerdVersion = "UNKNOWN"
|
||||||
|
|
||||||
func validateSemver(sv string) error {
|
func validateSemver(sv string) error {
|
||||||
_, err := semver.Parse(sv)
|
_, err := semver.Parse(sv)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("couldn't parse cri-containerd version %q: %v", sv, err)
|
return fmt.Errorf("couldn't parse version %q: %v", sv, err)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// PrintVersion outputs the release version of cri-containerd
|
// PrintVersion outputs the release version of containerd/cri
|
||||||
func PrintVersion() {
|
func PrintVersion() {
|
||||||
err := validateSemver(CRIContainerdVersion)
|
err := validateSemver(CRIContainerdVersion)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user