mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-04 04:08:16 +00:00 
			
		
		
		
	Merge pull request #31703 from rootfs/cinder-describe
Automatic merge from submit-queue
print Cinder volume source in kubectl describe
with the patch, `kubectl describe` output is
```console
# kubectl describe pv
Name:		pvc-34069100-6ec5-11e6-97f3-fa163e39e62e
Labels:		<none>
Status:		Bound
Claim:		default/claim1
Reclaim Policy:	Delete
Access Modes:	RWO
Capacity:	3Gi
Message:	
Source:
    Type:	Cinder (a Persistent Disk resource in OpenStack)
    VolumeID:	a1bc727a-d1e6-4d6b-92d6-3e5e22bde3fa
    FSType:	ext4
    ReadOnly:	false
No events.
```
@kubernetes/sig-storage
			
			
This commit is contained in:
		@@ -614,6 +614,8 @@ func describeVolumes(volumes []api.Volume, out io.Writer, space string) {
 | 
			
		||||
			printAzureDiskVolumeSource(volume.VolumeSource.AzureDisk, out)
 | 
			
		||||
		case volume.VolumeSource.VsphereVolume != nil:
 | 
			
		||||
			printVsphereVolumeSource(volume.VolumeSource.VsphereVolume, out)
 | 
			
		||||
		case volume.VolumeSource.Cinder != nil:
 | 
			
		||||
			printCinderVolumeSource(volume.VolumeSource.Cinder, out)
 | 
			
		||||
		default:
 | 
			
		||||
			fmt.Fprintf(out, "  <unknown>\n")
 | 
			
		||||
		}
 | 
			
		||||
@@ -748,6 +750,13 @@ func printVsphereVolumeSource(vsphere *api.VsphereVirtualDiskVolumeSource, out i
 | 
			
		||||
		"    FSType:\t%v\n",
 | 
			
		||||
		vsphere.VolumePath, vsphere.FSType)
 | 
			
		||||
}
 | 
			
		||||
func printCinderVolumeSource(cinder *api.CinderVolumeSource, out io.Writer) {
 | 
			
		||||
	fmt.Fprintf(out, "    Type:\tCinder (a Persistent Disk resource in OpenStack)\n"+
 | 
			
		||||
		"    VolumeID:\t%v\n"+
 | 
			
		||||
		"    FSType:\t%v\n"+
 | 
			
		||||
		"    ReadOnly:\t%v\n",
 | 
			
		||||
		cinder.VolumeID, cinder.FSType, cinder.ReadOnly)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type PersistentVolumeDescriber struct {
 | 
			
		||||
	client.Interface
 | 
			
		||||
@@ -802,6 +811,8 @@ func (d *PersistentVolumeDescriber) Describe(namespace, name string, describerSe
 | 
			
		||||
			printQuobyteVolumeSource(pv.Spec.Quobyte, out)
 | 
			
		||||
		case pv.Spec.VsphereVolume != nil:
 | 
			
		||||
			printVsphereVolumeSource(pv.Spec.VsphereVolume, out)
 | 
			
		||||
		case pv.Spec.Cinder != nil:
 | 
			
		||||
			printCinderVolumeSource(pv.Spec.Cinder, out)
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		if events != nil {
 | 
			
		||||
 
 | 
			
		||||
@@ -538,6 +538,13 @@ func TestPersistentVolumeDescriber(t *testing.T) {
 | 
			
		||||
				},
 | 
			
		||||
			},
 | 
			
		||||
		},
 | 
			
		||||
		"cinder": {
 | 
			
		||||
			Spec: api.PersistentVolumeSpec{
 | 
			
		||||
				PersistentVolumeSource: api.PersistentVolumeSource{
 | 
			
		||||
					Cinder: &api.CinderVolumeSource{},
 | 
			
		||||
				},
 | 
			
		||||
			},
 | 
			
		||||
		},
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	for name, pv := range tests {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user