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

Unlock CSIMigrationvSphere feature gate #116342

Merged
merged 1 commit into from Mar 8, 2023
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion pkg/features/kube_features.go
Expand Up @@ -896,7 +896,7 @@ var defaultKubernetesFeatureGates = map[featuregate.Feature]featuregate.FeatureS

CSIMigrationRBD: {Default: false, PreRelease: featuregate.Alpha}, // Off by default (requires RBD CSI driver)

CSIMigrationvSphere: {Default: true, PreRelease: featuregate.GA, LockToDefault: true}, // remove in 1.28
CSIMigrationvSphere: {Default: true, PreRelease: featuregate.GA}, // LockToDefault when CSI driver with GA support for Windows, raw block and xfs features are available

CSINodeExpandSecret: {Default: false, PreRelease: featuregate.Alpha},

Expand Down
56 changes: 56 additions & 0 deletions pkg/volume/csimigration/plugin_manager_test.go
Expand Up @@ -112,6 +112,62 @@ func TestIsMigratable(t *testing.T) {
}
}

func TestCheckMigrationFeatureFlags(t *testing.T) {
testCases := []struct {
name string
pluginFeature featuregate.Feature
pluginFeatureEnabled bool
pluginUnregsiterFeature featuregate.Feature
pluginUnregsiterEnabled bool
expectMigrationComplete bool
expectErr bool
}{
{
name: "plugin specific migration feature enabled with plugin unregister disabled",
pluginFeature: features.CSIMigrationvSphere,
pluginFeatureEnabled: true,
pluginUnregsiterFeature: features.InTreePluginvSphereUnregister,
pluginUnregsiterEnabled: false,
expectMigrationComplete: false,
expectErr: false,
},
{
name: "plugin specific migration feature and plugin unregister disabled",
pluginFeature: features.CSIMigrationvSphere,
pluginFeatureEnabled: false,
pluginUnregsiterFeature: features.InTreePluginvSphereUnregister,
pluginUnregsiterEnabled: false,
expectMigrationComplete: false,
expectErr: false,
},
{
name: "all features enabled",
pluginFeature: features.CSIMigrationvSphere,
pluginFeatureEnabled: true,
pluginUnregsiterFeature: features.InTreePluginvSphereUnregister,
pluginUnregsiterEnabled: true,
expectMigrationComplete: true,
expectErr: false,
},
}
for _, test := range testCases {
t.Run(fmt.Sprintf("Testing %v", test.name), func(t *testing.T) {
defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, test.pluginFeature, test.pluginFeatureEnabled)()
defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, test.pluginUnregsiterFeature, test.pluginUnregsiterEnabled)()
migrationComplete, err := CheckMigrationFeatureFlags(utilfeature.DefaultFeatureGate, test.pluginFeature, test.pluginUnregsiterFeature)
if err != nil && test.expectErr == false {
t.Errorf("Unexpected error: %v", err)
}
if err == nil && test.expectErr == true {
t.Errorf("Unexpected validation pass")
}
if migrationComplete != test.expectMigrationComplete {
t.Errorf("Unexpected migrationComplete result. Exp: %v, got %v", test.expectMigrationComplete, migrationComplete)
}
})
}
}

func TestMigrationFeatureFlagStatus(t *testing.T) {
testCases := []struct {
name string
Expand Down