Unverified Commit 6e5176b4 authored by k8s-ci-robot's avatar k8s-ci-robot Committed by GitHub

Merge pull request #71520 from saad-ali/allow0310Both

Allow CSI Drivers suporting 0.x/1.x to use old dir
parents 3d68f44d 18050e30
...@@ -705,15 +705,15 @@ func highestSupportedVersion(versions []string) (*utilversion.Version, error) { ...@@ -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") 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 { func isDeprecatedSocketDirAllowed(versions []string) bool {
for _, version := range versions { for _, version := range versions {
if !isV0Version(version) { if isV0Version(version) {
return false return true
} }
} }
return true return false
} }
func isV0Version(version string) bool { func isV0Version(version string) bool {
......
...@@ -617,7 +617,7 @@ func TestValidatePlugin(t *testing.T) { ...@@ -617,7 +617,7 @@ func TestValidatePlugin(t *testing.T) {
endpoint: "/var/log/kubelet/plugins/myplugin/csi.sock", endpoint: "/var/log/kubelet/plugins/myplugin/csi.sock",
versions: []string{"0.2.0", "v1.0.0"}, versions: []string{"0.2.0", "v1.0.0"},
foundInDeprecatedDir: true, foundInDeprecatedDir: true,
shouldFail: true, shouldFail: false,
}, },
{ {
pluginName: "test.plugin", pluginName: "test.plugin",
...@@ -631,7 +631,7 @@ func TestValidatePlugin(t *testing.T) { ...@@ -631,7 +631,7 @@ func TestValidatePlugin(t *testing.T) {
endpoint: "/var/log/kubelet/plugins/myplugin/csi.sock", endpoint: "/var/log/kubelet/plugins/myplugin/csi.sock",
versions: []string{"0.2.0", "v1.2.3"}, versions: []string{"0.2.0", "v1.2.3"},
foundInDeprecatedDir: true, foundInDeprecatedDir: true,
shouldFail: true, shouldFail: false,
}, },
{ {
pluginName: "test.plugin", pluginName: "test.plugin",
...@@ -645,7 +645,7 @@ func TestValidatePlugin(t *testing.T) { ...@@ -645,7 +645,7 @@ func TestValidatePlugin(t *testing.T) {
endpoint: "/var/log/kubelet/plugins/myplugin/csi.sock", endpoint: "/var/log/kubelet/plugins/myplugin/csi.sock",
versions: []string{"v1.2.3", "v0.3.0"}, versions: []string{"v1.2.3", "v0.3.0"},
foundInDeprecatedDir: true, foundInDeprecatedDir: true,
shouldFail: true, shouldFail: false,
}, },
{ {
pluginName: "test.plugin", pluginName: "test.plugin",
...@@ -659,14 +659,14 @@ func TestValidatePlugin(t *testing.T) { ...@@ -659,14 +659,14 @@ func TestValidatePlugin(t *testing.T) {
endpoint: "/var/log/kubelet/plugins/myplugin/csi.sock", endpoint: "/var/log/kubelet/plugins/myplugin/csi.sock",
versions: []string{"v1.2.3", "v0.3.0", "2.0.1"}, versions: []string{"v1.2.3", "v0.3.0", "2.0.1"},
foundInDeprecatedDir: true, foundInDeprecatedDir: true,
shouldFail: true, shouldFail: false,
}, },
{ {
pluginName: "test.plugin", pluginName: "test.plugin",
endpoint: "/var/log/kubelet/plugins/myplugin/csi.sock", endpoint: "/var/log/kubelet/plugins/myplugin/csi.sock",
versions: []string{"v0.3.0", "2.0.1"}, versions: []string{"v0.3.0", "2.0.1"},
foundInDeprecatedDir: true, foundInDeprecatedDir: true,
shouldFail: true, shouldFail: false,
}, },
{ {
pluginName: "test.plugin", pluginName: "test.plugin",
...@@ -680,7 +680,7 @@ func TestValidatePlugin(t *testing.T) { ...@@ -680,7 +680,7 @@ func TestValidatePlugin(t *testing.T) {
endpoint: "/var/log/kubelet/plugins/myplugin/csi.sock", endpoint: "/var/log/kubelet/plugins/myplugin/csi.sock",
versions: []string{"v1.2.3", "4.9.12", "v0.3.0", "2.0.1"}, versions: []string{"v1.2.3", "4.9.12", "v0.3.0", "2.0.1"},
foundInDeprecatedDir: true, foundInDeprecatedDir: true,
shouldFail: true, shouldFail: false,
}, },
{ {
pluginName: "test.plugin", pluginName: "test.plugin",
...@@ -694,7 +694,7 @@ func TestValidatePlugin(t *testing.T) { ...@@ -694,7 +694,7 @@ func TestValidatePlugin(t *testing.T) {
endpoint: "/var/log/kubelet/plugins/myplugin/csi.sock", endpoint: "/var/log/kubelet/plugins/myplugin/csi.sock",
versions: []string{"v1.2.3", "boo", "v0.3.0", "2.0.1"}, versions: []string{"v1.2.3", "boo", "v0.3.0", "2.0.1"},
foundInDeprecatedDir: true, foundInDeprecatedDir: true,
shouldFail: true, shouldFail: false,
}, },
{ {
pluginName: "test.plugin", pluginName: "test.plugin",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment