adds help for load command (#383)

* adds help for load command

Signed-off-by: Mike Brown <brownwm@us.ibm.com>

* vendor restrom/dedent

Signed-off-by: Mike Brown <brownwm@us.ibm.com>
This commit is contained in:
Mike Brown
2017-11-02 17:38:24 -05:00
committed by Lantao Liu
parent 4fa0975f9d
commit df6f4a3655
6 changed files with 156 additions and 6 deletions

View File

@@ -26,11 +26,13 @@ import (
"os/signal"
"path/filepath"
"runtime"
"strings"
"syscall"
"github.com/docker/docker/pkg/reexec"
"github.com/golang/glog"
"github.com/opencontainers/selinux/go-selinux"
"github.com/renstrom/dedent"
"github.com/spf13/cobra"
"golang.org/x/net/context"
"k8s.io/kubernetes/pkg/util/interrupt"
@@ -58,6 +60,30 @@ var cmd = &cobra.Command{
Long: desc,
}
var (
loadLong = dedent.Dedent(`
Help for "load TAR" command
TAR - The path to a tar archive containing a container image.
Requirement:
Containerd and cri-containerd daemons (grpc servers) must already be up and
running before the load command is used.
Description:
Running as a client, cri-containerd implements the load command by sending the
load request to the already running cri-containerd daemon/server, which in
turn loads the image into containerd's image storage via the already running
containerd daemon.`)
loadExample = dedent.Dedent(`
- use docker to pull the latest busybox image and save it as a tar archive:
$ docker pull busybox:latest
$ docker save busybox:latest -o busybox.tar
- use cri-containerd to load the image into containerd's image storage:
$ cri-containerd load busybox.tar`)
)
// Add golang flags as persistent flags.
func init() {
cmd.PersistentFlags().AddGoFlagSet(flag.CommandLine)
@@ -85,10 +111,13 @@ func versionCommand() *cobra.Command {
func loadImageCommand() *cobra.Command {
c := &cobra.Command{
Use: "load TAR",
Short: "Load an image from a tar archive.",
Args: cobra.ExactArgs(1),
Use: "load TAR",
Long: loadLong,
Short: "Load an image from a tar archive.",
Args: cobra.ExactArgs(1),
Example: loadExample,
}
c.SetUsageTemplate(strings.Replace(c.UsageTemplate(), "Examples:", "Example:", 1))
endpoint, timeout := options.AddGRPCFlags(c.Flags())
c.RunE = func(cmd *cobra.Command, args []string) error {
cl, err := client.NewCRIContainerdClient(*endpoint, *timeout)