Merge pull request #1192 from runcom/no-libkpod

libkpod -> lib rename
This commit is contained in:
Daniel J Walsh 2017-12-01 08:44:44 -05:00 committed by GitHub
commit b9ffd277b9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
28 changed files with 56 additions and 56 deletions

View file

@ -14,7 +14,7 @@ import (
"time" "time"
"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/lib"
"github.com/kubernetes-incubator/cri-o/server" "github.com/kubernetes-incubator/cri-o/server"
"github.com/kubernetes-incubator/cri-o/version" "github.com/kubernetes-incubator/cri-o/version"
"github.com/opencontainers/selinux/go-selinux" "github.com/opencontainers/selinux/go-selinux"
@ -32,9 +32,9 @@ var gitCommit = ""
func validateConfig(config *server.Config) error { func validateConfig(config *server.Config) error {
switch config.ImageVolumes { switch config.ImageVolumes {
case libkpod.ImageVolumesMkdir: case lib.ImageVolumesMkdir:
case libkpod.ImageVolumesIgnore: case lib.ImageVolumesIgnore:
case libkpod.ImageVolumesBind: case lib.ImageVolumesBind:
default: default:
return fmt.Errorf("Unrecognized image volume type specified") return fmt.Errorf("Unrecognized image volume type specified")
@ -145,7 +145,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 = lib.ImageVolumesType(ctx.GlobalString("image-volumes"))
} }
return nil return nil
} }
@ -297,7 +297,7 @@ func main() {
}, },
cli.Int64Flag{ cli.Int64Flag{
Name: "pids-limit", Name: "pids-limit",
Value: libkpod.DefaultPidsLimit, Value: lib.DefaultPidsLimit,
Usage: "maximum number of processes allowed in a container", Usage: "maximum number of processes allowed in a container",
}, },
cli.BoolFlag{ cli.BoolFlag{
@ -306,7 +306,7 @@ func main() {
}, },
cli.Int64Flag{ cli.Int64Flag{
Name: "log-size-max", Name: "log-size-max",
Value: libkpod.DefaultLogSizeMax, Value: lib.DefaultLogSizeMax,
Usage: "maximum log size in bytes for a container", Usage: "maximum log size in bytes for a container",
}, },
cli.StringFlag{ cli.StringFlag{
@ -319,13 +319,13 @@ func main() {
}, },
cli.StringFlag{ cli.StringFlag{
Name: "image-volumes", Name: "image-volumes",
Value: string(libkpod.ImageVolumesMkdir), Value: string(lib.ImageVolumesMkdir),
Usage: "image volume handling ('mkdir', 'bind', or 'ignore')", Usage: "image volume handling ('mkdir', 'bind', or 'ignore')",
}, },
cli.StringFlag{ cli.StringFlag{
Name: "hooks-dir-path", Name: "hooks-dir-path",
Usage: "set the OCI hooks directory path", Usage: "set the OCI hooks directory path",
Value: libkpod.DefaultHooksDirPath, Value: lib.DefaultHooksDirPath,
Hidden: true, Hidden: true,
}, },
cli.StringSliceFlag{ cli.StringSliceFlag{

View file

@ -1,4 +1,4 @@
package libkpod package lib
import ( import (
"bytes" "bytes"
@ -83,7 +83,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 lib are
// present on the same system // present on the same system
FileLocking bool `toml:"file_locking"` FileLocking bool `toml:"file_locking"`
} }

View file

@ -1,4 +1,4 @@
package libkpod package lib
import ( import (
"io/ioutil" "io/ioutil"

View file

@ -1,10 +1,10 @@
package libkpod package lib
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/lib/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"

View file

@ -1,4 +1,4 @@
package libkpod package lib
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/lib/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"

View file

@ -1,4 +1,4 @@
package libkpod package lib
import ( import (
"encoding/json" "encoding/json"

View file

@ -1,4 +1,4 @@
package libkpod package lib
import ( import (
"github.com/docker/docker/pkg/signal" "github.com/docker/docker/pkg/signal"

View file

@ -1,4 +1,4 @@
package libkpod package lib
import ( import (
"path" "path"

View file

@ -1,4 +1,4 @@
package libkpod package lib
import ( import (
"github.com/kubernetes-incubator/cri-o/oci" "github.com/kubernetes-incubator/cri-o/oci"

View file

@ -1,4 +1,4 @@
package libkpod package lib
import ( import (
"os" "os"

View file

@ -1,4 +1,4 @@
package libkpod package lib
import ( import (
"encoding/json" "encoding/json"

View file

@ -1,4 +1,4 @@
package libkpod package lib
import ( import (
"path/filepath" "path/filepath"

View file

@ -1,4 +1,4 @@
package libkpod package lib
import ( import (
"github.com/kubernetes-incubator/cri-o/oci" "github.com/kubernetes-incubator/cri-o/oci"

View file

@ -1,4 +1,4 @@
package libkpod package lib
import ( import (
"github.com/kubernetes-incubator/cri-o/oci" "github.com/kubernetes-incubator/cri-o/oci"

View file

@ -5,7 +5,7 @@ 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/lib"
) )
//CrioConfigPath is the default location for the conf file //CrioConfigPath is the default location for the conf file
@ -14,7 +14,7 @@ const CrioConfigPath = "/etc/crio/crio.conf"
// 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 lib.Config
APIConfig APIConfig
} }
@ -37,11 +37,11 @@ type APIConfig struct {
// conversions. // conversions.
type tomlConfig struct { type tomlConfig struct {
Crio struct { Crio struct {
libkpod.RootConfig lib.RootConfig
API struct{ APIConfig } `toml:"api"` API struct{ APIConfig } `toml:"api"`
Runtime struct{ libkpod.RuntimeConfig } `toml:"runtime"` Runtime struct{ lib.RuntimeConfig } `toml:"runtime"`
Image struct{ libkpod.ImageConfig } `toml:"image"` Image struct{ lib.ImageConfig } `toml:"image"`
Network struct{ libkpod.NetworkConfig } `toml:"network"` Network struct{ lib.NetworkConfig } `toml:"network"`
} `toml:"crio"` } `toml:"crio"`
} }
@ -102,7 +102,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: *lib.DefaultConfig(),
APIConfig: APIConfig{ APIConfig: APIConfig{
Listen: "/var/run/crio/crio.sock", Listen: "/var/run/crio/crio.sock",
StreamAddress: "", StreamAddress: "",

View file

@ -5,7 +5,7 @@ import (
"os" "os"
"testing" "testing"
"github.com/kubernetes-incubator/cri-o/libkpod" "github.com/kubernetes-incubator/cri-o/lib"
) )
const fixturePath = "fixtures/crio.conf" const fixturePath = "fixtures/crio.conf"
@ -44,7 +44,7 @@ func assertAllFieldsEquality(t *testing.T, c Config) {
{c.ImageConfig.PauseImage, "kubernetes/pause"}, {c.ImageConfig.PauseImage, "kubernetes/pause"},
{c.ImageConfig.PauseCommand, "/pause"}, {c.ImageConfig.PauseCommand, "/pause"},
{c.ImageConfig.SignaturePolicyPath, "/tmp"}, {c.ImageConfig.SignaturePolicyPath, "/tmp"},
{c.ImageConfig.ImageVolumes, libkpod.ImageVolumesType("mkdir")}, {c.ImageConfig.ImageVolumes, lib.ImageVolumesType("mkdir")},
{c.ImageConfig.InsecureRegistries[0], "insecure-registry:1234"}, {c.ImageConfig.InsecureRegistries[0], "insecure-registry:1234"},
{c.ImageConfig.Registries[0], "registry:4321"}, {c.ImageConfig.Registries[0], "registry:4321"},

View file

@ -18,8 +18,8 @@ import (
dockermounts "github.com/docker/docker/pkg/mount" dockermounts "github.com/docker/docker/pkg/mount"
"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/lib"
"github.com/kubernetes-incubator/cri-o/libkpod/sandbox" "github.com/kubernetes-incubator/cri-o/lib/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"
@ -234,11 +234,11 @@ func addImageVolumes(rootfs string, s *Server, containerInfo *storage.ContainerI
return nil, err return nil, err
} }
switch s.config.ImageVolumes { switch s.config.ImageVolumes {
case libkpod.ImageVolumesMkdir: case lib.ImageVolumesMkdir:
if err1 := os.MkdirAll(fp, 0644); err1 != nil { if err1 := os.MkdirAll(fp, 0644); err1 != nil {
return nil, err1 return nil, err1
} }
case libkpod.ImageVolumesBind: case lib.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 {
@ -258,7 +258,7 @@ func addImageVolumes(rootfs string, s *Server, containerInfo *storage.ContainerI
Options: []string{"rw"}, Options: []string{"rw"},
}) })
case libkpod.ImageVolumesIgnore: case lib.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")
@ -424,7 +424,7 @@ func buildOCIProcessArgs(containerKubeConfig *pb.ContainerConfig, imageOCIConfig
} }
// addOCIHook look for hooks programs installed in hooksDirPath and add them to spec // addOCIHook look for hooks programs installed in hooksDirPath and add them to spec
func addOCIHook(specgen *generate.Generator, hook libkpod.HookParams) error { func addOCIHook(specgen *generate.Generator, hook lib.HookParams) error {
logrus.Debugf("AddOCIHook", hook) logrus.Debugf("AddOCIHook", hook)
for _, stage := range hook.Stage { for _, stage := range hook.Stage {
switch stage { switch stage {
@ -616,7 +616,7 @@ func (s *Server) CreateContainer(ctx context.Context, req *pb.CreateContainerReq
func (s *Server) setupOCIHooks(specgen *generate.Generator, sb *sandbox.Sandbox, containerConfig *pb.ContainerConfig, command string) error { func (s *Server) setupOCIHooks(specgen *generate.Generator, sb *sandbox.Sandbox, containerConfig *pb.ContainerConfig, command string) error {
mounts := containerConfig.GetMounts() mounts := containerConfig.GetMounts()
addedHooks := map[string]struct{}{} addedHooks := map[string]struct{}{}
addHook := func(hook libkpod.HookParams) error { addHook := func(hook lib.HookParams) error {
// Only add a hook once // Only add a hook once
if _, ok := addedHooks[hook.Hook]; !ok { if _, ok := addedHooks[hook.Hook]; !ok {
if err := addOCIHook(specgen, hook); err != nil { if err := addOCIHook(specgen, hook); err != nil {

View file

@ -7,7 +7,7 @@ import (
"net/http" "net/http"
"github.com/go-zoo/bone" "github.com/go-zoo/bone"
"github.com/kubernetes-incubator/cri-o/libkpod/sandbox" "github.com/kubernetes-incubator/cri-o/lib/sandbox"
"github.com/kubernetes-incubator/cri-o/oci" "github.com/kubernetes-incubator/cri-o/oci"
"github.com/kubernetes-incubator/cri-o/types" "github.com/kubernetes-incubator/cri-o/types"
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"

View file

@ -7,14 +7,14 @@ import (
"k8s.io/kubernetes/pkg/kubelet/apis/cri/v1alpha1/runtime" "k8s.io/kubernetes/pkg/kubelet/apis/cri/v1alpha1/runtime"
"github.com/containernetworking/plugins/pkg/ns" "github.com/containernetworking/plugins/pkg/ns"
"github.com/kubernetes-incubator/cri-o/libkpod" "github.com/kubernetes-incubator/cri-o/lib"
"github.com/kubernetes-incubator/cri-o/libkpod/sandbox" "github.com/kubernetes-incubator/cri-o/lib/sandbox"
"github.com/kubernetes-incubator/cri-o/oci" "github.com/kubernetes-incubator/cri-o/oci"
specs "github.com/opencontainers/runtime-spec/specs-go" specs "github.com/opencontainers/runtime-spec/specs-go"
) )
func TestGetInfo(t *testing.T) { func TestGetInfo(t *testing.T) {
c := libkpod.DefaultConfig() c := lib.DefaultConfig()
c.RootConfig.Storage = "afoobarstorage" c.RootConfig.Storage = "afoobarstorage"
c.RootConfig.Root = "afoobarroot" c.RootConfig.Root = "afoobarroot"
c.RuntimeConfig.CgroupManager = "systemd" c.RuntimeConfig.CgroupManager = "systemd"

View file

@ -3,7 +3,7 @@ package server
import ( import (
"time" "time"
"github.com/kubernetes-incubator/cri-o/libkpod/sandbox" "github.com/kubernetes-incubator/cri-o/lib/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"

View file

@ -4,7 +4,7 @@ import (
"fmt" "fmt"
"net" "net"
"github.com/kubernetes-incubator/cri-o/libkpod/sandbox" "github.com/kubernetes-incubator/cri-o/lib/sandbox"
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
"k8s.io/kubernetes/pkg/kubelet/network/hostport" "k8s.io/kubernetes/pkg/kubelet/network/hostport"
) )

View file

@ -5,7 +5,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/lib/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"

View file

@ -13,7 +13,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/lib/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"
runtimespec "github.com/opencontainers/runtime-spec/specs-go" runtimespec "github.com/opencontainers/runtime-spec/specs-go"

View file

@ -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/lib/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"

View file

@ -15,8 +15,8 @@ import (
"github.com/cri-o/ocicni/pkg/ocicni" "github.com/cri-o/ocicni/pkg/ocicni"
"github.com/fsnotify/fsnotify" "github.com/fsnotify/fsnotify"
"github.com/kubernetes-incubator/cri-o/libkpod" "github.com/kubernetes-incubator/cri-o/lib"
"github.com/kubernetes-incubator/cri-o/libkpod/sandbox" "github.com/kubernetes-incubator/cri-o/lib/sandbox"
"github.com/kubernetes-incubator/cri-o/oci" "github.com/kubernetes-incubator/cri-o/oci"
"github.com/kubernetes-incubator/cri-o/pkg/storage" "github.com/kubernetes-incubator/cri-o/pkg/storage"
"github.com/kubernetes-incubator/cri-o/server/apparmor" "github.com/kubernetes-incubator/cri-o/server/apparmor"
@ -53,7 +53,7 @@ type streamService struct {
// Server implements the RuntimeService and ImageService // Server implements the RuntimeService and ImageService
type Server struct { type Server struct {
*libkpod.ContainerServer *lib.ContainerServer
config Config config Config
updateLock sync.RWMutex updateLock sync.RWMutex
@ -190,7 +190,7 @@ func New(config *Config) (*Server, error) {
if err := os.MkdirAll(config.ContainerExitsDir, 0755); err != nil { if err := os.MkdirAll(config.ContainerExitsDir, 0755); err != nil {
return nil, err return nil, err
} }
containerServer, err := libkpod.New(&config.Config) containerServer, err := lib.New(&config.Config)
if err != nil { if err != nil {
return nil, err return nil, err
} }

View file

@ -8,7 +8,7 @@ import (
"time" "time"
"github.com/cri-o/ocicni/pkg/ocicni" "github.com/cri-o/ocicni/pkg/ocicni"
"github.com/kubernetes-incubator/cri-o/libkpod/sandbox" "github.com/kubernetes-incubator/cri-o/lib/sandbox"
"github.com/kubernetes-incubator/cri-o/server/metrics" "github.com/kubernetes-incubator/cri-o/server/metrics"
"github.com/opencontainers/image-spec/specs-go/v1" "github.com/opencontainers/image-spec/specs-go/v1"
"github.com/opencontainers/runtime-tools/validate" "github.com/opencontainers/runtime-tools/validate"