From 899f672ee97c447c0cd293e8f2b1af9ab961c74e Mon Sep 17 00:00:00 2001 From: Matthew Heon Date: Thu, 5 Oct 2017 17:40:16 -0400 Subject: [PATCH] Further add to skeleton to make lint happy Signed-off-by: Matthew Heon --- cmd/kpod/create.go | 36 ++++++++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/cmd/kpod/create.go b/cmd/kpod/create.go index 0f2b8477..de71e31b 100644 --- a/cmd/kpod/create.go +++ b/cmd/kpod/create.go @@ -1,6 +1,9 @@ package main import ( + "fmt" + + spec "github.com/opencontainers/runtime-spec/specs-go" "github.com/pkg/errors" "github.com/urfave/cli" pb "k8s.io/kubernetes/pkg/kubelet/apis/cri/v1alpha1/runtime" @@ -186,7 +189,36 @@ func createCmd(c *cli.Context) error { if err != nil { return errors.Wrapf(err, "error creating libpod runtime") } - _ = runtime.GetConfig() - return errors.Errorf("NOT IMPLEMENTED") + createConfig, err := parseCreateOpts(c) + if err != nil { + return err + } + + runtimeSpec, err := createConfigToOCISpec(createConfig) + if err != nil { + return err + } + + ctr, err := runtime.NewContainer(runtimeSpec) + if err != nil { + return err + } + + // Should we also call ctr.Create() to make the container in runc? + + fmt.Printf("%s\n", ctr.ID()) + + return nil +} + +// Parses CLI options related to container creation into a config which can be +// parsed into an OCI runtime spec +func parseCreateOpts(c *cli.Context) (*createConfig, error) { + return nil, errors.Errorf("NOT IMPLEMENTED") +} + +// Parses information needed to create a container into an OCI runtime spec +func createConfigToOCISpec(config *createConfig) (*spec.Spec, error) { + return nil, errors.Errorf("NOT IMPLEMENTED") }