diff --git a/pkg/volume/csi/csi_plugin.go b/pkg/volume/csi/csi_plugin.go index 1732dc7f92..35f20dc691 100644 --- a/pkg/volume/csi/csi_plugin.go +++ b/pkg/volume/csi/csi_plugin.go @@ -705,15 +705,15 @@ func highestSupportedVersion(versions []string) (*utilversion.Version, error) { return nil, fmt.Errorf("None of the CSI versions reported by this driver are supported") } -// Only CSI 0.x drivers are allowed to use deprecated socket dir. +// Only drivers that implement CSI 0.x are allowed to use deprecated socket dir. func isDeprecatedSocketDirAllowed(versions []string) bool { for _, version := range versions { - if !isV0Version(version) { - return false + if isV0Version(version) { + return true } } - return true + return false } func isV0Version(version string) bool { diff --git a/pkg/volume/csi/csi_plugin_test.go b/pkg/volume/csi/csi_plugin_test.go index ff16b3ac13..ab82fde645 100644 --- a/pkg/volume/csi/csi_plugin_test.go +++ b/pkg/volume/csi/csi_plugin_test.go @@ -617,7 +617,7 @@ func TestValidatePlugin(t *testing.T) { endpoint: "/var/log/kubelet/plugins/myplugin/csi.sock", versions: []string{"0.2.0", "v1.0.0"}, foundInDeprecatedDir: true, - shouldFail: true, + shouldFail: false, }, { pluginName: "test.plugin", @@ -631,7 +631,7 @@ func TestValidatePlugin(t *testing.T) { endpoint: "/var/log/kubelet/plugins/myplugin/csi.sock", versions: []string{"0.2.0", "v1.2.3"}, foundInDeprecatedDir: true, - shouldFail: true, + shouldFail: false, }, { pluginName: "test.plugin", @@ -645,7 +645,7 @@ func TestValidatePlugin(t *testing.T) { endpoint: "/var/log/kubelet/plugins/myplugin/csi.sock", versions: []string{"v1.2.3", "v0.3.0"}, foundInDeprecatedDir: true, - shouldFail: true, + shouldFail: false, }, { pluginName: "test.plugin", @@ -659,14 +659,14 @@ func TestValidatePlugin(t *testing.T) { endpoint: "/var/log/kubelet/plugins/myplugin/csi.sock", versions: []string{"v1.2.3", "v0.3.0", "2.0.1"}, foundInDeprecatedDir: true, - shouldFail: true, + shouldFail: false, }, { pluginName: "test.plugin", endpoint: "/var/log/kubelet/plugins/myplugin/csi.sock", versions: []string{"v0.3.0", "2.0.1"}, foundInDeprecatedDir: true, - shouldFail: true, + shouldFail: false, }, { pluginName: "test.plugin", @@ -680,7 +680,7 @@ func TestValidatePlugin(t *testing.T) { endpoint: "/var/log/kubelet/plugins/myplugin/csi.sock", versions: []string{"v1.2.3", "4.9.12", "v0.3.0", "2.0.1"}, foundInDeprecatedDir: true, - shouldFail: true, + shouldFail: false, }, { pluginName: "test.plugin", @@ -694,7 +694,7 @@ func TestValidatePlugin(t *testing.T) { endpoint: "/var/log/kubelet/plugins/myplugin/csi.sock", versions: []string{"v1.2.3", "boo", "v0.3.0", "2.0.1"}, foundInDeprecatedDir: true, - shouldFail: true, + shouldFail: false, }, { pluginName: "test.plugin",