Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kubectl: support inline csi volume #75513

Merged
merged 1 commit into from Mar 28, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
19 changes: 19 additions & 0 deletions pkg/kubectl/describe/versioned/describe.go
Expand Up @@ -809,6 +809,8 @@ func describeVolumes(volumes []corev1.Volume, w PrefixWriter, space string) {
printFlockerVolumeSource(volume.VolumeSource.Flocker, w)
case volume.VolumeSource.Projected != nil:
printProjectedVolumeSource(volume.VolumeSource.Projected, w)
case volume.VolumeSource.CSI != nil:
printCSIVolumeSource(volume.VolumeSource.CSI, w)
default:
w.Write(LEVEL_1, "<unknown>\n")
}
Expand Down Expand Up @@ -1208,6 +1210,23 @@ func printFlockerVolumeSource(flocker *corev1.FlockerVolumeSource, w PrefixWrite
flocker.DatasetName, flocker.DatasetUUID)
}

func printCSIVolumeSource(csi *corev1.CSIVolumeSource, w PrefixWriter) {
var readOnly bool
var fsType string
if csi.ReadOnly != nil && *csi.ReadOnly {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Next time do:

readOnly := csi.ReadOnly != nil && *csi.ReadOnly

less typing 😉

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

readOnly = true
}
if csi.FSType != nil {
fsType = *csi.FSType
}
w.Write(LEVEL_2, "Type:\tCSI (a Container Storage Interface (CSI) volume source)\n"+
" Driver:\t%v\n"+
" FSType:\t%v\n"+
" ReadOnly:\t%v\n",
csi.Driver, fsType, readOnly)
printCSIPersistentVolumeAttributesMultiline(w, "VolumeAttributes", csi.VolumeAttributes)
}

func printCSIPersistentVolumeSource(csi *corev1.CSIPersistentVolumeSource, w PrefixWriter) {
w.Write(LEVEL_2, "Type:\tCSI (a Container Storage Interface (CSI) volume source)\n"+
" Driver:\t%v\n"+
Expand Down