Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Cmd = &cobra.Command{ Use: "bad-pods", Short: "Get bad pods (all pods without them with Phase in: Running, Succeeded", Aliases: []string{"bp"}, Args: cobra.NoArgs, Run: func(c *cobra.Command, args []string) { clientset, defaultNamespace, _ := k8s.KubernetesClient() namespace := defaultNamespace if FlagNamespace != "" { namespace = FlagNamespace } if FlagAllNamespaces { namespace = "" } podClient := clientset.CoreV1().Pods(namespace) pods, err := podClient.List(context.TODO(), metav1.ListOptions{}) if err != nil { log.Fatal(err) } for _, pod := range pods.Items { if pod.Status.Phase == "Running" { continue } if pod.Status.Phase == "Succeeded" { continue } fmt.Println(pod.Namespace, pod.Name, pod.Status.Phase) } }, }
View Source
var FlagAllNamespaces bool
View Source
var FlagNamespace string
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.