add apigroup to the data source when using kubectl describe pvc

Kubernetes-commit: 9157df47e8db6e10edcd398294e6a4c04b3572e9
This commit is contained in:
caiweidong 2019-09-08 15:03:26 +08:00 committed by Kubernetes Publisher
parent 2f2d0f1daa
commit 521a90f087
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 {
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, "Name:\t%v\n", pvc.Spec.DataSource.Name)
}
printPodsMultiline(w, "Mounted By", mountPods)

View File

@ -1595,7 +1595,7 @@ func TestPersistentVolumeClaimDescriber(t *testing.T) {
},
Status: corev1.PersistentVolumeClaimStatus{},
},
expectedElements: []string{"\nDataSource:\n Name: srcpvc\n Kind: PersistentVolumeClaim"},
expectedElements: []string{"\nDataSource:\n Kind: PersistentVolumeClaim\n Name: srcpvc"},
},
{
name: "snapshot-datasource",
@ -1615,7 +1615,7 @@ func TestPersistentVolumeClaimDescriber(t *testing.T) {
},
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"},
},
}