From b8bba70f99ed5cc659b988854b0aaa31cbfb67b5 Mon Sep 17 00:00:00 2001 From: Antonio Murdaca Date: Thu, 30 Nov 2017 16:46:11 +0100 Subject: [PATCH] libkpod -> lib rename Signed-off-by: Antonio Murdaca --- cmd/crio/main.go | 18 +++++++++--------- {libkpod => lib}/config.go | 4 ++-- {libkpod => lib}/config_test.go | 2 +- {libkpod => lib}/container.go | 4 ++-- {libkpod => lib}/container_server.go | 4 ++-- {libkpod => lib}/hooks.go | 2 +- {libkpod => lib}/kill.go | 2 +- {libkpod => lib}/logs.go | 2 +- {libkpod => lib}/pause.go | 2 +- {libkpod => lib}/remove.go | 2 +- {libkpod => lib}/rename.go | 2 +- {libkpod => lib}/sandbox/sandbox.go | 0 {libkpod => lib}/stats.go | 2 +- {libkpod => lib}/stop.go | 2 +- {libkpod => lib}/testdata/config.toml | 0 {libkpod => lib}/wait.go | 2 +- server/config.go | 16 ++++++++-------- server/config_test.go | 4 ++-- server/container_create.go | 14 +++++++------- server/inspect.go | 2 +- server/inspect_test.go | 6 +++--- server/sandbox_list.go | 2 +- server/sandbox_network.go | 2 +- server/sandbox_remove.go | 2 +- server/sandbox_run.go | 2 +- server/sandbox_stop.go | 2 +- server/server.go | 8 ++++---- server/utils.go | 2 +- 28 files changed, 56 insertions(+), 56 deletions(-) rename {libkpod => lib}/config.go (99%) rename {libkpod => lib}/config_test.go (98%) rename {libkpod => lib}/container.go (98%) rename {libkpod => lib}/container_server.go (99%) rename {libkpod => lib}/hooks.go (99%) rename {libkpod => lib}/kill.go (98%) rename {libkpod => lib}/logs.go (99%) rename {libkpod => lib}/pause.go (98%) rename {libkpod => lib}/remove.go (98%) rename {libkpod => lib}/rename.go (99%) rename {libkpod => lib}/sandbox/sandbox.go (100%) rename {libkpod => lib}/stats.go (99%) rename {libkpod => lib}/stop.go (98%) rename {libkpod => lib}/testdata/config.toml (100%) rename {libkpod => lib}/wait.go (98%) diff --git a/cmd/crio/main.go b/cmd/crio/main.go index 2f91c115..f2cd32c5 100644 --- a/cmd/crio/main.go +++ b/cmd/crio/main.go @@ -14,7 +14,7 @@ import ( "time" "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/version" "github.com/opencontainers/selinux/go-selinux" @@ -32,9 +32,9 @@ var gitCommit = "" func validateConfig(config *server.Config) error { switch config.ImageVolumes { - case libkpod.ImageVolumesMkdir: - case libkpod.ImageVolumesIgnore: - case libkpod.ImageVolumesBind: + case lib.ImageVolumesMkdir: + case lib.ImageVolumesIgnore: + case lib.ImageVolumesBind: default: 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") } if ctx.GlobalIsSet("image-volumes") { - config.ImageVolumes = libkpod.ImageVolumesType(ctx.GlobalString("image-volumes")) + config.ImageVolumes = lib.ImageVolumesType(ctx.GlobalString("image-volumes")) } return nil } @@ -297,7 +297,7 @@ func main() { }, cli.Int64Flag{ Name: "pids-limit", - Value: libkpod.DefaultPidsLimit, + Value: lib.DefaultPidsLimit, Usage: "maximum number of processes allowed in a container", }, cli.BoolFlag{ @@ -306,7 +306,7 @@ func main() { }, cli.Int64Flag{ Name: "log-size-max", - Value: libkpod.DefaultLogSizeMax, + Value: lib.DefaultLogSizeMax, Usage: "maximum log size in bytes for a container", }, cli.StringFlag{ @@ -319,13 +319,13 @@ func main() { }, cli.StringFlag{ Name: "image-volumes", - Value: string(libkpod.ImageVolumesMkdir), + Value: string(lib.ImageVolumesMkdir), Usage: "image volume handling ('mkdir', 'bind', or 'ignore')", }, cli.StringFlag{ Name: "hooks-dir-path", Usage: "set the OCI hooks directory path", - Value: libkpod.DefaultHooksDirPath, + Value: lib.DefaultHooksDirPath, Hidden: true, }, cli.StringSliceFlag{ diff --git a/libkpod/config.go b/lib/config.go similarity index 99% rename from libkpod/config.go rename to lib/config.go index 9007f35d..6a63b2b0 100644 --- a/libkpod/config.go +++ b/lib/config.go @@ -1,4 +1,4 @@ -package libkpod +package lib import ( "bytes" @@ -83,7 +83,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 lib are // present on the same system FileLocking bool `toml:"file_locking"` } diff --git a/libkpod/config_test.go b/lib/config_test.go similarity index 98% rename from libkpod/config_test.go rename to lib/config_test.go index e6820d3c..59998382 100644 --- a/libkpod/config_test.go +++ b/lib/config_test.go @@ -1,4 +1,4 @@ -package libkpod +package lib import ( "io/ioutil" diff --git a/libkpod/container.go b/lib/container.go similarity index 98% rename from libkpod/container.go rename to lib/container.go index 7835952d..8264ab6a 100644 --- a/libkpod/container.go +++ b/lib/container.go @@ -1,10 +1,10 @@ -package libkpod +package lib import ( "fmt" 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/pkg/registrar" "github.com/pkg/errors" diff --git a/libkpod/container_server.go b/lib/container_server.go similarity index 99% rename from libkpod/container_server.go rename to lib/container_server.go index 0df18d8c..fdc9f9b7 100644 --- a/libkpod/container_server.go +++ b/lib/container_server.go @@ -1,4 +1,4 @@ -package libkpod +package lib 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/lib/sandbox" "github.com/kubernetes-incubator/cri-o/oci" "github.com/kubernetes-incubator/cri-o/pkg/annotations" "github.com/kubernetes-incubator/cri-o/pkg/registrar" diff --git a/libkpod/hooks.go b/lib/hooks.go similarity index 99% rename from libkpod/hooks.go rename to lib/hooks.go index f353cdcd..074ce7cc 100644 --- a/libkpod/hooks.go +++ b/lib/hooks.go @@ -1,4 +1,4 @@ -package libkpod +package lib import ( "encoding/json" diff --git a/libkpod/kill.go b/lib/kill.go similarity index 98% rename from libkpod/kill.go rename to lib/kill.go index b2c3219a..356932f1 100644 --- a/libkpod/kill.go +++ b/lib/kill.go @@ -1,4 +1,4 @@ -package libkpod +package lib import ( "github.com/docker/docker/pkg/signal" diff --git a/libkpod/logs.go b/lib/logs.go similarity index 99% rename from libkpod/logs.go rename to lib/logs.go index 00b0f016..d287b153 100644 --- a/libkpod/logs.go +++ b/lib/logs.go @@ -1,4 +1,4 @@ -package libkpod +package lib import ( "path" diff --git a/libkpod/pause.go b/lib/pause.go similarity index 98% rename from libkpod/pause.go rename to lib/pause.go index 29871d32..70087a3a 100644 --- a/libkpod/pause.go +++ b/lib/pause.go @@ -1,4 +1,4 @@ -package libkpod +package lib import ( "github.com/kubernetes-incubator/cri-o/oci" diff --git a/libkpod/remove.go b/lib/remove.go similarity index 98% rename from libkpod/remove.go rename to lib/remove.go index 5df9e8f7..e020637f 100644 --- a/libkpod/remove.go +++ b/lib/remove.go @@ -1,4 +1,4 @@ -package libkpod +package lib import ( "os" diff --git a/libkpod/rename.go b/lib/rename.go similarity index 99% rename from libkpod/rename.go rename to lib/rename.go index 7c0279bf..d03c3b13 100644 --- a/libkpod/rename.go +++ b/lib/rename.go @@ -1,4 +1,4 @@ -package libkpod +package lib import ( "encoding/json" diff --git a/libkpod/sandbox/sandbox.go b/lib/sandbox/sandbox.go similarity index 100% rename from libkpod/sandbox/sandbox.go rename to lib/sandbox/sandbox.go diff --git a/libkpod/stats.go b/lib/stats.go similarity index 99% rename from libkpod/stats.go rename to lib/stats.go index f4d645d6..229d8409 100644 --- a/libkpod/stats.go +++ b/lib/stats.go @@ -1,4 +1,4 @@ -package libkpod +package lib import ( "path/filepath" diff --git a/libkpod/stop.go b/lib/stop.go similarity index 98% rename from libkpod/stop.go rename to lib/stop.go index 86c9cbec..7dbbd066 100644 --- a/libkpod/stop.go +++ b/lib/stop.go @@ -1,4 +1,4 @@ -package libkpod +package lib import ( "github.com/kubernetes-incubator/cri-o/oci" diff --git a/libkpod/testdata/config.toml b/lib/testdata/config.toml similarity index 100% rename from libkpod/testdata/config.toml rename to lib/testdata/config.toml diff --git a/libkpod/wait.go b/lib/wait.go similarity index 98% rename from libkpod/wait.go rename to lib/wait.go index c7ba5732..c7b84c04 100644 --- a/libkpod/wait.go +++ b/lib/wait.go @@ -1,4 +1,4 @@ -package libkpod +package lib import ( "github.com/kubernetes-incubator/cri-o/oci" diff --git a/server/config.go b/server/config.go index cbb692b5..541bfdc0 100644 --- a/server/config.go +++ b/server/config.go @@ -5,7 +5,7 @@ import ( "io/ioutil" "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 @@ -14,7 +14,7 @@ const CrioConfigPath = "/etc/crio/crio.conf" // 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 + lib.Config APIConfig } @@ -37,11 +37,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"` + lib.RootConfig + API struct{ APIConfig } `toml:"api"` + Runtime struct{ lib.RuntimeConfig } `toml:"runtime"` + Image struct{ lib.ImageConfig } `toml:"image"` + Network struct{ lib.NetworkConfig } `toml:"network"` } `toml:"crio"` } @@ -102,7 +102,7 @@ func (c *Config) ToFile(path string) error { // DefaultConfig returns the default configuration for crio. func DefaultConfig() *Config { return &Config{ - Config: *libkpod.DefaultConfig(), + Config: *lib.DefaultConfig(), APIConfig: APIConfig{ Listen: "/var/run/crio/crio.sock", StreamAddress: "", diff --git a/server/config_test.go b/server/config_test.go index 455d8f9f..9d8ddf04 100644 --- a/server/config_test.go +++ b/server/config_test.go @@ -5,7 +5,7 @@ import ( "os" "testing" - "github.com/kubernetes-incubator/cri-o/libkpod" + "github.com/kubernetes-incubator/cri-o/lib" ) const fixturePath = "fixtures/crio.conf" @@ -44,7 +44,7 @@ func assertAllFieldsEquality(t *testing.T, c Config) { {c.ImageConfig.PauseImage, "kubernetes/pause"}, {c.ImageConfig.PauseCommand, "/pause"}, {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.Registries[0], "registry:4321"}, diff --git a/server/container_create.go b/server/container_create.go index a59bca63..8f14c8a4 100644 --- a/server/container_create.go +++ b/server/container_create.go @@ -18,8 +18,8 @@ import ( dockermounts "github.com/docker/docker/pkg/mount" "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/lib" + "github.com/kubernetes-incubator/cri-o/lib/sandbox" "github.com/kubernetes-incubator/cri-o/oci" "github.com/kubernetes-incubator/cri-o/pkg/annotations" "github.com/kubernetes-incubator/cri-o/pkg/storage" @@ -234,11 +234,11 @@ func addImageVolumes(rootfs string, s *Server, containerInfo *storage.ContainerI return nil, err } switch s.config.ImageVolumes { - case libkpod.ImageVolumesMkdir: + case lib.ImageVolumesMkdir: if err1 := os.MkdirAll(fp, 0644); err1 != nil { return nil, err1 } - case libkpod.ImageVolumesBind: + case lib.ImageVolumesBind: volumeDirName := stringid.GenerateNonCryptoID() src := filepath.Join(containerInfo.RunDir, "mounts", volumeDirName) if err1 := os.MkdirAll(src, 0644); err1 != nil { @@ -258,7 +258,7 @@ func addImageVolumes(rootfs string, s *Server, containerInfo *storage.ContainerI Options: []string{"rw"}, }) - case libkpod.ImageVolumesIgnore: + case lib.ImageVolumesIgnore: logrus.Debugf("Ignoring volume %v", dest) default: 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 -func addOCIHook(specgen *generate.Generator, hook libkpod.HookParams) error { +func addOCIHook(specgen *generate.Generator, hook lib.HookParams) error { logrus.Debugf("AddOCIHook", hook) for _, stage := range hook.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 { mounts := containerConfig.GetMounts() addedHooks := map[string]struct{}{} - addHook := func(hook libkpod.HookParams) error { + addHook := func(hook lib.HookParams) error { // Only add a hook once if _, ok := addedHooks[hook.Hook]; !ok { if err := addOCIHook(specgen, hook); err != nil { diff --git a/server/inspect.go b/server/inspect.go index cc7765de..2aaac841 100644 --- a/server/inspect.go +++ b/server/inspect.go @@ -7,7 +7,7 @@ import ( "net/http" "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/types" "github.com/sirupsen/logrus" diff --git a/server/inspect_test.go b/server/inspect_test.go index 7be46c4e..c970fcd0 100644 --- a/server/inspect_test.go +++ b/server/inspect_test.go @@ -7,14 +7,14 @@ import ( "k8s.io/kubernetes/pkg/kubelet/apis/cri/v1alpha1/runtime" "github.com/containernetworking/plugins/pkg/ns" - "github.com/kubernetes-incubator/cri-o/libkpod" - "github.com/kubernetes-incubator/cri-o/libkpod/sandbox" + "github.com/kubernetes-incubator/cri-o/lib" + "github.com/kubernetes-incubator/cri-o/lib/sandbox" "github.com/kubernetes-incubator/cri-o/oci" specs "github.com/opencontainers/runtime-spec/specs-go" ) func TestGetInfo(t *testing.T) { - c := libkpod.DefaultConfig() + c := lib.DefaultConfig() c.RootConfig.Storage = "afoobarstorage" c.RootConfig.Root = "afoobarroot" c.RuntimeConfig.CgroupManager = "systemd" diff --git a/server/sandbox_list.go b/server/sandbox_list.go index 70ad42cc..4d629b88 100644 --- a/server/sandbox_list.go +++ b/server/sandbox_list.go @@ -3,7 +3,7 @@ package server import ( "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/sirupsen/logrus" "golang.org/x/net/context" diff --git a/server/sandbox_network.go b/server/sandbox_network.go index 15cf99c8..9b054bdc 100644 --- a/server/sandbox_network.go +++ b/server/sandbox_network.go @@ -4,7 +4,7 @@ import ( "fmt" "net" - "github.com/kubernetes-incubator/cri-o/libkpod/sandbox" + "github.com/kubernetes-incubator/cri-o/lib/sandbox" "github.com/sirupsen/logrus" "k8s.io/kubernetes/pkg/kubelet/network/hostport" ) diff --git a/server/sandbox_remove.go b/server/sandbox_remove.go index 85ce744e..62b2c698 100644 --- a/server/sandbox_remove.go +++ b/server/sandbox_remove.go @@ -5,7 +5,7 @@ import ( "time" "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" pkgstorage "github.com/kubernetes-incubator/cri-o/pkg/storage" "github.com/pkg/errors" diff --git a/server/sandbox_run.go b/server/sandbox_run.go index 4f9ced22..9e9ff487 100644 --- a/server/sandbox_run.go +++ b/server/sandbox_run.go @@ -13,7 +13,7 @@ import ( "time" "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/pkg/annotations" runtimespec "github.com/opencontainers/runtime-spec/specs-go" diff --git a/server/sandbox_stop.go b/server/sandbox_stop.go index 6cdf66e9..75e97291 100644 --- a/server/sandbox_stop.go +++ b/server/sandbox_stop.go @@ -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/lib/sandbox" "github.com/kubernetes-incubator/cri-o/oci" "github.com/opencontainers/selinux/go-selinux/label" "github.com/pkg/errors" diff --git a/server/server.go b/server/server.go index 709209b3..b42496c7 100644 --- a/server/server.go +++ b/server/server.go @@ -15,8 +15,8 @@ import ( "github.com/cri-o/ocicni/pkg/ocicni" "github.com/fsnotify/fsnotify" - "github.com/kubernetes-incubator/cri-o/libkpod" - "github.com/kubernetes-incubator/cri-o/libkpod/sandbox" + "github.com/kubernetes-incubator/cri-o/lib" + "github.com/kubernetes-incubator/cri-o/lib/sandbox" "github.com/kubernetes-incubator/cri-o/oci" "github.com/kubernetes-incubator/cri-o/pkg/storage" "github.com/kubernetes-incubator/cri-o/server/apparmor" @@ -53,7 +53,7 @@ type streamService struct { // Server implements the RuntimeService and ImageService type Server struct { - *libkpod.ContainerServer + *lib.ContainerServer config Config updateLock sync.RWMutex @@ -190,7 +190,7 @@ func New(config *Config) (*Server, error) { if err := os.MkdirAll(config.ContainerExitsDir, 0755); err != nil { return nil, err } - containerServer, err := libkpod.New(&config.Config) + containerServer, err := lib.New(&config.Config) if err != nil { return nil, err } diff --git a/server/utils.go b/server/utils.go index 2a15ab42..3e54c606 100644 --- a/server/utils.go +++ b/server/utils.go @@ -8,7 +8,7 @@ import ( "time" "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/opencontainers/runtime-tools/validate" "github.com/syndtr/gocapability/capability"