Merge pull request #113826 from jsafrane/add-openstack

Add CSI migration of OpenStack Cinder volumes

Kubernetes-commit: e4d46148de9d83c23001323d6613618c2897a427
This commit is contained in:
Kubernetes Publisher 2022-11-11 11:00:07 -08:00
commit 81cffe129f
4 changed files with 43 additions and 8 deletions

8
go.mod
View File

@ -30,10 +30,10 @@ require (
github.com/stretchr/testify v1.8.0
golang.org/x/sys v0.1.0
gopkg.in/yaml.v2 v2.4.0
k8s.io/api v0.0.0-20221110160654-5cb32024090c
k8s.io/api v0.0.0-20221111134724-3590edaeeded
k8s.io/apimachinery v0.0.0-20221108055230-fd8a60496be5
k8s.io/cli-runtime v0.0.0-20221108072842-e556445586e6
k8s.io/client-go v0.0.0-20221110173930-acc9fa7e0410
k8s.io/client-go v0.0.0-20221111215036-61cd728579d3
k8s.io/component-base v0.0.0-20221109173154-b1c4f12ee8c1
k8s.io/component-helpers v0.0.0-20221108061658-aa222c251f8e
k8s.io/klog/v2 v2.80.1
@ -91,10 +91,10 @@ require (
)
replace (
k8s.io/api => k8s.io/api v0.0.0-20221110160654-5cb32024090c
k8s.io/api => k8s.io/api v0.0.0-20221111134724-3590edaeeded
k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20221108055230-fd8a60496be5
k8s.io/cli-runtime => k8s.io/cli-runtime v0.0.0-20221108072842-e556445586e6
k8s.io/client-go => k8s.io/client-go v0.0.0-20221110173930-acc9fa7e0410
k8s.io/client-go => k8s.io/client-go v0.0.0-20221111215036-61cd728579d3
k8s.io/code-generator => k8s.io/code-generator v0.0.0-20221108000200-7429fbb99432
k8s.io/component-base => k8s.io/component-base v0.0.0-20221109173154-b1c4f12ee8c1
k8s.io/component-helpers => k8s.io/component-helpers v0.0.0-20221108061658-aa222c251f8e

8
go.sum
View File

@ -540,14 +540,14 @@ honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWh
honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
k8s.io/api v0.0.0-20221110160654-5cb32024090c h1:8RFXHWLP8uF3qGxQMrnqaekwCbghJGoheMDvc9Q5WaI=
k8s.io/api v0.0.0-20221110160654-5cb32024090c/go.mod h1:j2jT1HZpNN4eUpl6xrwjWC1amreYNCdsevVdZMhBz5o=
k8s.io/api v0.0.0-20221111134724-3590edaeeded h1:zEajzE/qy2hPxVOHvnoEA1Llrfap/TN//rm7MsLzVxA=
k8s.io/api v0.0.0-20221111134724-3590edaeeded/go.mod h1:j2jT1HZpNN4eUpl6xrwjWC1amreYNCdsevVdZMhBz5o=
k8s.io/apimachinery v0.0.0-20221108055230-fd8a60496be5 h1:iFAMJ1evvrO6X7dS7EKujS6An+bp3u/dD6opu8rn0QA=
k8s.io/apimachinery v0.0.0-20221108055230-fd8a60496be5/go.mod h1:VXMmlsE7YRJ5vyAyWpkKIfFkEbDNpVs0ObpkuQf1WfM=
k8s.io/cli-runtime v0.0.0-20221108072842-e556445586e6 h1:O5RHkYLsqflfhvXClaKFHb4Gp8++bIIY+lYJG/Q5ZhU=
k8s.io/cli-runtime v0.0.0-20221108072842-e556445586e6/go.mod h1:+qJo1vrpfIpPsTFvZ5thfxazTEZCRmSPdhC0bxQ51/w=
k8s.io/client-go v0.0.0-20221110173930-acc9fa7e0410 h1:U1wgexRFs0wDZ+hxNz3+bnZqnW2qCWEHT+VDiJCXSkU=
k8s.io/client-go v0.0.0-20221110173930-acc9fa7e0410/go.mod h1:5Vta1v9EJNudP8My5K1AgIdnPZK+X2cL5lCN/j8v1+g=
k8s.io/client-go v0.0.0-20221111215036-61cd728579d3 h1:sdv5LXwMrLTx/fCpBOuSNCzTQH/iTyCJX8OvbfVeB2M=
k8s.io/client-go v0.0.0-20221111215036-61cd728579d3/go.mod h1:8KENq1nSKXFO1f9JEjrFEWWR/Xkx07EOpM5zL6cgwUU=
k8s.io/component-base v0.0.0-20221109173154-b1c4f12ee8c1 h1:vjdfgd9Hbr1VK51BvWeJ+yROWpG8qmZoSxPLfXT3kb4=
k8s.io/component-base v0.0.0-20221109173154-b1c4f12ee8c1/go.mod h1:oRFqoMOgBXibbGLaG4RKRCG1LGU2nzgfEPrlYDIdx4I=
k8s.io/component-helpers v0.0.0-20221108061658-aa222c251f8e h1:v2TulZDdzLZe3sB78qO1wn3l+7UTM6lpofZf4u8cmms=

View File

@ -950,6 +950,8 @@ func describeVolumes(volumes []corev1.Volume, w PrefixWriter, space string) {
printAzureDiskVolumeSource(volume.VolumeSource.AzureDisk, w)
case volume.VolumeSource.VsphereVolume != nil:
printVsphereVolumeSource(volume.VolumeSource.VsphereVolume, w)
case volume.VolumeSource.Cinder != nil:
printCinderVolumeSource(volume.VolumeSource.Cinder, w)
case volume.VolumeSource.PhotonPersistentDisk != nil:
printPhotonPersistentDiskVolumeSource(volume.VolumeSource.PhotonPersistentDisk, w)
case volume.VolumeSource.PortworxVolume != nil:
@ -1228,6 +1230,24 @@ func printPhotonPersistentDiskVolumeSource(photon *corev1.PhotonPersistentDiskVo
photon.PdID, photon.FSType)
}
func printCinderVolumeSource(cinder *corev1.CinderVolumeSource, w PrefixWriter) {
w.Write(LEVEL_2, "Type:\tCinder (a Persistent Disk resource in OpenStack)\n"+
" VolumeID:\t%v\n"+
" FSType:\t%v\n"+
" ReadOnly:\t%v\n"+
" SecretRef:\t%v\n",
cinder.VolumeID, cinder.FSType, cinder.ReadOnly, cinder.SecretRef)
}
func printCinderPersistentVolumeSource(cinder *corev1.CinderPersistentVolumeSource, w PrefixWriter) {
w.Write(LEVEL_2, "Type:\tCinder (a Persistent Disk resource in OpenStack)\n"+
" VolumeID:\t%v\n"+
" FSType:\t%v\n"+
" ReadOnly:\t%v\n"+
" SecretRef:\t%v\n",
cinder.VolumeID, cinder.FSType, cinder.ReadOnly, cinder.SecretRef)
}
func printScaleIOVolumeSource(sio *corev1.ScaleIOVolumeSource, w PrefixWriter) {
w.Write(LEVEL_2, "Type:\tScaleIO (a persistent volume backed by a block device in ScaleIO)\n"+
" Gateway:\t%v\n"+
@ -1545,6 +1565,8 @@ func describePersistentVolume(pv *corev1.PersistentVolume, events *corev1.EventL
printQuobyteVolumeSource(pv.Spec.Quobyte, w)
case pv.Spec.VsphereVolume != nil:
printVsphereVolumeSource(pv.Spec.VsphereVolume, w)
case pv.Spec.Cinder != nil:
printCinderPersistentVolumeSource(pv.Spec.Cinder, w)
case pv.Spec.AzureDisk != nil:
printAzureDiskVolumeSource(pv.Spec.AzureDisk, w)
case pv.Spec.PhotonPersistentDisk != nil:

View File

@ -1483,6 +1483,19 @@ func TestPersistentVolumeDescriber(t *testing.T) {
},
unexpectedElements: []string{"VolumeMode", "Filesystem"},
},
{
name: "test8",
plugin: "cinder",
pv: &corev1.PersistentVolume{
ObjectMeta: metav1.ObjectMeta{Name: "bar"},
Spec: corev1.PersistentVolumeSpec{
PersistentVolumeSource: corev1.PersistentVolumeSource{
Cinder: &corev1.CinderPersistentVolumeSource{},
},
},
},
unexpectedElements: []string{"VolumeMode", "Filesystem"},
},
{
name: "test9",
plugin: "fc",