Merge pull request #51607 from xingzhou/sc-newfield

Automatic merge from submit-queue (batch tested with PRs 51438, 52182, 51607, 47912, 51595). 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>..

Add `ReclaimPolicy` field to `kubectl describe storageclass` output.

Add `ReclaimPolicy` field to `kubectl describe storageclass` output.

PR https://github.com/kubernetes/kubernetes/pull/47987 added `ReclaimPolicy` field to StorageClass.

**Release note**:
```release-note
None
```
pull/6/head
Kubernetes Submit Queue 2017-09-23 08:09:48 -07:00 committed by GitHub
commit 8064930037
2 changed files with 5 additions and 0 deletions

View File

@ -3128,6 +3128,9 @@ func describeStorageClass(sc *storage.StorageClass, events *api.EventList) (stri
w.Write(LEVEL_0, "Annotations:\t%s\n", labels.FormatLabels(sc.Annotations)) w.Write(LEVEL_0, "Annotations:\t%s\n", labels.FormatLabels(sc.Annotations))
w.Write(LEVEL_0, "Provisioner:\t%s\n", sc.Provisioner) w.Write(LEVEL_0, "Provisioner:\t%s\n", sc.Provisioner)
w.Write(LEVEL_0, "Parameters:\t%s\n", labels.FormatLabels(sc.Parameters)) w.Write(LEVEL_0, "Parameters:\t%s\n", labels.FormatLabels(sc.Parameters))
if sc.ReclaimPolicy != nil {
w.Write(LEVEL_0, "ReclaimPolicy:\t%s\n", *sc.ReclaimPolicy)
}
if events != nil { if events != nil {
DescribeEvents(events, w) DescribeEvents(events, w)
} }

View File

@ -819,6 +819,7 @@ func TestDescribeCluster(t *testing.T) {
} }
func TestDescribeStorageClass(t *testing.T) { func TestDescribeStorageClass(t *testing.T) {
reclaimPolicy := api.PersistentVolumeReclaimRetain
f := fake.NewSimpleClientset(&storage.StorageClass{ f := fake.NewSimpleClientset(&storage.StorageClass{
ObjectMeta: metav1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Name: "foo", Name: "foo",
@ -832,6 +833,7 @@ func TestDescribeStorageClass(t *testing.T) {
"param1": "value1", "param1": "value1",
"param2": "value2", "param2": "value2",
}, },
ReclaimPolicy: &reclaimPolicy,
}) })
s := StorageClassDescriber{f} s := StorageClassDescriber{f}
out, err := s.Describe("", "foo", printers.DescriberSettings{ShowEvents: true}) out, err := s.Describe("", "foo", printers.DescriberSettings{ShowEvents: true})