ahmetb / kubectl-tree

kubectl plugin to browse Kubernetes object hierarchies as a tree 🎄 (star the repo if you are using)
Apache License 2.0
3.01k stars 127 forks source link

Completed Pods are coloured red #34

Open johscheuer opened 4 years ago

johscheuer commented 4 years ago

Hi,

when I create a CronJob with the following spec:

apiVersion: batch/v1beta1
kind: CronJob
metadata:
  name: sleepy
spec:
  schedule: "*/2 * * * *"
  jobTemplate:
    spec:
      template:
        spec:
          containers:
          - name: resting
            image: busybox
            command: ["/bin/sleep"]
            args: ["3"]
          restartPolicy: Never

and when I use kubectl tree after a Job was created and has successful completed the Reason PodCompleted will be coloured red. I assume (without looking in the code) that the Reason is always coloured red if the Pod is not ready? For me red means normally some kind of a failure what about changing the colour of the Reason PodCompleted to green (or something similar)?

 kubectl tree cronjob sleepy
NAMESPACE  NAME                    READY  REASON        AGE
default    CronJob/sleepy          -                    62s
default    └─Job/me-sleep          -                    9s
default      └─Pod/me-sleep-qkhxm  False  PodCompleted  9s
ahmetb commented 4 years ago

I believe the code looks for Ready condition in the status.

We should probably fix this, but we need to probably make a one-off exception for PodCompleted.