Skip to content

Commit 194114e

Browse files
authored
Merge pull request kubernetes#75513 from cwdsuzhou/fix-incline-csivolume
Kubectl: support inline csi volume
2 parents da7af58 + af5d651 commit 194114e

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
@@ -810,6 +810,8 @@ func describeVolumes(volumes []corev1.Volume, w PrefixWriter, space string) {
810810
printFlockerVolumeSource(volume.VolumeSource.Flocker, w)
811811
case volume.VolumeSource.Projected != nil:
812812
printProjectedVolumeSource(volume.VolumeSource.Projected, w)
813+
case volume.VolumeSource.CSI != nil:
814+
printCSIVolumeSource(volume.VolumeSource.CSI, w)
813815
default:
814816
w.Write(LEVEL_1, "<unknown>\n")
815817
}
@@ -1209,6 +1211,23 @@ func printFlockerVolumeSource(flocker *corev1.FlockerVolumeSource, w PrefixWrite
12091211
flocker.DatasetName, flocker.DatasetUUID)
12101212
}
12111213

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

0 commit comments

Comments
 (0)