Merge pull request #55873 from jsafrane/show-pvc-terminating

Automatic merge from submit-queue (batch tested with PRs 55873, 56156). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

kubectl: Add Terminating state to PVCs

kubectl should show something when a PVC has a deletion timestamp and is waiting for deletion. This patch follows Pod - it adds Terminating state.

For easier discovery of errors, finalizers are printed in `kubectl describe pvc`.

This is part of [PVC finalizer feature for 1.9](https://github.com/kubernetes/community/blob/master/contributors/design-proposals/storage/postpone-pvc-deletion-if-used-in-a-pod.md) where we will keep PVC waiting for deletion for a longer time than before so users should know what is going on.

/sig cli

**Release note**:
```release-note
NONE
```
pull/6/head
Kubernetes Submit Queue 2017-11-22 06:43:23 -08:00 committed by GitHub
commit 8f23d76de1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 1 deletions

View File

@ -1224,10 +1224,15 @@ func describePersistentVolumeClaim(pvc *api.PersistentVolumeClaim, events *api.E
w.Write(LEVEL_0, "Name:\t%s\n", pvc.Name)
w.Write(LEVEL_0, "Namespace:\t%s\n", pvc.Namespace)
w.Write(LEVEL_0, "StorageClass:\t%s\n", helper.GetPersistentVolumeClaimClass(pvc))
w.Write(LEVEL_0, "Status:\t%v\n", pvc.Status.Phase)
if pvc.ObjectMeta.DeletionTimestamp != nil {
w.Write(LEVEL_0, "Status:\tTerminating (since %s)\n", pvc.ObjectMeta.DeletionTimestamp.Time.Format(time.RFC1123Z))
} else {
w.Write(LEVEL_0, "Status:\t%v\n", pvc.Status.Phase)
}
w.Write(LEVEL_0, "Volume:\t%s\n", pvc.Spec.VolumeName)
printLabelsMultiline(w, "Labels", pvc.Labels)
printAnnotationsMultiline(w, "Annotations", pvc.Annotations)
w.Write(LEVEL_0, "Finalizers:\t%v\n", pvc.ObjectMeta.Finalizers)
storage := pvc.Spec.Resources.Requests[api.ResourceStorage]
capacity := ""
accessModes := ""

View File

@ -1226,6 +1226,10 @@ func printPersistentVolumeClaim(obj *api.PersistentVolumeClaim, options printers
}
phase := obj.Status.Phase
if obj.ObjectMeta.DeletionTimestamp != nil {
phase = "Terminating"
}
storage := obj.Spec.Resources.Requests[api.ResourceStorage]
capacity := ""
accessModes := ""