add description of pvc condition for kubectl describe command

This commit is contained in:
mlmhl 2018-02-10 19:22:15 +08:00
parent 4f76fc2042
commit 49dcdbe2c5

View File

@ -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)
}