Merge 81faa8bc89
into 5a3c168892
This commit is contained in:
commit
82debb66da
33 changed files with 80 additions and 80 deletions
|
@ -11,7 +11,7 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/containers/storage/pkg/reexec"
|
"github.com/containers/storage/pkg/reexec"
|
||||||
"github.com/kubernetes-incubator/cri-o/libkpod"
|
"github.com/kubernetes-incubator/cri-o/libpod"
|
||||||
"github.com/kubernetes-incubator/cri-o/server"
|
"github.com/kubernetes-incubator/cri-o/server"
|
||||||
"github.com/opencontainers/selinux/go-selinux"
|
"github.com/opencontainers/selinux/go-selinux"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
|
@ -25,9 +25,9 @@ const crioConfigPath = "/etc/crio/crio.conf"
|
||||||
|
|
||||||
func validateConfig(config *server.Config) error {
|
func validateConfig(config *server.Config) error {
|
||||||
switch config.ImageVolumes {
|
switch config.ImageVolumes {
|
||||||
case libkpod.ImageVolumesMkdir:
|
case libpod.ImageVolumesMkdir:
|
||||||
case libkpod.ImageVolumesIgnore:
|
case libpod.ImageVolumesIgnore:
|
||||||
case libkpod.ImageVolumesBind:
|
case libpod.ImageVolumesBind:
|
||||||
default:
|
default:
|
||||||
return fmt.Errorf("Unrecognized image volume type specified")
|
return fmt.Errorf("Unrecognized image volume type specified")
|
||||||
|
|
||||||
|
@ -121,7 +121,7 @@ func mergeConfig(config *server.Config, ctx *cli.Context) error {
|
||||||
config.PluginDir = ctx.GlobalString("cni-plugin-dir")
|
config.PluginDir = ctx.GlobalString("cni-plugin-dir")
|
||||||
}
|
}
|
||||||
if ctx.GlobalIsSet("image-volumes") {
|
if ctx.GlobalIsSet("image-volumes") {
|
||||||
config.ImageVolumes = libkpod.ImageVolumesType(ctx.GlobalString("image-volumes"))
|
config.ImageVolumes = libpod.ImageVolumesType(ctx.GlobalString("image-volumes"))
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -260,7 +260,7 @@ func main() {
|
||||||
},
|
},
|
||||||
cli.Int64Flag{
|
cli.Int64Flag{
|
||||||
Name: "pids-limit",
|
Name: "pids-limit",
|
||||||
Value: libkpod.DefaultPidsLimit,
|
Value: libpod.DefaultPidsLimit,
|
||||||
Usage: "maximum number of processes allowed in a container",
|
Usage: "maximum number of processes allowed in a container",
|
||||||
},
|
},
|
||||||
cli.StringFlag{
|
cli.StringFlag{
|
||||||
|
@ -273,7 +273,7 @@ func main() {
|
||||||
},
|
},
|
||||||
cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "image-volumes",
|
Name: "image-volumes",
|
||||||
Value: string(libkpod.ImageVolumesMkdir),
|
Value: string(libpod.ImageVolumesMkdir),
|
||||||
Usage: "image volume handling ('mkdir' or 'ignore')",
|
Usage: "image volume handling ('mkdir' or 'ignore')",
|
||||||
},
|
},
|
||||||
cli.BoolFlag{
|
cli.BoolFlag{
|
||||||
|
|
|
@ -3,11 +3,11 @@ package main
|
||||||
import (
|
import (
|
||||||
is "github.com/containers/image/storage"
|
is "github.com/containers/image/storage"
|
||||||
"github.com/containers/storage"
|
"github.com/containers/storage"
|
||||||
"github.com/kubernetes-incubator/cri-o/libkpod"
|
"github.com/kubernetes-incubator/cri-o/libpod"
|
||||||
"github.com/urfave/cli"
|
"github.com/urfave/cli"
|
||||||
)
|
)
|
||||||
|
|
||||||
func getStore(c *libkpod.Config) (storage.Store, error) {
|
func getStore(c *libpod.Config) (storage.Store, error) {
|
||||||
options := storage.DefaultStoreOptions
|
options := storage.DefaultStoreOptions
|
||||||
options.GraphRoot = c.Root
|
options.GraphRoot = c.Root
|
||||||
options.RunRoot = c.RunRoot
|
options.RunRoot = c.RunRoot
|
||||||
|
@ -22,8 +22,8 @@ func getStore(c *libkpod.Config) (storage.Store, error) {
|
||||||
return store, nil
|
return store, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func getConfig(c *cli.Context) (*libkpod.Config, error) {
|
func getConfig(c *cli.Context) (*libpod.Config, error) {
|
||||||
config := libkpod.DefaultConfig()
|
config := libpod.DefaultConfig()
|
||||||
if c.GlobalIsSet("config") {
|
if c.GlobalIsSet("config") {
|
||||||
err := config.UpdateFromFile(c.String("config"))
|
err := config.UpdateFromFile(c.String("config"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -14,7 +14,7 @@ import (
|
||||||
is "github.com/containers/image/storage"
|
is "github.com/containers/image/storage"
|
||||||
"github.com/containers/storage"
|
"github.com/containers/storage"
|
||||||
units "github.com/docker/go-units"
|
units "github.com/docker/go-units"
|
||||||
"github.com/kubernetes-incubator/cri-o/libkpod/common"
|
"github.com/kubernetes-incubator/cri-o/libpod/common"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
"github.com/urfave/cli"
|
"github.com/urfave/cli"
|
||||||
|
|
|
@ -6,7 +6,7 @@ import (
|
||||||
"text/template"
|
"text/template"
|
||||||
|
|
||||||
"github.com/containers/storage"
|
"github.com/containers/storage"
|
||||||
libkpodimage "github.com/kubernetes-incubator/cri-o/libkpod/image"
|
libpodimage "github.com/kubernetes-incubator/cri-o/libpod/image"
|
||||||
digest "github.com/opencontainers/go-digest"
|
digest "github.com/opencontainers/go-digest"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"github.com/urfave/cli"
|
"github.com/urfave/cli"
|
||||||
|
@ -99,9 +99,9 @@ func imagesCmd(c *cli.Context) error {
|
||||||
return errors.New("'buildah images' requires at most 1 argument")
|
return errors.New("'buildah images' requires at most 1 argument")
|
||||||
}
|
}
|
||||||
|
|
||||||
var params *libkpodimage.FilterParams
|
var params *libpodimage.FilterParams
|
||||||
if c.IsSet("filter") {
|
if c.IsSet("filter") {
|
||||||
params, err = libkpodimage.ParseFilter(store, c.String("filter"))
|
params, err = libpodimage.ParseFilter(store, c.String("filter"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrapf(err, "error parsing filter")
|
return errors.Wrapf(err, "error parsing filter")
|
||||||
}
|
}
|
||||||
|
@ -109,7 +109,7 @@ func imagesCmd(c *cli.Context) error {
|
||||||
params = nil
|
params = nil
|
||||||
}
|
}
|
||||||
|
|
||||||
imageList, err := libkpodimage.GetImagesMatchingFilter(store, params, name)
|
imageList, err := libpodimage.GetImagesMatchingFilter(store, params, name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrapf(err, "could not get list of images matching filter")
|
return errors.Wrapf(err, "could not get list of images matching filter")
|
||||||
}
|
}
|
||||||
|
@ -143,7 +143,7 @@ func outputImages(store storage.Store, images []storage.Image, format string, ha
|
||||||
name = img.Names[0]
|
name = img.Names[0]
|
||||||
}
|
}
|
||||||
|
|
||||||
info, digest, size, _ := libkpodimage.InfoAndDigestAndSize(store, img)
|
info, digest, size, _ := libpodimage.InfoAndDigestAndSize(store, img)
|
||||||
if info != nil {
|
if info != nil {
|
||||||
createdTime = info.Created
|
createdTime = info.Created
|
||||||
}
|
}
|
||||||
|
@ -159,7 +159,7 @@ func outputImages(store storage.Store, images []storage.Image, format string, ha
|
||||||
Name: name,
|
Name: name,
|
||||||
Digest: digest,
|
Digest: digest,
|
||||||
CreatedAt: createdTime.Format("Jan 2, 2006 15:04"),
|
CreatedAt: createdTime.Format("Jan 2, 2006 15:04"),
|
||||||
Size: libkpodimage.FormattedSize(size),
|
Size: libpodimage.FormattedSize(size),
|
||||||
}
|
}
|
||||||
if hasTemplate {
|
if hasTemplate {
|
||||||
if err := outputUsingTemplate(format, params); err != nil {
|
if err := outputUsingTemplate(format, params); err != nil {
|
||||||
|
|
|
@ -6,8 +6,8 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"text/template"
|
"text/template"
|
||||||
|
|
||||||
"github.com/kubernetes-incubator/cri-o/libkpod"
|
"github.com/kubernetes-incubator/cri-o/libpod"
|
||||||
libkpodimage "github.com/kubernetes-incubator/cri-o/libkpod/image"
|
libpodimage "github.com/kubernetes-incubator/cri-o/libpod/image"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"github.com/urfave/cli"
|
"github.com/urfave/cli"
|
||||||
)
|
)
|
||||||
|
@ -81,7 +81,7 @@ func inspectCmd(c *cli.Context) error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrapf(err, "Could not get config")
|
return errors.Wrapf(err, "Could not get config")
|
||||||
}
|
}
|
||||||
server, err := libkpod.New(config)
|
server, err := libpod.New(config)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrapf(err, "could not get container server")
|
return errors.Wrapf(err, "could not get container server")
|
||||||
}
|
}
|
||||||
|
@ -97,14 +97,14 @@ func inspectCmd(c *cli.Context) error {
|
||||||
return errors.Wrapf(err, "error parsing container data")
|
return errors.Wrapf(err, "error parsing container data")
|
||||||
}
|
}
|
||||||
case inspectTypeImage:
|
case inspectTypeImage:
|
||||||
data, err = libkpodimage.GetImageData(server.Store(), name)
|
data, err = libpodimage.GetImageData(server.Store(), name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrapf(err, "error parsing image data")
|
return errors.Wrapf(err, "error parsing image data")
|
||||||
}
|
}
|
||||||
case inspectAll:
|
case inspectAll:
|
||||||
ctrData, err := server.GetContainerData(name, size)
|
ctrData, err := server.GetContainerData(name, size)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
imgData, err := libkpodimage.GetImageData(server.Store(), name)
|
imgData, err := libpodimage.GetImageData(server.Store(), name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrapf(err, "error parsing container or image data")
|
return errors.Wrapf(err, "error parsing container or image data")
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,8 +7,8 @@ import (
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
|
|
||||||
"github.com/containers/storage"
|
"github.com/containers/storage"
|
||||||
"github.com/kubernetes-incubator/cri-o/libkpod/common"
|
"github.com/kubernetes-incubator/cri-o/libpod/common"
|
||||||
libkpodimage "github.com/kubernetes-incubator/cri-o/libkpod/image"
|
libpodimage "github.com/kubernetes-incubator/cri-o/libpod/image"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"github.com/urfave/cli"
|
"github.com/urfave/cli"
|
||||||
)
|
)
|
||||||
|
@ -105,5 +105,5 @@ func loadImage(store storage.Store, opts loadOptions) error {
|
||||||
|
|
||||||
src := dockerArchive + opts.input
|
src := dockerArchive + opts.input
|
||||||
|
|
||||||
return libkpodimage.PullImage(store, src, false, opts.quiet, systemContext)
|
return libpodimage.PullImage(store, src, false, opts.quiet, systemContext)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/kubernetes-incubator/cri-o/libkpod/common"
|
"github.com/kubernetes-incubator/cri-o/libpod/common"
|
||||||
libkpodimage "github.com/kubernetes-incubator/cri-o/libkpod/image"
|
libpodimage "github.com/kubernetes-incubator/cri-o/libpod/image"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
"github.com/urfave/cli"
|
"github.com/urfave/cli"
|
||||||
|
@ -58,7 +58,7 @@ func pullCmd(c *cli.Context) error {
|
||||||
|
|
||||||
systemContext := common.GetSystemContext("")
|
systemContext := common.GetSystemContext("")
|
||||||
|
|
||||||
err = libkpodimage.PullImage(store, image, allTags, false, systemContext)
|
err = libpodimage.PullImage(store, image, allTags, false, systemContext)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Errorf("error pulling image from %q: %v", image, err)
|
return errors.Errorf("error pulling image from %q: %v", image, err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,8 +6,8 @@ import (
|
||||||
|
|
||||||
"github.com/containers/image/types"
|
"github.com/containers/image/types"
|
||||||
"github.com/containers/storage/pkg/archive"
|
"github.com/containers/storage/pkg/archive"
|
||||||
"github.com/kubernetes-incubator/cri-o/libkpod/common"
|
"github.com/kubernetes-incubator/cri-o/libpod/common"
|
||||||
libkpodimage "github.com/kubernetes-incubator/cri-o/libkpod/image"
|
libpodimage "github.com/kubernetes-incubator/cri-o/libpod/image"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"github.com/urfave/cli"
|
"github.com/urfave/cli"
|
||||||
"golang.org/x/crypto/ssh/terminal"
|
"golang.org/x/crypto/ssh/terminal"
|
||||||
|
@ -112,7 +112,7 @@ func pushCmd(c *cli.Context) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
options := libkpodimage.CopyOptions{
|
options := libpodimage.CopyOptions{
|
||||||
Compression: compress,
|
Compression: compress,
|
||||||
SignaturePolicyPath: signaturePolicy,
|
SignaturePolicyPath: signaturePolicy,
|
||||||
Store: store,
|
Store: store,
|
||||||
|
@ -129,5 +129,5 @@ func pushCmd(c *cli.Context) error {
|
||||||
if !c.Bool("quiet") {
|
if !c.Bool("quiet") {
|
||||||
options.ReportWriter = os.Stderr
|
options.ReportWriter = os.Stderr
|
||||||
}
|
}
|
||||||
return libkpodimage.PushImage(srcName, destName, options)
|
return libpodimage.PushImage(srcName, destName, options)
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/containers/storage"
|
"github.com/containers/storage"
|
||||||
libkpodimage "github.com/kubernetes-incubator/cri-o/libkpod/image"
|
libpodimage "github.com/kubernetes-incubator/cri-o/libpod/image"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"github.com/urfave/cli"
|
"github.com/urfave/cli"
|
||||||
)
|
)
|
||||||
|
@ -49,7 +49,7 @@ func rmiCmd(c *cli.Context) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, id := range args {
|
for _, id := range args {
|
||||||
image, err := libkpodimage.FindImage(store, id)
|
image, err := libpodimage.FindImage(store, id)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrapf(err, "could not get image %q", id)
|
return errors.Wrapf(err, "could not get image %q", id)
|
||||||
}
|
}
|
||||||
|
@ -68,14 +68,14 @@ func rmiCmd(c *cli.Context) error {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// If the user supplied an ID, we cannot delete the image if it is referred to by multiple tags
|
// If the user supplied an ID, we cannot delete the image if it is referred to by multiple tags
|
||||||
if libkpodimage.MatchesID(image.ID, id) {
|
if libpodimage.MatchesID(image.ID, id) {
|
||||||
if len(image.Names) > 1 && !force {
|
if len(image.Names) > 1 && !force {
|
||||||
return fmt.Errorf("unable to delete %s (must force) - image is referred to in multiple tags", image.ID)
|
return fmt.Errorf("unable to delete %s (must force) - image is referred to in multiple tags", image.ID)
|
||||||
}
|
}
|
||||||
// If it is forced, we have to untag the image so that it can be deleted
|
// If it is forced, we have to untag the image so that it can be deleted
|
||||||
image.Names = image.Names[:0]
|
image.Names = image.Names[:0]
|
||||||
} else {
|
} else {
|
||||||
name, err2 := libkpodimage.UntagImage(store, image, id)
|
name, err2 := libpodimage.UntagImage(store, image, id)
|
||||||
if err2 != nil {
|
if err2 != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -85,7 +85,7 @@ func rmiCmd(c *cli.Context) error {
|
||||||
if len(image.Names) > 0 {
|
if len(image.Names) > 0 {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
id, err := libkpodimage.RemoveImage(image, store)
|
id, err := libpodimage.RemoveImage(image, store)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -97,7 +97,7 @@ func rmiCmd(c *cli.Context) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns a list of running containers associated with the given ImageReference
|
// Returns a list of running containers associated with the given ImageReference
|
||||||
// TODO: replace this with something in libkpod
|
// TODO: replace this with something in libpod
|
||||||
func runningContainers(image *storage.Image, store storage.Store) ([]string, error) {
|
func runningContainers(image *storage.Image, store storage.Store) ([]string, error) {
|
||||||
ctrIDs := []string{}
|
ctrIDs := []string{}
|
||||||
containers, err := store.Containers()
|
containers, err := store.Containers()
|
||||||
|
@ -112,7 +112,7 @@ func runningContainers(image *storage.Image, store storage.Store) ([]string, err
|
||||||
return ctrIDs, nil
|
return ctrIDs, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: replace this with something in libkpod
|
// TODO: replace this with something in libpod
|
||||||
func removeContainers(ctrIDs []string, store storage.Store) error {
|
func removeContainers(ctrIDs []string, store storage.Store) error {
|
||||||
for _, ctrID := range ctrIDs {
|
for _, ctrID := range ctrIDs {
|
||||||
if err := store.DeleteContainer(ctrID); err != nil {
|
if err := store.DeleteContainer(ctrID); err != nil {
|
||||||
|
|
|
@ -4,7 +4,7 @@ import (
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"github.com/containers/storage"
|
"github.com/containers/storage"
|
||||||
libkpodimage "github.com/kubernetes-incubator/cri-o/libkpod/image"
|
libpodimage "github.com/kubernetes-incubator/cri-o/libpod/image"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
"github.com/urfave/cli"
|
"github.com/urfave/cli"
|
||||||
|
@ -83,7 +83,7 @@ func saveCmd(c *cli.Context) error {
|
||||||
func saveImage(store storage.Store, opts saveOptions) error {
|
func saveImage(store storage.Store, opts saveOptions) error {
|
||||||
dst := dockerArchive + opts.output
|
dst := dockerArchive + opts.output
|
||||||
|
|
||||||
pushOpts := libkpodimage.CopyOptions{
|
pushOpts := libpodimage.CopyOptions{
|
||||||
SignaturePolicyPath: "",
|
SignaturePolicyPath: "",
|
||||||
Store: store,
|
Store: store,
|
||||||
}
|
}
|
||||||
|
@ -92,7 +92,7 @@ func saveImage(store storage.Store, opts saveOptions) error {
|
||||||
// future pull requests will fix this
|
// future pull requests will fix this
|
||||||
for _, image := range opts.images {
|
for _, image := range opts.images {
|
||||||
dest := dst + ":" + image
|
dest := dst + ":" + image
|
||||||
if err := libkpodimage.PushImage(image, dest, pushOpts); err != nil {
|
if err := libpodimage.PushImage(image, dest, pushOpts); err != nil {
|
||||||
return errors.Wrapf(err, "unable to save %q", image)
|
return errors.Wrapf(err, "unable to save %q", image)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@ package main
|
||||||
import (
|
import (
|
||||||
"github.com/containers/image/docker/reference"
|
"github.com/containers/image/docker/reference"
|
||||||
"github.com/containers/storage"
|
"github.com/containers/storage"
|
||||||
libkpodimage "github.com/kubernetes-incubator/cri-o/libkpod/image"
|
libpodimage "github.com/kubernetes-incubator/cri-o/libpod/image"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"github.com/urfave/cli"
|
"github.com/urfave/cli"
|
||||||
)
|
)
|
||||||
|
@ -32,7 +32,7 @@ func tagCmd(c *cli.Context) error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
img, err := libkpodimage.FindImage(store, args[0])
|
img, err := libpodimage.FindImage(store, args[0])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package libkpod
|
package libpod
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
|
@ -77,7 +77,7 @@ type RootConfig struct {
|
||||||
LogDir string `toml:"log_dir"`
|
LogDir string `toml:"log_dir"`
|
||||||
|
|
||||||
// FileLocking specifies whether to use file-based or in-memory locking
|
// FileLocking specifies whether to use file-based or in-memory locking
|
||||||
// File-based locking is required when multiple users of libkpod are
|
// File-based locking is required when multiple users of libpod are
|
||||||
// present on the same system
|
// present on the same system
|
||||||
FileLocking bool `toml:"file_locking"`
|
FileLocking bool `toml:"file_locking"`
|
||||||
}
|
}
|
|
@ -1,10 +1,10 @@
|
||||||
package libkpod
|
package libpod
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
cstorage "github.com/containers/storage"
|
cstorage "github.com/containers/storage"
|
||||||
"github.com/kubernetes-incubator/cri-o/libkpod/sandbox"
|
"github.com/kubernetes-incubator/cri-o/libpod/sandbox"
|
||||||
"github.com/kubernetes-incubator/cri-o/oci"
|
"github.com/kubernetes-incubator/cri-o/oci"
|
||||||
"github.com/kubernetes-incubator/cri-o/pkg/registrar"
|
"github.com/kubernetes-incubator/cri-o/pkg/registrar"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
|
@ -1,4 +1,4 @@
|
||||||
package libkpod
|
package libpod
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
@ -7,8 +7,8 @@ import (
|
||||||
"k8s.io/apimachinery/pkg/fields"
|
"k8s.io/apimachinery/pkg/fields"
|
||||||
pb "k8s.io/kubernetes/pkg/kubelet/api/v1alpha1/runtime"
|
pb "k8s.io/kubernetes/pkg/kubelet/api/v1alpha1/runtime"
|
||||||
|
|
||||||
"github.com/kubernetes-incubator/cri-o/libkpod/driver"
|
"github.com/kubernetes-incubator/cri-o/libpod/driver"
|
||||||
libkpodimage "github.com/kubernetes-incubator/cri-o/libkpod/image"
|
libpodimage "github.com/kubernetes-incubator/cri-o/libpod/image"
|
||||||
"github.com/kubernetes-incubator/cri-o/oci"
|
"github.com/kubernetes-incubator/cri-o/oci"
|
||||||
"github.com/opencontainers/image-spec/specs-go/v1"
|
"github.com/opencontainers/image-spec/specs-go/v1"
|
||||||
specs "github.com/opencontainers/runtime-spec/specs-go"
|
specs "github.com/opencontainers/runtime-spec/specs-go"
|
||||||
|
@ -77,7 +77,7 @@ func (c *ContainerServer) GetContainerData(name string, size bool) (*ContainerDa
|
||||||
if container.ImageID == "" {
|
if container.ImageID == "" {
|
||||||
return nil, errors.Errorf("error reading container image data: container is not based on an image")
|
return nil, errors.Errorf("error reading container image data: container is not based on an image")
|
||||||
}
|
}
|
||||||
imageData, err := libkpodimage.GetImageData(c.store, container.ImageID)
|
imageData, err := libpodimage.GetImageData(c.store, container.ImageID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.Wrapf(err, "error reading container image data")
|
return nil, errors.Wrapf(err, "error reading container image data")
|
||||||
}
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package libkpod
|
package libpod
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
@ -12,7 +12,7 @@ import (
|
||||||
cstorage "github.com/containers/storage"
|
cstorage "github.com/containers/storage"
|
||||||
"github.com/docker/docker/pkg/ioutils"
|
"github.com/docker/docker/pkg/ioutils"
|
||||||
"github.com/docker/docker/pkg/truncindex"
|
"github.com/docker/docker/pkg/truncindex"
|
||||||
"github.com/kubernetes-incubator/cri-o/libkpod/sandbox"
|
"github.com/kubernetes-incubator/cri-o/libpod/sandbox"
|
||||||
"github.com/kubernetes-incubator/cri-o/oci"
|
"github.com/kubernetes-incubator/cri-o/oci"
|
||||||
"github.com/kubernetes-incubator/cri-o/pkg/annotations"
|
"github.com/kubernetes-incubator/cri-o/pkg/annotations"
|
||||||
"github.com/kubernetes-incubator/cri-o/pkg/registrar"
|
"github.com/kubernetes-incubator/cri-o/pkg/registrar"
|
|
@ -15,7 +15,7 @@ import (
|
||||||
"github.com/containers/image/types"
|
"github.com/containers/image/types"
|
||||||
"github.com/containers/storage"
|
"github.com/containers/storage"
|
||||||
"github.com/containers/storage/pkg/archive"
|
"github.com/containers/storage/pkg/archive"
|
||||||
"github.com/kubernetes-incubator/cri-o/libkpod/common"
|
"github.com/kubernetes-incubator/cri-o/libpod/common"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
)
|
)
|
||||||
|
|
|
@ -16,7 +16,7 @@ import (
|
||||||
"github.com/containers/storage/pkg/archive"
|
"github.com/containers/storage/pkg/archive"
|
||||||
"github.com/docker/docker/pkg/ioutils"
|
"github.com/docker/docker/pkg/ioutils"
|
||||||
"github.com/kubernetes-incubator/cri-o/cmd/kpod/docker"
|
"github.com/kubernetes-incubator/cri-o/cmd/kpod/docker"
|
||||||
"github.com/kubernetes-incubator/cri-o/libkpod/common"
|
"github.com/kubernetes-incubator/cri-o/libpod/common"
|
||||||
digest "github.com/opencontainers/go-digest"
|
digest "github.com/opencontainers/go-digest"
|
||||||
"github.com/opencontainers/image-spec/specs-go/v1"
|
"github.com/opencontainers/image-spec/specs-go/v1"
|
||||||
ociv1 "github.com/opencontainers/image-spec/specs-go/v1"
|
ociv1 "github.com/opencontainers/image-spec/specs-go/v1"
|
|
@ -9,7 +9,7 @@ import (
|
||||||
"github.com/containers/image/transports"
|
"github.com/containers/image/transports"
|
||||||
"github.com/containers/image/types"
|
"github.com/containers/image/types"
|
||||||
"github.com/containers/storage"
|
"github.com/containers/storage"
|
||||||
"github.com/kubernetes-incubator/cri-o/libkpod/common"
|
"github.com/kubernetes-incubator/cri-o/libpod/common"
|
||||||
digest "github.com/opencontainers/go-digest"
|
digest "github.com/opencontainers/go-digest"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
)
|
)
|
|
@ -7,7 +7,7 @@ import (
|
||||||
"github.com/containers/image/docker/reference"
|
"github.com/containers/image/docker/reference"
|
||||||
"github.com/containers/image/transports"
|
"github.com/containers/image/transports"
|
||||||
"github.com/containers/storage"
|
"github.com/containers/storage"
|
||||||
"github.com/kubernetes-incubator/cri-o/libkpod/driver"
|
"github.com/kubernetes-incubator/cri-o/libpod/driver"
|
||||||
digest "github.com/opencontainers/go-digest"
|
digest "github.com/opencontainers/go-digest"
|
||||||
ociv1 "github.com/opencontainers/image-spec/specs-go/v1"
|
ociv1 "github.com/opencontainers/image-spec/specs-go/v1"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
|
@ -5,13 +5,13 @@ import (
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
|
|
||||||
"github.com/BurntSushi/toml"
|
"github.com/BurntSushi/toml"
|
||||||
"github.com/kubernetes-incubator/cri-o/libkpod"
|
"github.com/kubernetes-incubator/cri-o/libpod"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Config represents the entire set of configuration values that can be set for
|
// Config represents the entire set of configuration values that can be set for
|
||||||
// the server. This is intended to be loaded from a toml-encoded config file.
|
// the server. This is intended to be loaded from a toml-encoded config file.
|
||||||
type Config struct {
|
type Config struct {
|
||||||
libkpod.Config
|
libpod.Config
|
||||||
APIConfig
|
APIConfig
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,11 +34,11 @@ type APIConfig struct {
|
||||||
// conversions.
|
// conversions.
|
||||||
type tomlConfig struct {
|
type tomlConfig struct {
|
||||||
Crio struct {
|
Crio struct {
|
||||||
libkpod.RootConfig
|
libpod.RootConfig
|
||||||
API struct{ APIConfig } `toml:"api"`
|
API struct{ APIConfig } `toml:"api"`
|
||||||
Runtime struct{ libkpod.RuntimeConfig } `toml:"runtime"`
|
Runtime struct{ libpod.RuntimeConfig } `toml:"runtime"`
|
||||||
Image struct{ libkpod.ImageConfig } `toml:"image"`
|
Image struct{ libpod.ImageConfig } `toml:"image"`
|
||||||
Network struct{ libkpod.NetworkConfig } `toml:"network"`
|
Network struct{ libpod.NetworkConfig } `toml:"network"`
|
||||||
} `toml:"crio"`
|
} `toml:"crio"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -99,7 +99,7 @@ func (c *Config) ToFile(path string) error {
|
||||||
// DefaultConfig returns the default configuration for crio.
|
// DefaultConfig returns the default configuration for crio.
|
||||||
func DefaultConfig() *Config {
|
func DefaultConfig() *Config {
|
||||||
return &Config{
|
return &Config{
|
||||||
Config: *libkpod.DefaultConfig(),
|
Config: *libpod.DefaultConfig(),
|
||||||
APIConfig: APIConfig{
|
APIConfig: APIConfig{
|
||||||
Listen: "/var/run/crio.sock",
|
Listen: "/var/run/crio.sock",
|
||||||
StreamAddress: "",
|
StreamAddress: "",
|
||||||
|
|
|
@ -13,8 +13,8 @@ import (
|
||||||
|
|
||||||
"github.com/docker/docker/pkg/stringid"
|
"github.com/docker/docker/pkg/stringid"
|
||||||
"github.com/docker/docker/pkg/symlink"
|
"github.com/docker/docker/pkg/symlink"
|
||||||
"github.com/kubernetes-incubator/cri-o/libkpod"
|
"github.com/kubernetes-incubator/cri-o/libpod"
|
||||||
"github.com/kubernetes-incubator/cri-o/libkpod/sandbox"
|
"github.com/kubernetes-incubator/cri-o/libpod/sandbox"
|
||||||
"github.com/kubernetes-incubator/cri-o/oci"
|
"github.com/kubernetes-incubator/cri-o/oci"
|
||||||
"github.com/kubernetes-incubator/cri-o/pkg/annotations"
|
"github.com/kubernetes-incubator/cri-o/pkg/annotations"
|
||||||
"github.com/kubernetes-incubator/cri-o/pkg/storage"
|
"github.com/kubernetes-incubator/cri-o/pkg/storage"
|
||||||
|
@ -83,11 +83,11 @@ func addImageVolumes(rootfs string, s *Server, containerInfo *storage.ContainerI
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
switch s.config.ImageVolumes {
|
switch s.config.ImageVolumes {
|
||||||
case libkpod.ImageVolumesMkdir:
|
case libpod.ImageVolumesMkdir:
|
||||||
if err1 := os.MkdirAll(fp, 0644); err1 != nil {
|
if err1 := os.MkdirAll(fp, 0644); err1 != nil {
|
||||||
return err1
|
return err1
|
||||||
}
|
}
|
||||||
case libkpod.ImageVolumesBind:
|
case libpod.ImageVolumesBind:
|
||||||
volumeDirName := stringid.GenerateNonCryptoID()
|
volumeDirName := stringid.GenerateNonCryptoID()
|
||||||
src := filepath.Join(containerInfo.RunDir, "mounts", volumeDirName)
|
src := filepath.Join(containerInfo.RunDir, "mounts", volumeDirName)
|
||||||
if err1 := os.MkdirAll(src, 0644); err1 != nil {
|
if err1 := os.MkdirAll(src, 0644); err1 != nil {
|
||||||
|
@ -102,7 +102,7 @@ func addImageVolumes(rootfs string, s *Server, containerInfo *storage.ContainerI
|
||||||
|
|
||||||
logrus.Debugf("Adding bind mounted volume: %s to %s", src, dest)
|
logrus.Debugf("Adding bind mounted volume: %s to %s", src, dest)
|
||||||
specgen.AddBindMount(src, dest, []string{"rw"})
|
specgen.AddBindMount(src, dest, []string{"rw"})
|
||||||
case libkpod.ImageVolumesIgnore:
|
case libpod.ImageVolumesIgnore:
|
||||||
logrus.Debugf("Ignoring volume %v", dest)
|
logrus.Debugf("Ignoring volume %v", dest)
|
||||||
default:
|
default:
|
||||||
logrus.Fatalf("Unrecognized image volumes setting")
|
logrus.Fatalf("Unrecognized image volumes setting")
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package server
|
package server
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/kubernetes-incubator/cri-o/libkpod/sandbox"
|
"github.com/kubernetes-incubator/cri-o/libpod/sandbox"
|
||||||
"github.com/kubernetes-incubator/cri-o/oci"
|
"github.com/kubernetes-incubator/cri-o/oci"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
"golang.org/x/net/context"
|
"golang.org/x/net/context"
|
||||||
|
|
|
@ -4,7 +4,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/containers/storage"
|
"github.com/containers/storage"
|
||||||
"github.com/kubernetes-incubator/cri-o/libkpod/sandbox"
|
"github.com/kubernetes-incubator/cri-o/libpod/sandbox"
|
||||||
"github.com/kubernetes-incubator/cri-o/oci"
|
"github.com/kubernetes-incubator/cri-o/oci"
|
||||||
pkgstorage "github.com/kubernetes-incubator/cri-o/pkg/storage"
|
pkgstorage "github.com/kubernetes-incubator/cri-o/pkg/storage"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
|
|
|
@ -12,7 +12,7 @@ import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/containers/storage"
|
"github.com/containers/storage"
|
||||||
"github.com/kubernetes-incubator/cri-o/libkpod/sandbox"
|
"github.com/kubernetes-incubator/cri-o/libpod/sandbox"
|
||||||
"github.com/kubernetes-incubator/cri-o/oci"
|
"github.com/kubernetes-incubator/cri-o/oci"
|
||||||
"github.com/kubernetes-incubator/cri-o/pkg/annotations"
|
"github.com/kubernetes-incubator/cri-o/pkg/annotations"
|
||||||
"github.com/opencontainers/runc/libcontainer/cgroups/systemd"
|
"github.com/opencontainers/runc/libcontainer/cgroups/systemd"
|
||||||
|
|
|
@ -7,7 +7,7 @@ import (
|
||||||
"github.com/containers/storage"
|
"github.com/containers/storage"
|
||||||
"github.com/docker/docker/pkg/mount"
|
"github.com/docker/docker/pkg/mount"
|
||||||
"github.com/docker/docker/pkg/symlink"
|
"github.com/docker/docker/pkg/symlink"
|
||||||
"github.com/kubernetes-incubator/cri-o/libkpod/sandbox"
|
"github.com/kubernetes-incubator/cri-o/libpod/sandbox"
|
||||||
"github.com/kubernetes-incubator/cri-o/oci"
|
"github.com/kubernetes-incubator/cri-o/oci"
|
||||||
"github.com/opencontainers/selinux/go-selinux/label"
|
"github.com/opencontainers/selinux/go-selinux/label"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
|
|
|
@ -9,8 +9,8 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/kubernetes-incubator/cri-o/libkpod"
|
"github.com/kubernetes-incubator/cri-o/libpod"
|
||||||
"github.com/kubernetes-incubator/cri-o/libkpod/sandbox"
|
"github.com/kubernetes-incubator/cri-o/libpod/sandbox"
|
||||||
"github.com/kubernetes-incubator/cri-o/oci"
|
"github.com/kubernetes-incubator/cri-o/oci"
|
||||||
"github.com/kubernetes-incubator/cri-o/pkg/ocicni"
|
"github.com/kubernetes-incubator/cri-o/pkg/ocicni"
|
||||||
"github.com/kubernetes-incubator/cri-o/pkg/storage"
|
"github.com/kubernetes-incubator/cri-o/pkg/storage"
|
||||||
|
@ -47,7 +47,7 @@ type streamService struct {
|
||||||
|
|
||||||
// Server implements the RuntimeService and ImageService
|
// Server implements the RuntimeService and ImageService
|
||||||
type Server struct {
|
type Server struct {
|
||||||
*libkpod.ContainerServer
|
*libpod.ContainerServer
|
||||||
config Config
|
config Config
|
||||||
|
|
||||||
updateLock sync.RWMutex
|
updateLock sync.RWMutex
|
||||||
|
@ -148,7 +148,7 @@ func New(config *Config) (*Server, error) {
|
||||||
if err := os.MkdirAll("/var/run/crio", 0755); err != nil {
|
if err := os.MkdirAll("/var/run/crio", 0755); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
containerServer, err := libkpod.New(&config.Config)
|
containerServer, err := libpod.New(&config.Config)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue