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
7280fcef
Commit
7280fcef
authored
Jan 31, 2019
by
xushiwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
address reviewer comments
parent
3410d435
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
15 additions
and
52 deletions
+15
-52
csi.go
test/e2e/storage/drivers/csi.go
+5
-7
provisioning.go
test/e2e/storage/testsuites/provisioning.go
+4
-9
snapshottable.go
test/e2e/storage/testsuites/snapshottable.go
+3
-3
README.md
...ting-manifests/storage-csi/external-snapshotter/README.md
+1
-1
rbac.yaml
...ting-manifests/storage-csi/external-snapshotter/rbac.yaml
+2
-32
No files found.
test/e2e/storage/drivers/csi.go
View file @
7280fcef
...
@@ -61,7 +61,7 @@ type hostpathCSIDriver struct {
...
@@ -61,7 +61,7 @@ type hostpathCSIDriver struct {
manifests
[]
string
manifests
[]
string
}
}
func
initHostPathCSIDriver
(
name
string
,
config
testsuites
.
TestConfig
,
manifests
...
string
)
testsuites
.
TestDriver
{
func
initHostPathCSIDriver
(
name
string
,
config
testsuites
.
TestConfig
,
capabilities
map
[
testsuites
.
Capability
]
bool
,
manifests
...
string
)
testsuites
.
TestDriver
{
return
&
hostpathCSIDriver
{
return
&
hostpathCSIDriver
{
driverInfo
:
testsuites
.
DriverInfo
{
driverInfo
:
testsuites
.
DriverInfo
{
Name
:
name
,
Name
:
name
,
...
@@ -70,12 +70,8 @@ func initHostPathCSIDriver(name string, config testsuites.TestConfig, manifests
...
@@ -70,12 +70,8 @@ func initHostPathCSIDriver(name string, config testsuites.TestConfig, manifests
SupportedFsType
:
sets
.
NewString
(
SupportedFsType
:
sets
.
NewString
(
""
,
// Default fsType
""
,
// Default fsType
),
),
Capabilities
:
map
[
testsuites
.
Capability
]
bool
{
Capabilities
:
capabilities
,
testsuites
.
CapPersistence
:
true
,
Config
:
config
,
testsuites
.
CapDataSource
:
true
,
},
Config
:
config
,
},
},
manifests
:
manifests
,
manifests
:
manifests
,
}
}
...
@@ -88,6 +84,7 @@ var _ testsuites.SnapshottableTestDriver = &hostpathCSIDriver{}
...
@@ -88,6 +84,7 @@ var _ testsuites.SnapshottableTestDriver = &hostpathCSIDriver{}
// InitHostPathCSIDriver returns hostpathCSIDriver that implements TestDriver interface
// InitHostPathCSIDriver returns hostpathCSIDriver that implements TestDriver interface
func
InitHostPathCSIDriver
(
config
testsuites
.
TestConfig
)
testsuites
.
TestDriver
{
func
InitHostPathCSIDriver
(
config
testsuites
.
TestConfig
)
testsuites
.
TestDriver
{
return
initHostPathCSIDriver
(
"csi-hostpath"
,
config
,
return
initHostPathCSIDriver
(
"csi-hostpath"
,
config
,
map
[
testsuites
.
Capability
]
bool
{
testsuites
.
CapPersistence
:
true
,
testsuites
.
CapDataSource
:
true
},
"test/e2e/testing-manifests/storage-csi/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-attacher/rbac.yaml"
,
"test/e2e/testing-manifests/storage-csi/external-provisioner/rbac.yaml"
,
"test/e2e/testing-manifests/storage-csi/external-provisioner/rbac.yaml"
,
...
@@ -262,6 +259,7 @@ func (m *mockCSIDriver) CleanupDriver() {
...
@@ -262,6 +259,7 @@ func (m *mockCSIDriver) CleanupDriver() {
// InitHostPathV0CSIDriver returns a variant of hostpathCSIDriver with different manifests.
// InitHostPathV0CSIDriver returns a variant of hostpathCSIDriver with different manifests.
func
InitHostPathV0CSIDriver
(
config
testsuites
.
TestConfig
)
testsuites
.
TestDriver
{
func
InitHostPathV0CSIDriver
(
config
testsuites
.
TestConfig
)
testsuites
.
TestDriver
{
return
initHostPathCSIDriver
(
"csi-hostpath-v0"
,
config
,
return
initHostPathCSIDriver
(
"csi-hostpath-v0"
,
config
,
map
[
testsuites
.
Capability
]
bool
{
testsuites
.
CapPersistence
:
true
},
"test/e2e/testing-manifests/storage-csi/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-attacher/rbac.yaml"
,
"test/e2e/testing-manifests/storage-csi/external-provisioner/rbac.yaml"
,
"test/e2e/testing-manifests/storage-csi/external-provisioner/rbac.yaml"
,
...
...
test/e2e/storage/testsuites/provisioning.go
View file @
7280fcef
...
@@ -162,8 +162,8 @@ func (p *provisioningTestResource) setupResource(driver TestDriver, pattern test
...
@@ -162,8 +162,8 @@ func (p *provisioningTestResource) setupResource(driver TestDriver, pattern test
p
.
pvc
=
getClaim
(
p
.
claimSize
,
driver
.
GetDriverInfo
()
.
Config
.
Framework
.
Namespace
.
Name
)
p
.
pvc
=
getClaim
(
p
.
claimSize
,
driver
.
GetDriverInfo
()
.
Config
.
Framework
.
Namespace
.
Name
)
p
.
pvc
.
Spec
.
StorageClassName
=
&
p
.
sc
.
Name
p
.
pvc
.
Spec
.
StorageClassName
=
&
p
.
sc
.
Name
framework
.
Logf
(
"In creating storage class object and pvc object for driver - sc: %v, pvc: %v"
,
p
.
sc
,
p
.
pvc
)
framework
.
Logf
(
"In creating storage class object and pvc object for driver - sc: %v, pvc: %v"
,
p
.
sc
,
p
.
pvc
)
if
d
Driver
,
ok
:=
driver
.
(
SnapshottableTestDriver
);
ok
{
if
s
Driver
,
ok
:=
driver
.
(
SnapshottableTestDriver
);
ok
{
p
.
vsc
=
d
Driver
.
GetSnapshotClass
()
p
.
vsc
=
s
Driver
.
GetSnapshotClass
()
}
}
}
}
default
:
default
:
...
@@ -213,14 +213,10 @@ func testProvisioning(input *provisioningTestInput) {
...
@@ -213,14 +213,10 @@ func testProvisioning(input *provisioningTestInput) {
if
!
input
.
dInfo
.
Capabilities
[
CapDataSource
]
{
if
!
input
.
dInfo
.
Capabilities
[
CapDataSource
]
{
framework
.
Skipf
(
"Driver %q does not support populate data from snapshot - skipping"
,
input
.
dInfo
.
Name
)
framework
.
Skipf
(
"Driver %q does not support populate data from snapshot - skipping"
,
input
.
dInfo
.
Name
)
}
}
if
input
.
dInfo
.
Name
==
"csi-hostpath-v0"
{
framework
.
Skipf
(
"Driver %q does not support populate data from snapshot - skipping"
,
input
.
dInfo
.
Name
)
}
input
.
testCase
.
SkipWriteReadCheck
=
true
input
.
testCase
.
SkipWriteReadCheck
=
true
dataSource
,
cleanupFunc
:=
prepareDataSourceForProvisioning
(
input
.
testCase
,
input
.
cs
,
input
.
dc
,
input
.
pvc
,
input
.
sc
,
input
.
vsc
)
dataSource
,
cleanupFunc
:=
prepareDataSourceForProvisioning
(
input
.
testCase
,
input
.
cs
,
input
.
dc
,
input
.
pvc
,
input
.
sc
,
input
.
vsc
)
defer
cleanupFunc
()
defer
cleanupFunc
()
framework
.
Logf
(
"volume snapshot dataSource %v"
,
dataSource
)
input
.
pvc
.
Spec
.
DataSource
=
dataSource
input
.
pvc
.
Spec
.
DataSource
=
dataSource
TestDynamicProvisioning
(
input
.
testCase
,
input
.
cs
,
input
.
pvc
,
input
.
sc
)
TestDynamicProvisioning
(
input
.
testCase
,
input
.
cs
,
input
.
pvc
,
input
.
sc
)
...
@@ -233,6 +229,8 @@ func TestDynamicProvisioning(t StorageClassTest, client clientset.Interface, cla
...
@@ -233,6 +229,8 @@ func TestDynamicProvisioning(t StorageClassTest, client clientset.Interface, cla
if
class
!=
nil
{
if
class
!=
nil
{
By
(
"creating a StorageClass "
+
class
.
Name
)
By
(
"creating a StorageClass "
+
class
.
Name
)
_
,
err
=
client
.
StorageV1
()
.
StorageClasses
()
.
Create
(
class
)
_
,
err
=
client
.
StorageV1
()
.
StorageClasses
()
.
Create
(
class
)
// The "should provision storage with snapshot data source" test already has created the class.
// TODO: make class creation optional and remove the IsAlreadyExists exception
Expect
(
err
==
nil
||
apierrs
.
IsAlreadyExists
(
err
))
.
To
(
Equal
(
true
))
Expect
(
err
==
nil
||
apierrs
.
IsAlreadyExists
(
err
))
.
To
(
Equal
(
true
))
class
,
err
=
client
.
StorageV1
()
.
StorageClasses
()
.
Get
(
class
.
Name
,
metav1
.
GetOptions
{})
class
,
err
=
client
.
StorageV1
()
.
StorageClasses
()
.
Get
(
class
.
Name
,
metav1
.
GetOptions
{})
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
...
@@ -297,10 +295,7 @@ func TestDynamicProvisioning(t StorageClassTest, client clientset.Interface, cla
...
@@ -297,10 +295,7 @@ func TestDynamicProvisioning(t StorageClassTest, client clientset.Interface, cla
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
}
}
By
(
fmt
.
Sprintf
(
"xxxxxxx dataSource %v"
,
claim
.
Spec
.
DataSource
))
if
claim
.
Spec
.
DataSource
!=
nil
{
if
claim
.
Spec
.
DataSource
!=
nil
{
framework
.
Logf
(
"check datasource %q/%q"
,
claim
.
Namespace
,
claim
.
Name
)
By
(
"checking the created volume whether has the pre-populated data"
)
By
(
"checking the created volume whether has the pre-populated data"
)
command
:=
fmt
.
Sprintf
(
"grep '%s' /mnt/test/initialData"
,
claim
.
Namespace
)
command
:=
fmt
.
Sprintf
(
"grep '%s' /mnt/test/initialData"
,
claim
.
Namespace
)
runInPodWithVolume
(
client
,
claim
.
Namespace
,
claim
.
Name
,
t
.
NodeName
,
command
,
t
.
NodeSelector
,
t
.
ExpectUnschedulable
)
runInPodWithVolume
(
client
,
claim
.
Namespace
,
claim
.
Name
,
t
.
NodeName
,
command
,
t
.
NodeSelector
,
t
.
ExpectUnschedulable
)
...
...
test/e2e/storage/testsuites/snapshottable.go
View file @
7280fcef
...
@@ -162,8 +162,8 @@ func (s *snapshottableTestResource) setupResource(driver TestDriver, pattern tes
...
@@ -162,8 +162,8 @@ func (s *snapshottableTestResource) setupResource(driver TestDriver, pattern tes
s
.
pvc
.
Spec
.
StorageClassName
=
&
s
.
sc
.
Name
s
.
pvc
.
Spec
.
StorageClassName
=
&
s
.
sc
.
Name
framework
.
Logf
(
"In creating storage class object and pvc object for driver - sc: %v, pvc: %v"
,
s
.
sc
,
s
.
pvc
)
framework
.
Logf
(
"In creating storage class object and pvc object for driver - sc: %v, pvc: %v"
,
s
.
sc
,
s
.
pvc
)
if
d
Driver
,
ok
:=
driver
.
(
SnapshottableTestDriver
);
ok
{
if
s
Driver
,
ok
:=
driver
.
(
SnapshottableTestDriver
);
ok
{
s
.
vsc
=
d
Driver
.
GetSnapshotClass
()
s
.
vsc
=
s
Driver
.
GetSnapshotClass
()
}
}
}
}
...
@@ -189,7 +189,7 @@ type snapshottableTestInput struct {
...
@@ -189,7 +189,7 @@ type snapshottableTestInput struct {
func
testSnapshot
(
input
*
snapshottableTestInput
)
{
func
testSnapshot
(
input
*
snapshottableTestInput
)
{
It
(
"should create snapshot with defaults"
,
func
()
{
It
(
"should create snapshot with defaults"
,
func
()
{
if
input
.
dInfo
.
Name
==
"csi-hostpath-v0"
{
if
input
.
dInfo
.
Name
==
"csi-hostpath-v0"
{
framework
.
Skipf
(
"
Driver %q does not support create snapshot - skipping"
,
input
.
dInfo
.
Name
)
framework
.
Skipf
(
"
skip test when using driver csi-hostpath-v0 - skipping"
)
}
}
TestCreateSnapshot
(
input
.
testCase
,
input
.
cs
,
input
.
dc
,
input
.
pvc
,
input
.
sc
,
input
.
vsc
)
TestCreateSnapshot
(
input
.
testCase
,
input
.
cs
,
input
.
dc
,
input
.
pvc
,
input
.
sc
,
input
.
vsc
)
})
})
...
...
test/e2e/testing-manifests/storage-csi/external-snapshotter/README.md
View file @
7280fcef
The original file is
(or will be)
https://github.com/kubernetes-csi/external-snapshotter/blob/master/deploy/kubernetes/rbac.yaml
The original file is https://github.com/kubernetes-csi/external-snapshotter/blob/master/deploy/kubernetes/rbac.yaml
test/e2e/testing-manifests/storage-csi/external-snapshotter/rbac.yaml
View file @
7280fcef
...
@@ -62,35 +62,4 @@ roleRef:
...
@@ -62,35 +62,4 @@ roleRef:
kind
:
ClusterRole
kind
:
ClusterRole
# change the name also here if the ClusterRole gets renamed
# change the name also here if the ClusterRole gets renamed
name
:
external-snapshotter-runner
name
:
external-snapshotter-runner
apiGroup
:
rbac.authorization.k8s.io
apiGroup
:
rbac.authorization.k8s.io
\ No newline at end of file
---
# napshotter must be able to work with config map in currenSt namespace
# if (and only if) leadership election is enabled
kind
:
Role
apiVersion
:
rbac.authorization.k8s.io/v1
metadata
:
# replace with non-default namespace name
namespace
:
default
name
:
external-snapshotter-cfg
rules
:
-
apiGroups
:
[
"
"
]
resources
:
[
"
configmaps"
]
verbs
:
[
"
get"
,
"
watch"
,
"
list"
,
"
delete"
,
"
update"
,
"
create"
]
---
kind
:
RoleBinding
apiVersion
:
rbac.authorization.k8s.io/v1
metadata
:
name
:
csi-snapshotter-role-cfg
# replace with non-default namespace name
namespace
:
default
subjects
:
-
kind
:
ServiceAccount
name
:
csi-snapshotter
# replace with non-default namespace name
namespace
:
default
roleRef
:
kind
:
Role
name
:
external-snapshotter-cfg
apiGroup
:
rbac.authorization.k8s.io
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