Skip to content

Commit af5d651

Browse files
author
caiweidong
committed
Kubectl: support inline csi volume
1 parent 155688b commit af5d651

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

pkg/kubectl/describe/versioned/describe.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -809,6 +809,8 @@ func describeVolumes(volumes []corev1.Volume, w PrefixWriter, space string) {
809809
printFlockerVolumeSource(volume.VolumeSource.Flocker, w)
810810
case volume.VolumeSource.Projected != nil:
811811
printProjectedVolumeSource(volume.VolumeSource.Projected, w)
812+
case volume.VolumeSource.CSI != nil:
813+
printCSIVolumeSource(volume.VolumeSource.CSI, w)
812814
default:
813815
w.Write(LEVEL_1, "<unknown>\n")
814816
}
@@ -1208,6 +1210,23 @@ func printFlockerVolumeSource(flocker *corev1.FlockerVolumeSource, w PrefixWrite
12081210
flocker.DatasetName, flocker.DatasetUUID)
12091211
}
12101212

1213+
func printCSIVolumeSource(csi *corev1.CSIVolumeSource, w PrefixWriter) {
1214+
var readOnly bool
1215+
var fsType string
1216+
if csi.ReadOnly != nil && *csi.ReadOnly {
1217+
readOnly = true
1218+
}
1219+
if csi.FSType != nil {
1220+
fsType = *csi.FSType
1221+
}
1222+
w.Write(LEVEL_2, "Type:\tCSI (a Container Storage Interface (CSI) volume source)\n"+
1223+
" Driver:\t%v\n"+
1224+
" FSType:\t%v\n"+
1225+
" ReadOnly:\t%v\n",
1226+
csi.Driver, fsType, readOnly)
1227+
printCSIPersistentVolumeAttributesMultiline(w, "VolumeAttributes", csi.VolumeAttributes)
1228+
}
1229+
12111230
func printCSIPersistentVolumeSource(csi *corev1.CSIPersistentVolumeSource, w PrefixWriter) {
12121231
w.Write(LEVEL_2, "Type:\tCSI (a Container Storage Interface (CSI) volume source)\n"+
12131232
" Driver:\t%v\n"+

0 commit comments

Comments
 (0)