Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
2e287a0a
Unverified
Commit
2e287a0a
authored
Feb 13, 2019
by
Kubernetes Prow Robot
Committed by
GitHub
Feb 13, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #73677 from jarrpa/csi-cluster-registrar
e2e: Use cluster-driver-registrar for CSIDriverRegistry tests
parents
888ff409
62f3211d
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
235 additions
and
99 deletions
+235
-99
BUILD
test/e2e/storage/BUILD
+0
-1
csi_volumes.go
test/e2e/storage/csi_volumes.go
+61
-70
csi.go
test/e2e/storage/drivers/csi.go
+44
-16
deployment.go
test/e2e/storage/utils/deployment.go
+10
-0
README.md
...-manifests/storage-csi/cluster-driver-registrar/README.md
+1
-0
rbac.yaml
...-manifests/storage-csi/cluster-driver-registrar/rbac.yaml
+38
-0
csi-mock-cluster-driver-registrar.yaml
...s/storage-csi/mock/csi-mock-cluster-driver-registrar.yaml
+33
-0
csi-mock-driver-attacher.yaml
...-manifests/storage-csi/mock/csi-mock-driver-attacher.yaml
+34
-0
csi-mock-driver.yaml
...e/testing-manifests/storage-csi/mock/csi-mock-driver.yaml
+0
-12
csi-mock-rbac.yaml
...e2e/testing-manifests/storage-csi/mock/csi-mock-rbac.yaml
+14
-0
No files found.
test/e2e/storage/BUILD
View file @
2e287a0a
...
@@ -64,7 +64,6 @@ go_library(
...
@@ -64,7 +64,6 @@ go_library(
"//staging/src/k8s.io/client-go/kubernetes:go_default_library",
"//staging/src/k8s.io/client-go/kubernetes:go_default_library",
"//staging/src/k8s.io/client-go/kubernetes/typed/core/v1:go_default_library",
"//staging/src/k8s.io/client-go/kubernetes/typed/core/v1:go_default_library",
"//staging/src/k8s.io/cloud-provider/volume/helpers:go_default_library",
"//staging/src/k8s.io/cloud-provider/volume/helpers:go_default_library",
"//staging/src/k8s.io/csi-api/pkg/apis/csi/v1alpha1:go_default_library",
"//staging/src/k8s.io/csi-api/pkg/client/clientset/versioned:go_default_library",
"//staging/src/k8s.io/csi-api/pkg/client/clientset/versioned:go_default_library",
"//test/e2e/framework:go_default_library",
"//test/e2e/framework:go_default_library",
"//test/e2e/framework/metrics:go_default_library",
"//test/e2e/framework/metrics:go_default_library",
...
...
test/e2e/storage/csi_volumes.go
View file @
2e287a0a
...
@@ -22,6 +22,7 @@ import (
...
@@ -22,6 +22,7 @@ import (
"fmt"
"fmt"
"regexp"
"regexp"
"strings"
"strings"
"time"
"k8s.io/api/core/v1"
"k8s.io/api/core/v1"
storagev1
"k8s.io/api/storage/v1"
storagev1
"k8s.io/api/storage/v1"
...
@@ -29,7 +30,6 @@ import (
...
@@ -29,7 +30,6 @@ import (
metav1
"k8s.io/apimachinery/pkg/apis/meta/v1"
metav1
"k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/sets"
"k8s.io/apimachinery/pkg/util/sets"
clientset
"k8s.io/client-go/kubernetes"
clientset
"k8s.io/client-go/kubernetes"
csiv1alpha1
"k8s.io/csi-api/pkg/apis/csi/v1alpha1"
csiclient
"k8s.io/csi-api/pkg/client/clientset/versioned"
csiclient
"k8s.io/csi-api/pkg/client/clientset/versioned"
"k8s.io/kubernetes/test/e2e/framework"
"k8s.io/kubernetes/test/e2e/framework"
"k8s.io/kubernetes/test/e2e/framework/podlogs"
"k8s.io/kubernetes/test/e2e/framework/podlogs"
...
@@ -196,57 +196,49 @@ var _ = utils.SIGDescribe("CSI Volumes", func() {
...
@@ -196,57 +196,49 @@ var _ = utils.SIGDescribe("CSI Volumes", func() {
})
})
// The CSIDriverRegistry feature gate is needed for this test in Kubernetes 1.12.
// The CSIDriverRegistry feature gate is needed for this test in Kubernetes 1.12.
Context
(
"CSI attach test using HostPath driver [Feature:CSIDriverRegistry]"
,
func
()
{
Context
(
"CSI attach test using mock driver [Feature:CSIDriverRegistry]"
,
func
()
{
var
(
var
(
driver
testsuites
.
TestDriver
driver
testsuites
.
TestDriver
)
)
BeforeEach
(
func
()
{
config
:=
testsuites
.
TestConfig
{
Framework
:
f
,
Prefix
:
"csi-attach"
,
}
driver
=
drivers
.
InitHostPathCSIDriver
(
config
)
driver
.
CreateDriver
()
})
AfterEach
(
func
()
{
driver
.
CleanupDriver
()
})
tests
:=
[]
struct
{
tests
:=
[]
struct
{
name
string
name
string
driverAttachable
bool
driverAttachable
bool
driverExists
bool
driverExists
bool
expectVolumeAttachment
bool
}{
}{
{
{
name
:
"non-attachable volume does not need VolumeAttachment"
,
name
:
"should not require VolumeAttach for drivers without attachment"
,
driverAttachable
:
false
,
driverAttachable
:
false
,
driverExists
:
true
,
driverExists
:
true
,
expectVolumeAttachment
:
false
,
},
},
{
{
name
:
"attachable volume needs VolumeAttachment"
,
name
:
"should require VolumeAttach for drivers with attachment"
,
driverAttachable
:
true
,
driverAttachable
:
true
,
driverExists
:
true
,
driverExists
:
true
,
expectVolumeAttachment
:
true
,
},
},
{
{
name
:
"volume with no CSI driver needs VolumeAttachm
ent"
,
name
:
"should preserve attachment policy when no CSIDriver pres
ent"
,
driver
Exists
:
fals
e
,
driver
Attachable
:
tru
e
,
expectVolumeAttachment
:
tru
e
,
driverExists
:
fals
e
,
},
},
}
}
for
_
,
t
:=
range
tests
{
for
_
,
t
:=
range
tests
{
test
:=
t
test
:=
t
It
(
test
.
name
,
func
()
{
It
(
test
.
name
,
func
()
{
By
(
"Deploying mock CSI driver"
)
config
:=
testsuites
.
TestConfig
{
Framework
:
f
,
Prefix
:
"csi-attach"
,
}
driver
=
drivers
.
InitMockCSIDriver
(
config
,
test
.
driverExists
,
test
.
driverAttachable
,
nil
)
driver
.
CreateDriver
()
if
test
.
driverExists
{
if
test
.
driverExists
{
csiDriver
:=
createCSIDriver
(
csics
,
testsuites
.
GetUniqueDriverName
(
driver
),
test
.
driverAttachable
,
nil
)
defer
destroyCSIDriver
(
csics
,
driver
)
if
csiDriver
!=
nil
{
defer
driver
.
CleanupDriver
()
defer
csics
.
CsiV1alpha1
()
.
CSIDrivers
()
.
Delete
(
csiDriver
.
Name
,
nil
)
}
}
}
By
(
"Creating pod"
)
By
(
"Creating pod"
)
...
@@ -270,7 +262,8 @@ var _ = utils.SIGDescribe("CSI Volumes", func() {
...
@@ -270,7 +262,8 @@ var _ = utils.SIGDescribe("CSI Volumes", func() {
defer
cs
.
StorageV1
()
.
StorageClasses
()
.
Delete
(
class
.
Name
,
nil
)
defer
cs
.
StorageV1
()
.
StorageClasses
()
.
Delete
(
class
.
Name
,
nil
)
}
}
if
claim
!=
nil
{
if
claim
!=
nil
{
defer
cs
.
CoreV1
()
.
PersistentVolumeClaims
(
ns
.
Name
)
.
Delete
(
claim
.
Name
,
nil
)
// Fully delete PV before deleting CSI driver
defer
deleteVolume
(
cs
,
claim
)
}
}
if
pod
!=
nil
{
if
pod
!=
nil
{
// Fully delete (=unmount) the pod before deleting CSI driver
// Fully delete (=unmount) the pod before deleting CSI driver
...
@@ -284,28 +277,27 @@ var _ = utils.SIGDescribe("CSI Volumes", func() {
...
@@ -284,28 +277,27 @@ var _ = utils.SIGDescribe("CSI Volumes", func() {
framework
.
ExpectNoError
(
err
,
"Failed to start pod: %v"
,
err
)
framework
.
ExpectNoError
(
err
,
"Failed to start pod: %v"
,
err
)
By
(
"Checking if VolumeAttachment was created for the pod"
)
By
(
"Checking if VolumeAttachment was created for the pod"
)
// Check that VolumeAttachment does not exist
handle
:=
getVolumeHandle
(
cs
,
claim
)
handle
:=
getVolumeHandle
(
cs
,
claim
)
attachmentHash
:=
sha256
.
Sum256
([]
byte
(
fmt
.
Sprintf
(
"%s%s%s"
,
handle
,
scTest
.
Provisioner
,
nodeName
)))
attachmentHash
:=
sha256
.
Sum256
([]
byte
(
fmt
.
Sprintf
(
"%s%s%s"
,
handle
,
scTest
.
Provisioner
,
nodeName
)))
attachmentName
:=
fmt
.
Sprintf
(
"csi-%x"
,
attachmentHash
)
attachmentName
:=
fmt
.
Sprintf
(
"csi-%x"
,
attachmentHash
)
_
,
err
=
cs
.
StorageV1beta1
()
.
VolumeAttachments
()
.
Get
(
attachmentName
,
metav1
.
GetOptions
{})
_
,
err
=
cs
.
StorageV1beta1
()
.
VolumeAttachments
()
.
Get
(
attachmentName
,
metav1
.
GetOptions
{})
if
err
!=
nil
{
if
err
!=
nil
{
if
errors
.
IsNotFound
(
err
)
{
if
errors
.
IsNotFound
(
err
)
{
if
test
.
expectVolumeAttachment
{
if
test
.
driverAttachable
{
framework
.
ExpectNoError
(
err
,
"Expected VolumeAttachment but none was found"
)
framework
.
ExpectNoError
(
err
,
"Expected VolumeAttachment but none was found"
)
}
}
}
else
{
}
else
{
framework
.
ExpectNoError
(
err
,
"Failed to find VolumeAttachment"
)
framework
.
ExpectNoError
(
err
,
"Failed to find VolumeAttachment"
)
}
}
}
}
if
!
test
.
expectVolumeAttachment
{
if
!
test
.
driverAttachable
{
Expect
(
err
)
.
To
(
HaveOccurred
(),
"Unexpected VolumeAttachment found"
)
Expect
(
err
)
.
To
(
HaveOccurred
(),
"Unexpected VolumeAttachment found"
)
}
}
})
})
}
}
})
})
Context
(
"CSI workload information [Feature:CSIDriverRegistry]"
,
func
()
{
Context
(
"CSI workload information
using mock driver
[Feature:CSIDriverRegistry]"
,
func
()
{
var
(
var
(
driver
testsuites
.
TestDriver
driver
testsuites
.
TestDriver
podInfoV1
=
"v1"
podInfoV1
=
"v1"
...
@@ -313,19 +305,6 @@ var _ = utils.SIGDescribe("CSI Volumes", func() {
...
@@ -313,19 +305,6 @@ var _ = utils.SIGDescribe("CSI Volumes", func() {
podInfoEmpty
=
""
podInfoEmpty
=
""
)
)
BeforeEach
(
func
()
{
config
:=
testsuites
.
TestConfig
{
Framework
:
f
,
Prefix
:
"csi-workload"
,
}
driver
=
drivers
.
InitMockCSIDriver
(
config
)
driver
.
CreateDriver
()
})
AfterEach
(
func
()
{
driver
.
CleanupDriver
()
})
tests
:=
[]
struct
{
tests
:=
[]
struct
{
name
string
name
string
podInfoOnMountVersion
*
string
podInfoOnMountVersion
*
string
...
@@ -365,11 +344,18 @@ var _ = utils.SIGDescribe("CSI Volumes", func() {
...
@@ -365,11 +344,18 @@ var _ = utils.SIGDescribe("CSI Volumes", func() {
for
_
,
t
:=
range
tests
{
for
_
,
t
:=
range
tests
{
test
:=
t
test
:=
t
It
(
test
.
name
,
func
()
{
It
(
test
.
name
,
func
()
{
By
(
"Deploying mock CSI driver"
)
config
:=
testsuites
.
TestConfig
{
Framework
:
f
,
Prefix
:
"csi-workload"
,
}
driver
=
drivers
.
InitMockCSIDriver
(
config
,
test
.
driverExists
,
true
,
test
.
podInfoOnMountVersion
)
driver
.
CreateDriver
()
if
test
.
driverExists
{
if
test
.
driverExists
{
csiDriver
:=
createCSIDriver
(
csics
,
testsuites
.
GetUniqueDriverName
(
driver
),
true
,
test
.
podInfoOnMountVersion
)
defer
destroyCSIDriver
(
csics
,
driver
)
if
csiDriver
!=
nil
{
defer
driver
.
CleanupDriver
()
defer
csics
.
CsiV1alpha1
()
.
CSIDrivers
()
.
Delete
(
csiDriver
.
Name
,
nil
)
}
}
}
By
(
"Creating pod"
)
By
(
"Creating pod"
)
...
@@ -397,7 +383,8 @@ var _ = utils.SIGDescribe("CSI Volumes", func() {
...
@@ -397,7 +383,8 @@ var _ = utils.SIGDescribe("CSI Volumes", func() {
defer
cs
.
StorageV1
()
.
StorageClasses
()
.
Delete
(
class
.
Name
,
nil
)
defer
cs
.
StorageV1
()
.
StorageClasses
()
.
Delete
(
class
.
Name
,
nil
)
}
}
if
claim
!=
nil
{
if
claim
!=
nil
{
defer
cs
.
CoreV1
()
.
PersistentVolumeClaims
(
ns
.
Name
)
.
Delete
(
claim
.
Name
,
nil
)
// Fully delete PV before deleting CSI driver
defer
deleteVolume
(
cs
,
claim
)
}
}
if
pod
!=
nil
{
if
pod
!=
nil
{
// Fully delete (=unmount) the pod before deleting CSI driver
// Fully delete (=unmount) the pod before deleting CSI driver
...
@@ -472,20 +459,15 @@ func testTopologyNegative(cs clientset.Interface, suffix, namespace string, dela
...
@@ -472,20 +459,15 @@ func testTopologyNegative(cs clientset.Interface, suffix, namespace string, dela
}
}
}
}
func
createCSIDriver
(
csics
csiclient
.
Interface
,
name
string
,
attachable
bool
,
podInfoOnMountVersion
*
string
)
*
csiv1alpha1
.
CSIDriver
{
func
destroyCSIDriver
(
csics
csiclient
.
Interface
,
driver
testsuites
.
TestDriver
)
{
By
(
"Creating CSIDriver instance"
)
driverName
:=
testsuites
.
GetUniqueDriverName
(
driver
)
driver
:=
&
csiv1alpha1
.
CSIDriver
{
driverGet
,
err
:=
csics
.
CsiV1alpha1
()
.
CSIDrivers
()
.
Get
(
driverName
,
metav1
.
GetOptions
{})
ObjectMeta
:
metav1
.
ObjectMeta
{
if
err
==
nil
{
Name
:
name
,
framework
.
Logf
(
"deleting %s.%s: %s"
,
driverGet
.
TypeMeta
.
APIVersion
,
driverGet
.
TypeMeta
.
Kind
,
driverGet
.
ObjectMeta
.
Name
)
},
// Uncomment the following line to get full dump of CSIDriver object
Spec
:
csiv1alpha1
.
CSIDriverSpec
{
// framework.Logf("%s", framework.PrettyPrint(driverGet))
AttachRequired
:
&
attachable
,
csics
.
CsiV1alpha1
()
.
CSIDrivers
()
.
Delete
(
driverName
,
nil
)
PodInfoOnMountVersion
:
podInfoOnMountVersion
,
},
}
}
driver
,
err
:=
csics
.
CsiV1alpha1
()
.
CSIDrivers
()
.
Create
(
driver
)
framework
.
ExpectNoError
(
err
,
"Failed to create CSIDriver: %v"
,
err
)
return
driver
}
}
func
getVolumeHandle
(
cs
clientset
.
Interface
,
claim
*
v1
.
PersistentVolumeClaim
)
string
{
func
getVolumeHandle
(
cs
clientset
.
Interface
,
claim
*
v1
.
PersistentVolumeClaim
)
string
{
...
@@ -508,6 +490,15 @@ func getVolumeHandle(cs clientset.Interface, claim *v1.PersistentVolumeClaim) st
...
@@ -508,6 +490,15 @@ func getVolumeHandle(cs clientset.Interface, claim *v1.PersistentVolumeClaim) st
return
pv
.
Spec
.
CSI
.
VolumeHandle
return
pv
.
Spec
.
CSI
.
VolumeHandle
}
}
func
deleteVolume
(
cs
clientset
.
Interface
,
claim
*
v1
.
PersistentVolumeClaim
)
{
// re-get the claim to the latest state with bound volume
claim
,
err
:=
cs
.
CoreV1
()
.
PersistentVolumeClaims
(
claim
.
Namespace
)
.
Get
(
claim
.
Name
,
metav1
.
GetOptions
{})
if
err
==
nil
{
cs
.
CoreV1
()
.
PersistentVolumeClaims
(
claim
.
Namespace
)
.
Delete
(
claim
.
Name
,
nil
)
framework
.
WaitForPersistentVolumeDeleted
(
cs
,
claim
.
Spec
.
VolumeName
,
2
*
time
.
Second
,
2
*
time
.
Minute
)
}
}
func
startPausePod
(
cs
clientset
.
Interface
,
t
testsuites
.
StorageClassTest
,
node
testsuites
.
NodeSelection
,
ns
string
)
(
*
storagev1
.
StorageClass
,
*
v1
.
PersistentVolumeClaim
,
*
v1
.
Pod
)
{
func
startPausePod
(
cs
clientset
.
Interface
,
t
testsuites
.
StorageClassTest
,
node
testsuites
.
NodeSelection
,
ns
string
)
(
*
storagev1
.
StorageClass
,
*
v1
.
PersistentVolumeClaim
,
*
v1
.
Pod
)
{
class
:=
newStorageClass
(
t
,
ns
,
""
)
class
:=
newStorageClass
(
t
,
ns
,
""
)
class
,
err
:=
cs
.
StorageV1
()
.
StorageClasses
()
.
Create
(
class
)
class
,
err
:=
cs
.
StorageV1
()
.
StorageClasses
()
.
Create
(
class
)
...
...
test/e2e/storage/drivers/csi.go
View file @
2e287a0a
...
@@ -166,15 +166,39 @@ func (h *hostpathCSIDriver) CleanupDriver() {
...
@@ -166,15 +166,39 @@ func (h *hostpathCSIDriver) CleanupDriver() {
// mockCSI
// mockCSI
type
mockCSIDriver
struct
{
type
mockCSIDriver
struct
{
cleanup
func
()
cleanup
func
()
driverInfo
testsuites
.
DriverInfo
driverInfo
testsuites
.
DriverInfo
manifests
[]
string
podInfoVersion
*
string
}
}
var
_
testsuites
.
TestDriver
=
&
mockCSIDriver
{}
var
_
testsuites
.
TestDriver
=
&
mockCSIDriver
{}
var
_
testsuites
.
DynamicPVTestDriver
=
&
mockCSIDriver
{}
var
_
testsuites
.
DynamicPVTestDriver
=
&
mockCSIDriver
{}
// InitMockCSIDriver returns a mockCSIDriver that implements TestDriver interface
// InitMockCSIDriver returns a mockCSIDriver that implements TestDriver interface
func
InitMockCSIDriver
(
config
testsuites
.
TestConfig
)
testsuites
.
TestDriver
{
func
InitMockCSIDriver
(
config
testsuites
.
TestConfig
,
registerDriver
,
driverAttachable
bool
,
podInfoVersion
*
string
)
testsuites
.
TestDriver
{
driverManifests
:=
[]
string
{
"test/e2e/testing-manifests/storage-csi/cluster-driver-registrar/rbac.yaml"
,
"test/e2e/testing-manifests/storage-csi/driver-registrar/rbac.yaml"
,
"test/e2e/testing-manifests/storage-csi/external-attacher/rbac.yaml"
,
"test/e2e/testing-manifests/storage-csi/external-provisioner/rbac.yaml"
,
"test/e2e/testing-manifests/storage-csi/mock/csi-mock-rbac.yaml"
,
"test/e2e/testing-manifests/storage-csi/mock/csi-storageclass.yaml"
,
"test/e2e/testing-manifests/storage-csi/mock/csi-mock-driver.yaml"
,
}
config
.
ServerConfig
=
&
framework
.
VolumeTestConfig
{}
if
registerDriver
{
driverManifests
=
append
(
driverManifests
,
"test/e2e/testing-manifests/storage-csi/mock/csi-mock-cluster-driver-registrar.yaml"
)
}
if
driverAttachable
{
driverManifests
=
append
(
driverManifests
,
"test/e2e/testing-manifests/storage-csi/mock/csi-mock-driver-attacher.yaml"
)
}
else
{
config
.
ServerConfig
.
ServerArgs
=
append
(
config
.
ServerConfig
.
ServerArgs
,
"--disable-attach"
)
}
return
&
mockCSIDriver
{
return
&
mockCSIDriver
{
driverInfo
:
testsuites
.
DriverInfo
{
driverInfo
:
testsuites
.
DriverInfo
{
Name
:
"csi-mock"
,
Name
:
"csi-mock"
,
...
@@ -190,6 +214,8 @@ func InitMockCSIDriver(config testsuites.TestConfig) testsuites.TestDriver {
...
@@ -190,6 +214,8 @@ func InitMockCSIDriver(config testsuites.TestConfig) testsuites.TestDriver {
},
},
Config
:
config
,
Config
:
config
,
},
},
manifests
:
driverManifests
,
podInfoVersion
:
podInfoVersion
,
}
}
}
}
...
@@ -223,26 +249,28 @@ func (m *mockCSIDriver) CreateDriver() {
...
@@ -223,26 +249,28 @@ func (m *mockCSIDriver) CreateDriver() {
node
:=
nodes
.
Items
[
rand
.
Intn
(
len
(
nodes
.
Items
))]
node
:=
nodes
.
Items
[
rand
.
Intn
(
len
(
nodes
.
Items
))]
m
.
driverInfo
.
Config
.
ClientNodeName
=
node
.
Name
m
.
driverInfo
.
Config
.
ClientNodeName
=
node
.
Name
containerArgs
:=
[]
string
{
"--name=csi-mock-"
+
f
.
UniqueName
}
if
m
.
driverInfo
.
Config
.
ServerConfig
!=
nil
&&
m
.
driverInfo
.
Config
.
ServerConfig
.
ServerArgs
!=
nil
{
containerArgs
=
append
(
containerArgs
,
m
.
driverInfo
.
Config
.
ServerConfig
.
ServerArgs
...
)
}
// TODO (?): the storage.csi.image.version and storage.csi.image.registry
// TODO (?): the storage.csi.image.version and storage.csi.image.registry
// settings are ignored for this test. We could patch the image definitions.
// settings are ignored for this test. We could patch the image definitions.
o
:=
utils
.
PatchCSIOptions
{
o
:=
utils
.
PatchCSIOptions
{
OldDriverName
:
"csi-mock"
,
OldDriverName
:
"csi-mock"
,
NewDriverName
:
"csi-mock-"
+
f
.
UniqueName
,
NewDriverName
:
"csi-mock-"
+
f
.
UniqueName
,
DriverContainerName
:
"mock"
,
DriverContainerName
:
"mock"
,
DriverContainerArguments
:
[]
string
{
"--name=csi-mock-"
+
f
.
UniqueName
},
DriverContainerArguments
:
containerArgs
,
ProvisionerContainerName
:
"csi-provisioner"
,
ProvisionerContainerName
:
"csi-provisioner"
,
NodeName
:
m
.
driverInfo
.
Config
.
ClientNodeName
,
ClusterRegistrarContainerName
:
"csi-cluster-driver-registrar"
,
NodeName
:
m
.
driverInfo
.
Config
.
ClientNodeName
,
PodInfoVersion
:
m
.
podInfoVersion
,
}
}
cleanup
,
err
:=
f
.
CreateFromManifests
(
func
(
item
interface
{})
error
{
cleanup
,
err
:=
f
.
CreateFromManifests
(
func
(
item
interface
{})
error
{
return
utils
.
PatchCSIDeployment
(
f
,
o
,
item
)
return
utils
.
PatchCSIDeployment
(
f
,
o
,
item
)
},
},
"test/e2e/testing-manifests/storage-csi/driver-registrar/rbac.yaml"
,
m
.
manifests
...
)
"test/e2e/testing-manifests/storage-csi/external-attacher/rbac.yaml"
,
"test/e2e/testing-manifests/storage-csi/external-provisioner/rbac.yaml"
,
"test/e2e/testing-manifests/storage-csi/mock/csi-mock-rbac.yaml"
,
"test/e2e/testing-manifests/storage-csi/mock/csi-storageclass.yaml"
,
"test/e2e/testing-manifests/storage-csi/mock/csi-mock-driver.yaml"
,
)
m
.
cleanup
=
cleanup
m
.
cleanup
=
cleanup
if
err
!=
nil
{
if
err
!=
nil
{
framework
.
Failf
(
"deploying csi mock driver: %v"
,
err
)
framework
.
Failf
(
"deploying csi mock driver: %v"
,
err
)
...
...
test/e2e/storage/utils/deployment.go
View file @
2e287a0a
...
@@ -97,6 +97,10 @@ func PatchCSIDeployment(f *framework.Framework, o PatchCSIOptions, object interf
...
@@ -97,6 +97,10 @@ func PatchCSIDeployment(f *framework.Framework, o PatchCSIOptions, object interf
// Driver name is expected to be the same
// Driver name is expected to be the same
// as the snapshotter here.
// as the snapshotter here.
container
.
Args
=
append
(
container
.
Args
,
"--snapshotter="
+
o
.
NewDriverName
)
container
.
Args
=
append
(
container
.
Args
,
"--snapshotter="
+
o
.
NewDriverName
)
case
o
.
ClusterRegistrarContainerName
:
if
o
.
PodInfoVersion
!=
nil
{
container
.
Args
=
append
(
container
.
Args
,
"--pod-info-mount-version="
+*
o
.
PodInfoVersion
)
}
}
}
}
}
}
}
...
@@ -153,6 +157,12 @@ type PatchCSIOptions struct {
...
@@ -153,6 +157,12 @@ type PatchCSIOptions struct {
// If non-empty, --snapshotter with new name will be appended
// If non-empty, --snapshotter with new name will be appended
// to the argument list.
// to the argument list.
SnapshotterContainerName
string
SnapshotterContainerName
string
// The name of the container which has the cluster-driver-registrar
// binary.
ClusterRegistrarContainerName
string
// If non-empty, all pods are forced to run on this node.
// If non-empty, all pods are forced to run on this node.
NodeName
string
NodeName
string
// If not nil, the argument to pass to the cluster-driver-registrar's
// pod-info-mount-version argument.
PodInfoVersion
*
string
}
}
test/e2e/testing-manifests/storage-csi/cluster-driver-registrar/README.md
0 → 100644
View file @
2e287a0a
The original file is (or will be) https://github.com/kubernetes-csi/cluster-driver-registrar/blob/master/deploy/kubernetes/rbac.yaml
test/e2e/testing-manifests/storage-csi/cluster-driver-registrar/rbac.yaml
0 → 100644
View file @
2e287a0a
# This YAML file contains all RBAC objects that are necessary to run
# cluster-driver-registrar.
#
# In production, each CSI driver deployment has to be customized:
# - to avoid conflicts, use non-default namespace and different names
# for non-namespaced entities like the ClusterRole
apiVersion
:
v1
kind
:
ServiceAccount
metadata
:
name
:
csi-cluster-driver-registrar
# replace with non-default namespace name
namespace
:
default
---
kind
:
ClusterRole
apiVersion
:
rbac.authorization.k8s.io/v1
metadata
:
name
:
cluster-driver-registrar-runner
rules
:
-
apiGroups
:
[
"
csi.storage.k8s.io"
]
resources
:
[
"
csidrivers"
]
verbs
:
[
"
create"
,
"
delete"
]
---
kind
:
ClusterRoleBinding
apiVersion
:
rbac.authorization.k8s.io/v1
metadata
:
name
:
csi-cluster-driver-registrar-role
subjects
:
-
kind
:
ServiceAccount
name
:
csi-cluster-driver-registrar
# replace with non-default namespace name
namespace
:
default
roleRef
:
kind
:
ClusterRole
name
:
cluster-driver-registrar-runner
apiGroup
:
rbac.authorization.k8s.io
test/e2e/testing-manifests/storage-csi/mock/csi-mock-cluster-driver-registrar.yaml
0 → 100644
View file @
2e287a0a
kind
:
StatefulSet
apiVersion
:
apps/v1
metadata
:
name
:
csi-mockplugin-cluster-driver-registrar
spec
:
selector
:
matchLabels
:
app
:
csi-mockplugin-cluster-driver-registrar
replicas
:
1
template
:
metadata
:
labels
:
app
:
csi-mockplugin-cluster-driver-registrar
spec
:
serviceAccountName
:
csi-mock
containers
:
-
name
:
csi-cluster-driver-registrar
image
:
quay.io/k8scsi/csi-cluster-driver-registrar:canary
args
:
-
--v=5
-
--csi-address=$(ADDRESS)
env
:
-
name
:
ADDRESS
value
:
/csi/csi.sock
imagePullPolicy
:
Always
volumeMounts
:
-
mountPath
:
/csi
name
:
socket-dir
volumes
:
-
hostPath
:
path
:
/var/lib/kubelet/plugins/csi-mock
type
:
DirectoryOrCreate
name
:
socket-dir
test/e2e/testing-manifests/storage-csi/mock/csi-mock-driver-attacher.yaml
0 → 100644
View file @
2e287a0a
kind
:
StatefulSet
apiVersion
:
apps/v1
metadata
:
name
:
csi-mockplugin-attacher
spec
:
selector
:
matchLabels
:
app
:
csi-mockplugin-attacher
replicas
:
1
template
:
metadata
:
labels
:
app
:
csi-mockplugin-attacher
spec
:
serviceAccountName
:
csi-mock
containers
:
-
name
:
csi-attacher
image
:
quay.io/k8scsi/csi-attacher:v1.0.1
args
:
-
--v=5
-
--csi-address=$(ADDRESS)
env
:
-
name
:
ADDRESS
value
:
/csi/csi.sock
imagePullPolicy
:
Always
volumeMounts
:
-
mountPath
:
/csi
name
:
socket-dir
volumes
:
-
hostPath
:
path
:
/var/lib/kubelet/plugins/csi-mock
type
:
DirectoryOrCreate
name
:
socket-dir
test/e2e/testing-manifests/storage-csi/mock/csi-mock-driver.yaml
View file @
2e287a0a
...
@@ -16,18 +16,6 @@ spec:
...
@@ -16,18 +16,6 @@ spec:
containers
:
containers
:
-
name
:
csi-attacher
image
:
quay.io/k8scsi/csi-attacher:v1.0.1
args
:
-
--v=5
-
--csi-address=$(ADDRESS)
env
:
-
name
:
ADDRESS
value
:
/csi/csi.sock
imagePullPolicy
:
Always
volumeMounts
:
-
mountPath
:
/csi
name
:
socket-dir
-
name
:
csi-provisioner
-
name
:
csi-provisioner
image
:
quay.io/k8scsi/csi-provisioner:v1.0.1
image
:
quay.io/k8scsi/csi-provisioner:v1.0.1
args
:
args
:
...
...
test/e2e/testing-manifests/storage-csi/mock/csi-mock-rbac.yaml
View file @
2e287a0a
...
@@ -32,6 +32,20 @@ roleRef:
...
@@ -32,6 +32,20 @@ roleRef:
apiGroup
:
rbac.authorization.k8s.io
apiGroup
:
rbac.authorization.k8s.io
---
---
kind
:
ClusterRoleBinding
apiVersion
:
rbac.authorization.k8s.io/v1
metadata
:
name
:
csi-controller-cluster-driver-registrar-role
subjects
:
-
kind
:
ServiceAccount
name
:
csi-mock
namespace
:
default
roleRef
:
kind
:
ClusterRole
name
:
cluster-driver-registrar-runner
apiGroup
:
rbac.authorization.k8s.io
---
# priviledged Pod Security Policy, previously defined via PrivilegedTestPSPClusterRoleBinding()
# priviledged Pod Security Policy, previously defined via PrivilegedTestPSPClusterRoleBinding()
kind
:
ClusterRoleBinding
kind
:
ClusterRoleBinding
apiVersion
:
rbac.authorization.k8s.io/v1
apiVersion
:
rbac.authorization.k8s.io/v1
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment