From 49dcdbe2c5aaae652d9c76fceb771670fbfcfcf9 Mon Sep 17 00:00:00 2001 From: mlmhl Date: Sat, 10 Feb 2018 19:22:15 +0800 Subject: [PATCH] add description of pvc condition for kubectl describe command --- pkg/printers/internalversion/describe.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/pkg/printers/internalversion/describe.go b/pkg/printers/internalversion/describe.go index bfcdfd33c02..9a68c295d7d 100644 --- a/pkg/printers/internalversion/describe.go +++ b/pkg/printers/internalversion/describe.go @@ -1264,6 +1264,20 @@ func describePersistentVolumeClaim(pvc *api.PersistentVolumeClaim, events *api.E if pvc.Spec.VolumeMode != nil { w.Write(LEVEL_0, "VolumeMode:\t%v\n", *pvc.Spec.VolumeMode) } + if len(pvc.Status.Conditions) > 0 { + w.Write(LEVEL_0, "Conditions:\n") + w.Write(LEVEL_1, "Type\tStatus\tLastProbeTime\tLastTransitionTime\tReason\tMessage\n") + w.Write(LEVEL_1, "----\t------\t-----------------\t------------------\t------\t-------\n") + for _, c := range pvc.Status.Conditions { + w.Write(LEVEL_1, "%v \t%v \t%s \t%s \t%v \t%v\n", + c.Type, + c.Status, + c.LastProbeTime.Time.Format(time.RFC1123Z), + c.LastTransitionTime.Time.Format(time.RFC1123Z), + c.Reason, + c.Message) + } + } if events != nil { DescribeEvents(events, w) }