ahmetb/kubectl-tree

Completed Pods are coloured red

johscheuer opened this issue · 1 comments

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

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.