cmd

package
v0.0.0-...-77bde7e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 21, 2019 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var WatchAllPodsCmd = &cobra.Command{
	Use:   "a",
	Short: "Watch all the pods in a k8s cluster",
	Long:  "Watch all the pods in a k8s cluster",
	Run: func(cmd *cobra.Command, args []string) {
		ktoolgrid.InitGrid()
		defer ui.Close()

		kubeconfig, _ := config.KubeConfig()

		pane := widgets.NewParagraph()
		pane.Text = pods.GetPods(kubeconfig)
		pane.Title = "Context | All pods"

		grid, uiEvents, ticker, err := ktoolgrid.SinglePane(pane)
		utils.ErrorHandler(err)

		for {
			select {
			case e := <-uiEvents:
				switch e.ID {
				case "q", "<C-c>":
					return
				case "<Resize>":
					payload := e.Payload.(ui.Resize)
					grid.SetRect(0, 0, payload.Width, payload.Height)
					ui.Clear()
					ui.Render(grid)
				}
			case <-ticker:

				pane.Text = pods.GetPods(kubeconfig)
				ui.Render(grid)
			}
		}
	},
}

WatchAllPodsCmd watches all pods in k8s cluster

View Source
var WatchPodLogsCommand = &cobra.Command{
	Use:   "l",
	Short: "Watch a pods logs",
	Long:  "Watch a pods logs",
	Run: func(cmd *cobra.Command, args []string) {
		views.WatchPodLogs()
	},
}

WatchPodLogsCommand watches a pod logs in k8s cluster

Functions

func CheckError

func CheckError(err error)

CheckError prints err to stderr and exits with code 1 if err is not nil. Otherwise, it is a no-op.

func Cleanup

func Cleanup(exitChan chan int)

Cleanup Cleans up after ourself

func Execute

func Execute()

Execute executes cobra

func Exit

func Exit(code int, msg string, args ...interface{})

Exit prints msg (with optional args), plus a newline, to stderr and exits with code 1.

func RegisterCleanup

func RegisterCleanup() chan int

RegisterCleanup cleans up when call to cancel is initiated

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL