• Kubernetes Submit Queue's avatar
    Merge pull request #59169 from NickrenREN/kubectl-pv-terminating · f65f0722
    Kubernetes Submit Queue authored
    Automatic merge from submit-queue (batch tested with PRs 55439, 58564, 59028, 59169, 59259). 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 PVs
    
    kubectl shows PV `Terminating` status, just like Pod and [PVC](https://github.com/kubernetes/kubernetes/pull/55873)
    
    **What this PR does / why we need it**:
    We will postpone PV deletion if it is bound to a PVC, see #58743, so we may keep PV waiting for deletion for a longer time than before so users should know what is going on.
    
    **Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
    xref: https://github.com/kubernetes/community/pull/1608
    
    **Special notes for your reviewer**:
    
    **Release note**:
    ```release-note
    NONE
    ```
    /sig cli
    /sig storage
    /assign @jsafrane 
    
    I tested this PR on my local host.
    ```
    nickren@nickren-14:~/test/test$ kubectl delete -f pv.yaml 
    persistentvolume "task-pv-volume" deleted
    nickren@nickren-14:~/test/test$ kubectl get pv
    NAME             CAPACITY   ACCESS MODES   RECLAIM POLICY   STATUS        CLAIM                   STORAGECLASS   REASON    AGE
    task-pv-volume   1Gi        RWO            Delete           Terminating   default/task-pv-claim   standard                 27s
    nickren@nickren-14:~/test/test$ kubectl describe pv task-pv-volume
    Name:            task-pv-volume
    Labels:          type=local
    Annotations:     pv.kubernetes.io/bound-by-controller=yes
    Finalizers:      [kubernetes.io/pv-protection]
    StorageClass:    standard
    Status:          Terminating (since Thu, 01 Feb 2018 13:18:51 +0800)
    Claim:           default/task-pv-claim
    Reclaim Policy:  Delete
    Access Modes:    RWO
    Capacity:        1Gi
    Message:         
    Source:
        Type:          HostPath (bare host directory volume)
        Path:          /tmp/data
        HostPathType:  
    Events:            <none>
    ```
    f65f0722
Name
Last commit
Last update
..
.import-restrictions Loading commit data...
BUILD Loading commit data...
describe.go Loading commit data...
describe_test.go Loading commit data...
printers.go Loading commit data...
printers_test.go Loading commit data...
sorted_resource_name_list_test.go Loading commit data...