mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-25 12:43:23 +00:00
Show terminating pods in get/describe
This commit is contained in:
parent
9d3631e3de
commit
ce3a6a666d
@ -271,7 +271,12 @@ func describePod(pod *api.Pod, rcs []api.ReplicationController, events *api.Even
|
||||
fmt.Fprintf(out, "Image(s):\t%s\n", makeImageList(&pod.Spec))
|
||||
fmt.Fprintf(out, "Node:\t%s\n", pod.Spec.NodeName+"/"+pod.Status.HostIP)
|
||||
fmt.Fprintf(out, "Labels:\t%s\n", formatLabels(pod.Labels))
|
||||
fmt.Fprintf(out, "Status:\t%s\n", string(pod.Status.Phase))
|
||||
if pod.DeletionTimestamp != nil {
|
||||
fmt.Fprintf(out, "Status:\tTerminating (expires %s)\n", pod.DeletionTimestamp.Time.Format(time.RFC1123Z))
|
||||
fmt.Fprintf(out, "Termination Grace Period:\t%ss\n", pod.DeletionGracePeriodSeconds)
|
||||
} else {
|
||||
fmt.Fprintf(out, "Status:\t%s\n", string(pod.Status.Phase))
|
||||
}
|
||||
fmt.Fprintf(out, "Replication Controllers:\t%s\n", printReplicationControllersByLabels(rcs))
|
||||
fmt.Fprintf(out, "Containers:\n")
|
||||
describeContainers(pod.Status.ContainerStatuses, out)
|
||||
|
@ -404,13 +404,17 @@ func printPod(pod *api.Pod, w io.Writer, withNamespace bool) error {
|
||||
name = pod.Name
|
||||
}
|
||||
|
||||
phase := string(pod.Status.Phase)
|
||||
if pod.DeletionTimestamp != nil {
|
||||
phase = "Terminating"
|
||||
}
|
||||
_, err := fmt.Fprintf(w, "%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n",
|
||||
name,
|
||||
pod.Status.PodIP,
|
||||
"", "",
|
||||
podHostString(pod.Spec.NodeName, pod.Status.HostIP),
|
||||
formatLabels(pod.Labels),
|
||||
pod.Status.Phase,
|
||||
phase,
|
||||
translateTimestamp(pod.CreationTimestamp),
|
||||
pod.Status.Message,
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user