Merge pull request #82464 from cwdsuzhou/Sep/add_apigroup_to_datasource

Add apigroup to the data source of pvc description
This commit is contained in:
Kubernetes Prow Robot 2019-09-11 18:29:29 -07:00 committed by GitHub
commit bd62a85624
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 3 deletions

View File

@ -1549,8 +1549,11 @@ func describePersistentVolumeClaim(pvc *corev1.PersistentVolumeClaim, events *co
} }
if pvc.Spec.DataSource != nil { if pvc.Spec.DataSource != nil {
w.Write(LEVEL_0, "DataSource:\n") w.Write(LEVEL_0, "DataSource:\n")
w.Write(LEVEL_1, "Name:\t%v\n", pvc.Spec.DataSource.Name) if pvc.Spec.DataSource.APIGroup != nil {
w.Write(LEVEL_1, "APIGroup:\t%v\n", *pvc.Spec.DataSource.APIGroup)
}
w.Write(LEVEL_1, "Kind:\t%v\n", pvc.Spec.DataSource.Kind) w.Write(LEVEL_1, "Kind:\t%v\n", pvc.Spec.DataSource.Kind)
w.Write(LEVEL_1, "Name:\t%v\n", pvc.Spec.DataSource.Name)
} }
printPodsMultiline(w, "Mounted By", mountPods) printPodsMultiline(w, "Mounted By", mountPods)

View File

@ -1595,7 +1595,7 @@ func TestPersistentVolumeClaimDescriber(t *testing.T) {
}, },
Status: corev1.PersistentVolumeClaimStatus{}, Status: corev1.PersistentVolumeClaimStatus{},
}, },
expectedElements: []string{"\nDataSource:\n Name: srcpvc\n Kind: PersistentVolumeClaim"}, expectedElements: []string{"\nDataSource:\n Kind: PersistentVolumeClaim\n Name: srcpvc"},
}, },
{ {
name: "snapshot-datasource", name: "snapshot-datasource",
@ -1615,7 +1615,7 @@ func TestPersistentVolumeClaimDescriber(t *testing.T) {
}, },
Status: corev1.PersistentVolumeClaimStatus{}, Status: corev1.PersistentVolumeClaimStatus{},
}, },
expectedElements: []string{"DataSource:\n Name: src-snapshot\n Kind: VolumeSnapshot\n"}, expectedElements: []string{"DataSource:\n APIGroup: snapshot.storage.k8s.io\n Kind: VolumeSnapshot\n Name: src-snapshot\n"},
}, },
} }