This commit is contained in:
Matthew Heon 2017-08-11 14:06:42 +00:00 committed by GitHub
commit 82debb66da
33 changed files with 80 additions and 80 deletions

View file

@ -11,7 +11,7 @@ import (
"strings"
"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/opencontainers/selinux/go-selinux"
"github.com/sirupsen/logrus"
@ -25,9 +25,9 @@ const crioConfigPath = "/etc/crio/crio.conf"
func validateConfig(config *server.Config) error {
switch config.ImageVolumes {
case libkpod.ImageVolumesMkdir:
case libkpod.ImageVolumesIgnore:
case libkpod.ImageVolumesBind:
case libpod.ImageVolumesMkdir:
case libpod.ImageVolumesIgnore:
case libpod.ImageVolumesBind:
default:
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")
}
if ctx.GlobalIsSet("image-volumes") {
config.ImageVolumes = libkpod.ImageVolumesType(ctx.GlobalString("image-volumes"))
config.ImageVolumes = libpod.ImageVolumesType(ctx.GlobalString("image-volumes"))
}
return nil
}
@ -260,7 +260,7 @@ func main() {
},
cli.Int64Flag{
Name: "pids-limit",
Value: libkpod.DefaultPidsLimit,
Value: libpod.DefaultPidsLimit,
Usage: "maximum number of processes allowed in a container",
},
cli.StringFlag{
@ -273,7 +273,7 @@ func main() {
},
cli.StringFlag{
Name: "image-volumes",
Value: string(libkpod.ImageVolumesMkdir),
Value: string(libpod.ImageVolumesMkdir),
Usage: "image volume handling ('mkdir' or 'ignore')",
},
cli.BoolFlag{

View file

@ -3,11 +3,11 @@ package main
import (
is "github.com/containers/image/storage"
"github.com/containers/storage"
"github.com/kubernetes-incubator/cri-o/libkpod"
"github.com/kubernetes-incubator/cri-o/libpod"
"github.com/urfave/cli"
)
func getStore(c *libkpod.Config) (storage.Store, error) {
func getStore(c *libpod.Config) (storage.Store, error) {
options := storage.DefaultStoreOptions
options.GraphRoot = c.Root
options.RunRoot = c.RunRoot
@ -22,8 +22,8 @@ func getStore(c *libkpod.Config) (storage.Store, error) {
return store, nil
}
func getConfig(c *cli.Context) (*libkpod.Config, error) {
config := libkpod.DefaultConfig()
func getConfig(c *cli.Context) (*libpod.Config, error) {
config := libpod.DefaultConfig()
if c.GlobalIsSet("config") {
err := config.UpdateFromFile(c.String("config"))
if err != nil {

View file

@ -14,7 +14,7 @@ import (
is "github.com/containers/image/storage"
"github.com/containers/storage"
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/sirupsen/logrus"
"github.com/urfave/cli"

View file

@ -6,7 +6,7 @@ import (
"text/template"
"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"
"github.com/pkg/errors"
"github.com/urfave/cli"
@ -99,9 +99,9 @@ func imagesCmd(c *cli.Context) error {
return errors.New("'buildah images' requires at most 1 argument")
}
var params *libkpodimage.FilterParams
var params *libpodimage.FilterParams
if c.IsSet("filter") {
params, err = libkpodimage.ParseFilter(store, c.String("filter"))
params, err = libpodimage.ParseFilter(store, c.String("filter"))
if err != nil {
return errors.Wrapf(err, "error parsing filter")
}
@ -109,7 +109,7 @@ func imagesCmd(c *cli.Context) error {
params = nil
}
imageList, err := libkpodimage.GetImagesMatchingFilter(store, params, name)
imageList, err := libpodimage.GetImagesMatchingFilter(store, params, name)
if err != nil {
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]
}
info, digest, size, _ := libkpodimage.InfoAndDigestAndSize(store, img)
info, digest, size, _ := libpodimage.InfoAndDigestAndSize(store, img)
if info != nil {
createdTime = info.Created
}
@ -159,7 +159,7 @@ func outputImages(store storage.Store, images []storage.Image, format string, ha
Name: name,
Digest: digest,
CreatedAt: createdTime.Format("Jan 2, 2006 15:04"),
Size: libkpodimage.FormattedSize(size),
Size: libpodimage.FormattedSize(size),
}
if hasTemplate {
if err := outputUsingTemplate(format, params); err != nil {

View file

@ -6,8 +6,8 @@ import (
"os"
"text/template"
"github.com/kubernetes-incubator/cri-o/libkpod"
libkpodimage "github.com/kubernetes-incubator/cri-o/libkpod/image"
"github.com/kubernetes-incubator/cri-o/libpod"
libpodimage "github.com/kubernetes-incubator/cri-o/libpod/image"
"github.com/pkg/errors"
"github.com/urfave/cli"
)
@ -81,7 +81,7 @@ func inspectCmd(c *cli.Context) error {
if err != nil {
return errors.Wrapf(err, "Could not get config")
}
server, err := libkpod.New(config)
server, err := libpod.New(config)
if err != nil {
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")
}
case inspectTypeImage:
data, err = libkpodimage.GetImageData(server.Store(), name)
data, err = libpodimage.GetImageData(server.Store(), name)
if err != nil {
return errors.Wrapf(err, "error parsing image data")
}
case inspectAll:
ctrData, err := server.GetContainerData(name, size)
if err != nil {
imgData, err := libkpodimage.GetImageData(server.Store(), name)
imgData, err := libpodimage.GetImageData(server.Store(), name)
if err != nil {
return errors.Wrapf(err, "error parsing container or image data")
}

View file

@ -7,8 +7,8 @@ import (
"io/ioutil"
"github.com/containers/storage"
"github.com/kubernetes-incubator/cri-o/libkpod/common"
libkpodimage "github.com/kubernetes-incubator/cri-o/libkpod/image"
"github.com/kubernetes-incubator/cri-o/libpod/common"
libpodimage "github.com/kubernetes-incubator/cri-o/libpod/image"
"github.com/pkg/errors"
"github.com/urfave/cli"
)
@ -105,5 +105,5 @@ func loadImage(store storage.Store, opts loadOptions) error {
src := dockerArchive + opts.input
return libkpodimage.PullImage(store, src, false, opts.quiet, systemContext)
return libpodimage.PullImage(store, src, false, opts.quiet, systemContext)
}

View file

@ -1,8 +1,8 @@
package main
import (
"github.com/kubernetes-incubator/cri-o/libkpod/common"
libkpodimage "github.com/kubernetes-incubator/cri-o/libkpod/image"
"github.com/kubernetes-incubator/cri-o/libpod/common"
libpodimage "github.com/kubernetes-incubator/cri-o/libpod/image"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
"github.com/urfave/cli"
@ -58,7 +58,7 @@ func pullCmd(c *cli.Context) error {
systemContext := common.GetSystemContext("")
err = libkpodimage.PullImage(store, image, allTags, false, systemContext)
err = libpodimage.PullImage(store, image, allTags, false, systemContext)
if err != nil {
return errors.Errorf("error pulling image from %q: %v", image, err)
}

View file

@ -6,8 +6,8 @@ import (
"github.com/containers/image/types"
"github.com/containers/storage/pkg/archive"
"github.com/kubernetes-incubator/cri-o/libkpod/common"
libkpodimage "github.com/kubernetes-incubator/cri-o/libkpod/image"
"github.com/kubernetes-incubator/cri-o/libpod/common"
libpodimage "github.com/kubernetes-incubator/cri-o/libpod/image"
"github.com/pkg/errors"
"github.com/urfave/cli"
"golang.org/x/crypto/ssh/terminal"
@ -112,7 +112,7 @@ func pushCmd(c *cli.Context) error {
return err
}
options := libkpodimage.CopyOptions{
options := libpodimage.CopyOptions{
Compression: compress,
SignaturePolicyPath: signaturePolicy,
Store: store,
@ -129,5 +129,5 @@ func pushCmd(c *cli.Context) error {
if !c.Bool("quiet") {
options.ReportWriter = os.Stderr
}
return libkpodimage.PushImage(srcName, destName, options)
return libpodimage.PushImage(srcName, destName, options)
}

View file

@ -4,7 +4,7 @@ import (
"fmt"
"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/urfave/cli"
)
@ -49,7 +49,7 @@ func rmiCmd(c *cli.Context) error {
}
for _, id := range args {
image, err := libkpodimage.FindImage(store, id)
image, err := libpodimage.FindImage(store, id)
if err != nil {
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 libkpodimage.MatchesID(image.ID, id) {
if libpodimage.MatchesID(image.ID, id) {
if len(image.Names) > 1 && !force {
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
image.Names = image.Names[:0]
} else {
name, err2 := libkpodimage.UntagImage(store, image, id)
name, err2 := libpodimage.UntagImage(store, image, id)
if err2 != nil {
return err
}
@ -85,7 +85,7 @@ func rmiCmd(c *cli.Context) error {
if len(image.Names) > 0 {
continue
}
id, err := libkpodimage.RemoveImage(image, store)
id, err := libpodimage.RemoveImage(image, store)
if err != nil {
return err
}
@ -97,7 +97,7 @@ func rmiCmd(c *cli.Context) error {
}
// 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) {
ctrIDs := []string{}
containers, err := store.Containers()
@ -112,7 +112,7 @@ func runningContainers(image *storage.Image, store storage.Store) ([]string, err
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 {
for _, ctrID := range ctrIDs {
if err := store.DeleteContainer(ctrID); err != nil {

View file

@ -4,7 +4,7 @@ import (
"os"
"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/sirupsen/logrus"
"github.com/urfave/cli"
@ -83,7 +83,7 @@ func saveCmd(c *cli.Context) error {
func saveImage(store storage.Store, opts saveOptions) error {
dst := dockerArchive + opts.output
pushOpts := libkpodimage.CopyOptions{
pushOpts := libpodimage.CopyOptions{
SignaturePolicyPath: "",
Store: store,
}
@ -92,7 +92,7 @@ func saveImage(store storage.Store, opts saveOptions) error {
// future pull requests will fix this
for _, image := range opts.images {
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)
}
}

View file

@ -3,7 +3,7 @@ package main
import (
"github.com/containers/image/docker/reference"
"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/urfave/cli"
)
@ -32,7 +32,7 @@ func tagCmd(c *cli.Context) error {
if err != nil {
return err
}
img, err := libkpodimage.FindImage(store, args[0])
img, err := libpodimage.FindImage(store, args[0])
if err != nil {
return err
}

View file

@ -1,4 +1,4 @@
package libkpod
package libpod
import (
"bytes"
@ -77,7 +77,7 @@ type RootConfig struct {
LogDir string `toml:"log_dir"`
// 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
FileLocking bool `toml:"file_locking"`
}

View file

@ -1,10 +1,10 @@
package libkpod
package libpod
import (
"fmt"
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/pkg/registrar"
"github.com/pkg/errors"

View file

@ -1,4 +1,4 @@
package libkpod
package libpod
import (
"encoding/json"
@ -7,8 +7,8 @@ import (
"k8s.io/apimachinery/pkg/fields"
pb "k8s.io/kubernetes/pkg/kubelet/api/v1alpha1/runtime"
"github.com/kubernetes-incubator/cri-o/libkpod/driver"
libkpodimage "github.com/kubernetes-incubator/cri-o/libkpod/image"
"github.com/kubernetes-incubator/cri-o/libpod/driver"
libpodimage "github.com/kubernetes-incubator/cri-o/libpod/image"
"github.com/kubernetes-incubator/cri-o/oci"
"github.com/opencontainers/image-spec/specs-go/v1"
specs "github.com/opencontainers/runtime-spec/specs-go"
@ -77,7 +77,7 @@ func (c *ContainerServer) GetContainerData(name string, size bool) (*ContainerDa
if container.ImageID == "" {
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 {
return nil, errors.Wrapf(err, "error reading container image data")
}

View file

@ -1,4 +1,4 @@
package libkpod
package libpod
import (
"encoding/json"
@ -12,7 +12,7 @@ import (
cstorage "github.com/containers/storage"
"github.com/docker/docker/pkg/ioutils"
"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/pkg/annotations"
"github.com/kubernetes-incubator/cri-o/pkg/registrar"

View file

@ -15,7 +15,7 @@ import (
"github.com/containers/image/types"
"github.com/containers/storage"
"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"
)

View file

@ -16,7 +16,7 @@ import (
"github.com/containers/storage/pkg/archive"
"github.com/docker/docker/pkg/ioutils"
"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"
"github.com/opencontainers/image-spec/specs-go/v1"
ociv1 "github.com/opencontainers/image-spec/specs-go/v1"

View file

@ -9,7 +9,7 @@ import (
"github.com/containers/image/transports"
"github.com/containers/image/types"
"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"
"github.com/pkg/errors"
)

View file

@ -7,7 +7,7 @@ import (
"github.com/containers/image/docker/reference"
"github.com/containers/image/transports"
"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"
ociv1 "github.com/opencontainers/image-spec/specs-go/v1"
"github.com/pkg/errors"

View file

@ -5,13 +5,13 @@ import (
"io/ioutil"
"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
// the server. This is intended to be loaded from a toml-encoded config file.
type Config struct {
libkpod.Config
libpod.Config
APIConfig
}
@ -34,11 +34,11 @@ type APIConfig struct {
// conversions.
type tomlConfig struct {
Crio struct {
libkpod.RootConfig
API struct{ APIConfig } `toml:"api"`
Runtime struct{ libkpod.RuntimeConfig } `toml:"runtime"`
Image struct{ libkpod.ImageConfig } `toml:"image"`
Network struct{ libkpod.NetworkConfig } `toml:"network"`
libpod.RootConfig
API struct{ APIConfig } `toml:"api"`
Runtime struct{ libpod.RuntimeConfig } `toml:"runtime"`
Image struct{ libpod.ImageConfig } `toml:"image"`
Network struct{ libpod.NetworkConfig } `toml:"network"`
} `toml:"crio"`
}
@ -99,7 +99,7 @@ func (c *Config) ToFile(path string) error {
// DefaultConfig returns the default configuration for crio.
func DefaultConfig() *Config {
return &Config{
Config: *libkpod.DefaultConfig(),
Config: *libpod.DefaultConfig(),
APIConfig: APIConfig{
Listen: "/var/run/crio.sock",
StreamAddress: "",

View file

@ -13,8 +13,8 @@ import (
"github.com/docker/docker/pkg/stringid"
"github.com/docker/docker/pkg/symlink"
"github.com/kubernetes-incubator/cri-o/libkpod"
"github.com/kubernetes-incubator/cri-o/libkpod/sandbox"
"github.com/kubernetes-incubator/cri-o/libpod"
"github.com/kubernetes-incubator/cri-o/libpod/sandbox"
"github.com/kubernetes-incubator/cri-o/oci"
"github.com/kubernetes-incubator/cri-o/pkg/annotations"
"github.com/kubernetes-incubator/cri-o/pkg/storage"
@ -83,11 +83,11 @@ func addImageVolumes(rootfs string, s *Server, containerInfo *storage.ContainerI
return err
}
switch s.config.ImageVolumes {
case libkpod.ImageVolumesMkdir:
case libpod.ImageVolumesMkdir:
if err1 := os.MkdirAll(fp, 0644); err1 != nil {
return err1
}
case libkpod.ImageVolumesBind:
case libpod.ImageVolumesBind:
volumeDirName := stringid.GenerateNonCryptoID()
src := filepath.Join(containerInfo.RunDir, "mounts", volumeDirName)
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)
specgen.AddBindMount(src, dest, []string{"rw"})
case libkpod.ImageVolumesIgnore:
case libpod.ImageVolumesIgnore:
logrus.Debugf("Ignoring volume %v", dest)
default:
logrus.Fatalf("Unrecognized image volumes setting")

View file

@ -1,7 +1,7 @@
package server
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/sirupsen/logrus"
"golang.org/x/net/context"

View file

@ -4,7 +4,7 @@ import (
"fmt"
"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"
pkgstorage "github.com/kubernetes-incubator/cri-o/pkg/storage"
"github.com/pkg/errors"

View file

@ -12,7 +12,7 @@ import (
"time"
"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/pkg/annotations"
"github.com/opencontainers/runc/libcontainer/cgroups/systemd"

View file

@ -7,7 +7,7 @@ import (
"github.com/containers/storage"
"github.com/docker/docker/pkg/mount"
"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/opencontainers/selinux/go-selinux/label"
"github.com/pkg/errors"

View file

@ -9,8 +9,8 @@ import (
"os"
"sync"
"github.com/kubernetes-incubator/cri-o/libkpod"
"github.com/kubernetes-incubator/cri-o/libkpod/sandbox"
"github.com/kubernetes-incubator/cri-o/libpod"
"github.com/kubernetes-incubator/cri-o/libpod/sandbox"
"github.com/kubernetes-incubator/cri-o/oci"
"github.com/kubernetes-incubator/cri-o/pkg/ocicni"
"github.com/kubernetes-incubator/cri-o/pkg/storage"
@ -47,7 +47,7 @@ type streamService struct {
// Server implements the RuntimeService and ImageService
type Server struct {
*libkpod.ContainerServer
*libpod.ContainerServer
config Config
updateLock sync.RWMutex
@ -148,7 +148,7 @@ func New(config *Config) (*Server, error) {
if err := os.MkdirAll("/var/run/crio", 0755); err != nil {
return nil, err
}
containerServer, err := libkpod.New(&config.Config)
containerServer, err := libpod.New(&config.Config)
if err != nil {
return nil, err
}