resources

package
v0.0.0-...-f29e771 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2024 License: BSD-2-Clause Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ListJobCmd = &cobra.Command{
	Use:   "list-jobs",
	Short: "prints list of jobs in a cluster under the given namespace",
	Args:  cobra.NoArgs,
	RunE: func(cmd *cobra.Command, args []string) error {
		namespace, _ := cmd.Flags().GetString("namespace")
		client := registry.GetKubeClient(registry.KubeClientKey)
		jobList, err := client.BatchV1().
			Jobs(namespace).
			List(context.Background(), metav1.ListOptions{})
		if err != nil {
			return errors.Errorf("error in retrieving job list %s", err)
		}
		tbl := createTable()
		for _, job := range jobList.Items {
			tbl.AppendRow(table.Row{job.ObjectMeta.Name, status(job)})
		}
		tbl.SetStyle(table.StyleColoredYellowWhiteOnBlack)
		tbl.Render()

		return nil
	},
}

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