mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 03:41:45 +00:00
Merge pull request #80048 from davidz627/fix/tests
Fixes mount/unmount paths for migrated inline volumes
This commit is contained in:
commit
2bf8ab13c4
@ -763,6 +763,12 @@ func (og *operationGenerator) resizeFileSystem(volumeToMount VolumeToMount, rsOp
|
|||||||
return true, nil
|
return true, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if volumeToMount.VolumeSpec != nil &&
|
||||||
|
volumeToMount.VolumeSpec.InlineVolumeSpecForCSIMigration {
|
||||||
|
klog.V(4).Infof("This volume %s is a migrated inline volume and is not resizable", volumeToMount.VolumeName)
|
||||||
|
return true, nil
|
||||||
|
}
|
||||||
|
|
||||||
// Get expander, if possible
|
// Get expander, if possible
|
||||||
expandableVolumePlugin, _ :=
|
expandableVolumePlugin, _ :=
|
||||||
og.volumePluginMgr.FindNodeExpandablePluginBySpec(volumeToMount.VolumeSpec)
|
og.volumePluginMgr.FindNodeExpandablePluginBySpec(volumeToMount.VolumeSpec)
|
||||||
|
@ -16,6 +16,7 @@ go_library(
|
|||||||
deps = [
|
deps = [
|
||||||
"//staging/src/k8s.io/api/core/v1:go_default_library",
|
"//staging/src/k8s.io/api/core/v1:go_default_library",
|
||||||
"//staging/src/k8s.io/api/storage/v1:go_default_library",
|
"//staging/src/k8s.io/api/storage/v1:go_default_library",
|
||||||
|
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
|
||||||
"//staging/src/k8s.io/apimachinery/pkg/util/sets:go_default_library",
|
"//staging/src/k8s.io/apimachinery/pkg/util/sets:go_default_library",
|
||||||
"//staging/src/k8s.io/cloud-provider/volume:go_default_library",
|
"//staging/src/k8s.io/cloud-provider/volume:go_default_library",
|
||||||
],
|
],
|
||||||
|
@ -25,6 +25,7 @@ import (
|
|||||||
|
|
||||||
"k8s.io/api/core/v1"
|
"k8s.io/api/core/v1"
|
||||||
storage "k8s.io/api/storage/v1"
|
storage "k8s.io/api/storage/v1"
|
||||||
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@ -57,6 +58,10 @@ func (t *awsElasticBlockStoreCSITranslator) TranslateInTreeInlineVolumeToCSI(vol
|
|||||||
}
|
}
|
||||||
ebsSource := volume.AWSElasticBlockStore
|
ebsSource := volume.AWSElasticBlockStore
|
||||||
pv := &v1.PersistentVolume{
|
pv := &v1.PersistentVolume{
|
||||||
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
|
// A.K.A InnerVolumeSpecName required to match for Unmount
|
||||||
|
Name: volume.Name,
|
||||||
|
},
|
||||||
Spec: v1.PersistentVolumeSpec{
|
Spec: v1.PersistentVolumeSpec{
|
||||||
PersistentVolumeSource: v1.PersistentVolumeSource{
|
PersistentVolumeSource: v1.PersistentVolumeSource{
|
||||||
CSI: &v1.CSIPersistentVolumeSource{
|
CSI: &v1.CSIPersistentVolumeSource{
|
||||||
|
@ -23,6 +23,7 @@ import (
|
|||||||
|
|
||||||
"k8s.io/api/core/v1"
|
"k8s.io/api/core/v1"
|
||||||
storage "k8s.io/api/storage/v1"
|
storage "k8s.io/api/storage/v1"
|
||||||
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@ -67,6 +68,10 @@ func (t *azureDiskCSITranslator) TranslateInTreeInlineVolumeToCSI(volume *v1.Vol
|
|||||||
|
|
||||||
azureSource := volume.AzureDisk
|
azureSource := volume.AzureDisk
|
||||||
pv := &v1.PersistentVolume{
|
pv := &v1.PersistentVolume{
|
||||||
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
|
// A.K.A InnerVolumeSpecName required to match for Unmount
|
||||||
|
Name: volume.Name,
|
||||||
|
},
|
||||||
Spec: v1.PersistentVolumeSpec{
|
Spec: v1.PersistentVolumeSpec{
|
||||||
PersistentVolumeSource: v1.PersistentVolumeSource{
|
PersistentVolumeSource: v1.PersistentVolumeSource{
|
||||||
CSI: &v1.CSIPersistentVolumeSource{
|
CSI: &v1.CSIPersistentVolumeSource{
|
||||||
|
@ -22,6 +22,7 @@ import (
|
|||||||
|
|
||||||
"k8s.io/api/core/v1"
|
"k8s.io/api/core/v1"
|
||||||
storage "k8s.io/api/storage/v1"
|
storage "k8s.io/api/storage/v1"
|
||||||
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@ -63,6 +64,10 @@ func (t *azureFileCSITranslator) TranslateInTreeInlineVolumeToCSI(volume *v1.Vol
|
|||||||
azureSource := volume.AzureFile
|
azureSource := volume.AzureFile
|
||||||
|
|
||||||
pv := &v1.PersistentVolume{
|
pv := &v1.PersistentVolume{
|
||||||
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
|
// A.K.A InnerVolumeSpecName required to match for Unmount
|
||||||
|
Name: volume.Name,
|
||||||
|
},
|
||||||
Spec: v1.PersistentVolumeSpec{
|
Spec: v1.PersistentVolumeSpec{
|
||||||
PersistentVolumeSource: v1.PersistentVolumeSource{
|
PersistentVolumeSource: v1.PersistentVolumeSource{
|
||||||
CSI: &v1.CSIPersistentVolumeSource{
|
CSI: &v1.CSIPersistentVolumeSource{
|
||||||
|
@ -23,6 +23,7 @@ import (
|
|||||||
|
|
||||||
"k8s.io/api/core/v1"
|
"k8s.io/api/core/v1"
|
||||||
storage "k8s.io/api/storage/v1"
|
storage "k8s.io/api/storage/v1"
|
||||||
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
"k8s.io/apimachinery/pkg/util/sets"
|
"k8s.io/apimachinery/pkg/util/sets"
|
||||||
cloudvolume "k8s.io/cloud-provider/volume"
|
cloudvolume "k8s.io/cloud-provider/volume"
|
||||||
)
|
)
|
||||||
@ -197,6 +198,10 @@ func (g *gcePersistentDiskCSITranslator) TranslateInTreeInlineVolumeToCSI(volume
|
|||||||
}
|
}
|
||||||
|
|
||||||
pv := &v1.PersistentVolume{
|
pv := &v1.PersistentVolume{
|
||||||
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
|
// A.K.A InnerVolumeSpecName required to match for Unmount
|
||||||
|
Name: volume.Name,
|
||||||
|
},
|
||||||
Spec: v1.PersistentVolumeSpec{
|
Spec: v1.PersistentVolumeSpec{
|
||||||
PersistentVolumeSource: v1.PersistentVolumeSource{
|
PersistentVolumeSource: v1.PersistentVolumeSource{
|
||||||
CSI: &v1.CSIPersistentVolumeSource{
|
CSI: &v1.CSIPersistentVolumeSource{
|
||||||
|
@ -21,6 +21,7 @@ import (
|
|||||||
|
|
||||||
"k8s.io/api/core/v1"
|
"k8s.io/api/core/v1"
|
||||||
storage "k8s.io/api/storage/v1"
|
storage "k8s.io/api/storage/v1"
|
||||||
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@ -54,6 +55,10 @@ func (t *osCinderCSITranslator) TranslateInTreeInlineVolumeToCSI(volume *v1.Volu
|
|||||||
|
|
||||||
cinderSource := volume.Cinder
|
cinderSource := volume.Cinder
|
||||||
pv := &v1.PersistentVolume{
|
pv := &v1.PersistentVolume{
|
||||||
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
|
// A.K.A InnerVolumeSpecName required to match for Unmount
|
||||||
|
Name: volume.Name,
|
||||||
|
},
|
||||||
Spec: v1.PersistentVolumeSpec{
|
Spec: v1.PersistentVolumeSpec{
|
||||||
PersistentVolumeSource: v1.PersistentVolumeSource{
|
PersistentVolumeSource: v1.PersistentVolumeSource{
|
||||||
CSI: &v1.CSIPersistentVolumeSource{
|
CSI: &v1.CSIPersistentVolumeSource{
|
||||||
|
@ -125,8 +125,12 @@ func GetInTreePluginNameFromSpec(pv *v1.PersistentVolume, vol *v1.Volume) (strin
|
|||||||
}
|
}
|
||||||
return "", fmt.Errorf("could not find in-tree plugin name from persistent volume %v", pv)
|
return "", fmt.Errorf("could not find in-tree plugin name from persistent volume %v", pv)
|
||||||
} else if vol != nil {
|
} else if vol != nil {
|
||||||
// TODO(dyzz): Implement inline volume migration support
|
for _, curPlugin := range inTreePlugins {
|
||||||
return "", errors.New("inline volume migration not yet supported")
|
if curPlugin.CanSupportInline(vol) {
|
||||||
|
return curPlugin.GetInTreePluginName(), nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return "", fmt.Errorf("could not find in-tree plugin name from volume %v", vol)
|
||||||
} else {
|
} else {
|
||||||
return "", errors.New("both persistent volume and volume are nil")
|
return "", errors.New("both persistent volume and volume are nil")
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user