Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Delete = &cli.Command{ Name: "pod", Usage: "call to delete pod in specific namespace", UsageText: "chkit delete pod pod_name [-n namespace]", Description: "deletes pods. Aliases: " + strings.Join(aliases, ", "), Aliases: aliases, Flags: cmdutil.DeleteFlags, Action: func(ctx *cli.Context) error { logrus.Debugf("running command delete pod") client := cmdutil.GetClient(ctx) namespace := cmdutil.GetNamespace(ctx) if ctx.NArg() == 0 { logrus.Debugf("show help") return cli.ShowSubcommandHelp(ctx) } pod := ctx.Args().First() logrus.Debugf("deleting pod %q from %q", pod, namespace) err := client.DeletePod(namespace, pod) logrus.WithError(err).Debugf("error while deleting pod") return err }, }
View Source
var GetPodAction = &cli.Command{ Name: "pod", Usage: "shows pod info", UsageText: "chkit get pod pod_label [-o yaml/json] [-f output_file]", Description: "shows pod info. Aliases: " + strings.Join(aliases, ", "), Aliases: aliases, Action: func(ctx *cli.Context) error { client := cmdutil.GetClient(ctx) defer cmdutil.StoreClient(ctx, client) var showItem model.Renderer var err error anime := &animation.Animation{ Framerate: 0.5, ClearLastFrame: true, Source: trasher.NewSilly(), } go func() { time.Sleep(time.Second) anime.Run() }() switch ctx.NArg() { case 0: namespaceLabel := cmdutil.GetNamespace(ctx) logrus.Debugf("getting pod list from %q", namespaceLabel) showItem, err = client.GetPodList(namespaceLabel) if err != nil { anime.Stop() return err } case 1: namespaceLabel := cmdutil.GetNamespace(ctx) showItem, err = client.GetPod(namespaceLabel, ctx.Args().First()) if err != nil { anime.Stop() return err } default: logrus.Debugf("getting pods") gainedList, err := client.GetPodList(cmdutil.GetNamespace(ctx)) var list pod.PodList if err != nil { anime.Stop() return err } podNames := cmdutil.NewSet(ctx.Args().Slice()) for _, pod := range gainedList { if podNames.Have(pod.Name) { list = append(list, pod) } } showItem = list } anime.Stop() err = cmdutil.ExportDataCommand(ctx, showItem) if err != nil { logrus.Debugf("fatal error: %v", err) } return err }, Flags: cmdutil.GetFlags, }
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.