Merge pull request #71520 from saad-ali/allow0310Both

Allow CSI Drivers suporting 0.x/1.x to use old dir
pull/58/head
k8s-ci-robot 2018-11-28 12:22:37 -08:00 committed by GitHub
commit 6e5176b48d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 11 deletions

View File

@ -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 {

View File

@ -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",