mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-25 04:33:26 +00:00
Next step in CSI migration for openstack
delete/modify tests that use intree cinder as well. Signed-off-by: Davanum Srinivas <davanum@gmail.com>
This commit is contained in:
parent
a0dfd958d5
commit
7fd97433f0
@ -869,7 +869,7 @@ var defaultKubernetesFeatureGates = map[featuregate.Feature]featuregate.FeatureS
|
|||||||
InTreePluginAzureFileUnregister: {Default: false, PreRelease: featuregate.Alpha},
|
InTreePluginAzureFileUnregister: {Default: false, PreRelease: featuregate.Alpha},
|
||||||
CSIMigrationvSphere: {Default: false, PreRelease: featuregate.Beta}, // Off by default (requires vSphere CSI driver)
|
CSIMigrationvSphere: {Default: false, PreRelease: featuregate.Beta}, // Off by default (requires vSphere CSI driver)
|
||||||
InTreePluginvSphereUnregister: {Default: false, PreRelease: featuregate.Alpha},
|
InTreePluginvSphereUnregister: {Default: false, PreRelease: featuregate.Alpha},
|
||||||
CSIMigrationOpenStack: {Default: true, PreRelease: featuregate.Beta},
|
CSIMigrationOpenStack: {Default: true, PreRelease: featuregate.GA, LockToDefault: true}, // remove in 1.26
|
||||||
InTreePluginOpenStackUnregister: {Default: false, PreRelease: featuregate.Alpha},
|
InTreePluginOpenStackUnregister: {Default: false, PreRelease: featuregate.Alpha},
|
||||||
CSIMigrationRBD: {Default: false, PreRelease: featuregate.Alpha}, // Off by default (requires RBD CSI driver)
|
CSIMigrationRBD: {Default: false, PreRelease: featuregate.Alpha}, // Off by default (requires RBD CSI driver)
|
||||||
InTreePluginRBDUnregister: {Default: false, PreRelease: featuregate.Alpha},
|
InTreePluginRBDUnregister: {Default: false, PreRelease: featuregate.Alpha},
|
||||||
|
@ -35,8 +35,8 @@ import (
|
|||||||
func TestEphemeralLimits(t *testing.T) {
|
func TestEphemeralLimits(t *testing.T) {
|
||||||
// We have to specify a valid filter and arbitrarily pick Cinder here.
|
// We have to specify a valid filter and arbitrarily pick Cinder here.
|
||||||
// It doesn't matter for the test cases.
|
// It doesn't matter for the test cases.
|
||||||
filterName := cinderVolumeFilterType
|
filterName := gcePDVolumeFilterType
|
||||||
driverName := csilibplugins.CinderInTreePluginName
|
driverName := csilibplugins.GCEPDInTreePluginName
|
||||||
|
|
||||||
ephemeralVolumePod := &v1.Pod{
|
ephemeralVolumePod := &v1.Pod{
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
@ -467,72 +467,6 @@ func TestAzureDiskLimits(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestCinderLimits(t *testing.T) {
|
|
||||||
twoVolCinderPod := &v1.Pod{
|
|
||||||
Spec: v1.PodSpec{
|
|
||||||
Volumes: []v1.Volume{
|
|
||||||
{
|
|
||||||
VolumeSource: v1.VolumeSource{
|
|
||||||
Cinder: &v1.CinderVolumeSource{VolumeID: "tvp1"},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
VolumeSource: v1.VolumeSource{
|
|
||||||
Cinder: &v1.CinderVolumeSource{VolumeID: "tvp2"},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
oneVolCinderPod := &v1.Pod{
|
|
||||||
Spec: v1.PodSpec{
|
|
||||||
Volumes: []v1.Volume{
|
|
||||||
{
|
|
||||||
VolumeSource: v1.VolumeSource{
|
|
||||||
Cinder: &v1.CinderVolumeSource{VolumeID: "ovp"},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
tests := []struct {
|
|
||||||
newPod *v1.Pod
|
|
||||||
existingPods []*v1.Pod
|
|
||||||
filterName string
|
|
||||||
driverName string
|
|
||||||
maxVols int
|
|
||||||
test string
|
|
||||||
wantStatus *framework.Status
|
|
||||||
}{
|
|
||||||
{
|
|
||||||
newPod: oneVolCinderPod,
|
|
||||||
existingPods: []*v1.Pod{twoVolCinderPod},
|
|
||||||
filterName: cinderVolumeFilterType,
|
|
||||||
maxVols: 4,
|
|
||||||
test: "fits when node capacity >= new pod's Cinder volumes",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
newPod: oneVolCinderPod,
|
|
||||||
existingPods: []*v1.Pod{twoVolCinderPod},
|
|
||||||
filterName: cinderVolumeFilterType,
|
|
||||||
maxVols: 2,
|
|
||||||
test: "not fit when node capacity < new pod's Cinder volumes",
|
|
||||||
wantStatus: framework.NewStatus(framework.Unschedulable, ErrReasonMaxVolumeCountExceeded),
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, test := range tests {
|
|
||||||
t.Run(test.test, func(t *testing.T) {
|
|
||||||
node, csiNode := getNodeWithPodAndVolumeLimits("node", test.existingPods, int64(test.maxVols), test.filterName)
|
|
||||||
p := newNonCSILimits(test.filterName, getFakeCSINodeLister(csiNode), getFakeCSIStorageClassLister(test.filterName, test.driverName), getFakePVLister(test.filterName), getFakePVCLister(test.filterName), feature.Features{}).(framework.FilterPlugin)
|
|
||||||
gotStatus := p.Filter(context.Background(), nil, test.newPod, node)
|
|
||||||
if !reflect.DeepEqual(gotStatus, test.wantStatus) {
|
|
||||||
t.Errorf("status does not match: %v, want: %v", gotStatus, test.wantStatus)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
func TestEBSLimits(t *testing.T) {
|
func TestEBSLimits(t *testing.T) {
|
||||||
oneVolPod := &v1.Pod{
|
oneVolPod := &v1.Pod{
|
||||||
Spec: v1.PodSpec{
|
Spec: v1.PodSpec{
|
||||||
|
@ -60,9 +60,7 @@ func isCSIMigrationOn(csiNode *storagev1.CSINode, pluginName string) bool {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
case csilibplugins.CinderInTreePluginName:
|
case csilibplugins.CinderInTreePluginName:
|
||||||
if !utilfeature.DefaultFeatureGate.Enabled(features.CSIMigrationOpenStack) {
|
return true
|
||||||
return false
|
|
||||||
}
|
|
||||||
case csilibplugins.RBDVolumePluginName:
|
case csilibplugins.RBDVolumePluginName:
|
||||||
if !utilfeature.DefaultFeatureGate.Enabled(features.CSIMigrationRBD) {
|
if !utilfeature.DefaultFeatureGate.Enabled(features.CSIMigrationRBD) {
|
||||||
return false
|
return false
|
||||||
|
@ -1024,7 +1024,7 @@ func isCSIMigrationOnForPlugin(pluginName string) bool {
|
|||||||
case csiplugins.AzureDiskInTreePluginName:
|
case csiplugins.AzureDiskInTreePluginName:
|
||||||
return utilfeature.DefaultFeatureGate.Enabled(features.CSIMigrationAzureDisk)
|
return utilfeature.DefaultFeatureGate.Enabled(features.CSIMigrationAzureDisk)
|
||||||
case csiplugins.CinderInTreePluginName:
|
case csiplugins.CinderInTreePluginName:
|
||||||
return utilfeature.DefaultFeatureGate.Enabled(features.CSIMigrationOpenStack)
|
return true
|
||||||
case csiplugins.PortworxVolumePluginName:
|
case csiplugins.PortworxVolumePluginName:
|
||||||
return utilfeature.DefaultFeatureGate.Enabled(features.CSIMigrationPortworx)
|
return utilfeature.DefaultFeatureGate.Enabled(features.CSIMigrationPortworx)
|
||||||
case csiplugins.RBDVolumePluginName:
|
case csiplugins.RBDVolumePluginName:
|
||||||
|
@ -223,7 +223,7 @@ func (p *csiPlugin) Init(host volume.VolumeHost) error {
|
|||||||
return utilfeature.DefaultFeatureGate.Enabled(features.CSIMigration) && utilfeature.DefaultFeatureGate.Enabled(features.CSIMigrationAWS)
|
return utilfeature.DefaultFeatureGate.Enabled(features.CSIMigration) && utilfeature.DefaultFeatureGate.Enabled(features.CSIMigrationAWS)
|
||||||
},
|
},
|
||||||
csitranslationplugins.CinderInTreePluginName: func() bool {
|
csitranslationplugins.CinderInTreePluginName: func() bool {
|
||||||
return utilfeature.DefaultFeatureGate.Enabled(features.CSIMigration) && utilfeature.DefaultFeatureGate.Enabled(features.CSIMigrationOpenStack)
|
return utilfeature.DefaultFeatureGate.Enabled(features.CSIMigration)
|
||||||
},
|
},
|
||||||
csitranslationplugins.AzureDiskInTreePluginName: func() bool {
|
csitranslationplugins.AzureDiskInTreePluginName: func() bool {
|
||||||
return utilfeature.DefaultFeatureGate.Enabled(features.CSIMigration) && utilfeature.DefaultFeatureGate.Enabled(features.CSIMigrationAzureDisk)
|
return utilfeature.DefaultFeatureGate.Enabled(features.CSIMigration) && utilfeature.DefaultFeatureGate.Enabled(features.CSIMigrationAzureDisk)
|
||||||
|
@ -99,7 +99,7 @@ func (pm PluginManager) IsMigrationEnabledForPlugin(pluginName string) bool {
|
|||||||
case csilibplugins.AzureDiskInTreePluginName:
|
case csilibplugins.AzureDiskInTreePluginName:
|
||||||
return pm.featureGate.Enabled(features.CSIMigrationAzureDisk)
|
return pm.featureGate.Enabled(features.CSIMigrationAzureDisk)
|
||||||
case csilibplugins.CinderInTreePluginName:
|
case csilibplugins.CinderInTreePluginName:
|
||||||
return pm.featureGate.Enabled(features.CSIMigrationOpenStack)
|
return true
|
||||||
case csilibplugins.VSphereInTreePluginName:
|
case csilibplugins.VSphereInTreePluginName:
|
||||||
return pm.featureGate.Enabled(features.CSIMigrationvSphere)
|
return pm.featureGate.Enabled(features.CSIMigrationvSphere)
|
||||||
case csilibplugins.PortworxVolumePluginName:
|
case csilibplugins.PortworxVolumePluginName:
|
||||||
|
Loading…
Reference in New Issue
Block a user