cmd

package
v0.0.0-...-5eabe3e Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2019 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// RootCmd is the root command of the plugin
	RootCmd = &cobra.Command{
		Use:   "kubectl glance",
		Short: "Kubectl glance",
		RunE: func(cmd *cobra.Command, args []string) error {

			s := spinner.New(spinner.CharSets[14], 100*time.Millisecond)
			s.Start()

			GlobalSettings.InitClient()
			w := tabwriter.NewWriter(os.Stdout, 3, 4, 1, ' ', tabwriter.AlignRight)

			nodesOK, nodesKO, cpuAllocatable, memAllocatable, err := GlobalSettings.GetNodes()
			fmt.Fprintln(
				w,
				fmt.Sprintf("Nodes\t %s (%s Unschedulable) Allocatable: CPU %s cores, Mem %s bytes",
					color.GreenString(strconv.Itoa(nodesOK)),
					color.RedString(strconv.Itoa(nodesKO)),
					color.GreenString(cpuAllocatable),
					color.GreenString(memAllocatable),
				),
			)

			resources, err := GlobalSettings.GetRessources()
			for resource, value := range resources {
				fmt.Fprintln(
					w,
					fmt.Sprintf("%s\t %s",
						strings.Title(resource),
						color.GreenString(strconv.Itoa(value)),
					),
				)
			}

			pv, err := GlobalSettings.GetPersistentVolumes()
			fmt.Fprintln(
				w,
				fmt.Sprintf("Persistent Volumes\t %s",
					color.GreenString(strconv.Itoa(pv)),
				),
			)

			s.Stop()
			w.Flush()
			return err
		},
	}
	// GlobalSettings holds common options/utils
	GlobalSettings *globalSettings
)

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

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