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
69b52633
Unverified
Commit
69b52633
authored
May 09, 2019
by
Kubernetes Prow Robot
Committed by
GitHub
May 09, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #77605 from pohly/multivolume-storage-class-fix
Multivolume storage class fix
parents
8efea56a
093027c8
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
29 additions
and
32 deletions
+29
-32
BUILD
test/e2e/framework/BUILD
+0
-1
create.go
test/e2e/framework/create.go
+21
-31
BUILD
test/e2e/storage/external/BUILD
+1
-0
external.go
test/e2e/storage/external/external.go
+4
-0
testdriver.go
test/e2e/storage/testsuites/testdriver.go
+3
-0
No files found.
test/e2e/framework/BUILD
View file @
69b52633
...
...
@@ -90,7 +90,6 @@ go_library(
"//staging/src/k8s.io/apimachinery/pkg/util/yaml:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/watch:go_default_library",
"//staging/src/k8s.io/apiserver/pkg/authentication/serviceaccount:go_default_library",
"//staging/src/k8s.io/apiserver/pkg/storage/names:go_default_library",
"//staging/src/k8s.io/apiserver/pkg/util/feature:go_default_library",
"//staging/src/k8s.io/client-go/discovery:go_default_library",
"//staging/src/k8s.io/client-go/discovery/cached/memory:go_default_library",
...
...
test/e2e/framework/create.go
View file @
69b52633
...
...
@@ -31,7 +31,6 @@ import (
metav1
"k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apiserver/pkg/storage/names"
"k8s.io/client-go/kubernetes/scheme"
"k8s.io/client-go/tools/cache"
"k8s.io/kubernetes/test/e2e/framework/testfiles"
...
...
@@ -101,9 +100,9 @@ func visitManifests(cb func([]byte) error, files ...string) error {
return
nil
}
// PatchItems modifies the given items in place such that each
//
test gets its own instances, to avoid conflicts between different tests and
// between tests and normal deployments.
// PatchItems modifies the given items in place such that each
test
//
gets its own instances, to avoid conflicts between different tests
//
and
between tests and normal deployments.
//
// This is done by:
// - creating namespaced items inside the test's namespace
...
...
@@ -288,27 +287,18 @@ var factories = map[What]ItemFactory{
{
"StorageClass"
}
:
&
storageClassFactory
{},
}
//
uniquifyName makes the name of some item unique per namespac
e by appending the
// generated unique name
of the test namespace
.
func
(
f
*
Framework
)
uniquify
Name
(
item
*
string
)
{
//
PatchName makes the name of some item uniqu
e by appending the
// generated unique name.
func
(
f
*
Framework
)
Patch
Name
(
item
*
string
)
{
if
*
item
!=
""
{
*
item
=
*
item
+
"-"
+
f
.
UniqueName
}
}
// randomizeStorageClassName makes the name of the storage class unique per call
// by appending the generated unique name of the test namespace and a random 5
// character string
func
(
f
*
Framework
)
randomizeStorageClassName
(
item
*
string
)
{
if
*
item
!=
""
{
*
item
=
names
.
SimpleNameGenerator
.
GenerateName
(
*
item
+
"-"
+
f
.
UniqueName
+
"-"
)
}
}
// patchNamespace moves the item into the test's namespace. Not
// PatchNamespace moves the item into the test's namespace. Not
// all items can be namespaced. For those, the name also needs to be
// patched.
func
(
f
*
Framework
)
p
atchNamespace
(
item
*
string
)
{
func
(
f
*
Framework
)
P
atchNamespace
(
item
*
string
)
{
if
f
.
Namespace
!=
nil
{
*
item
=
f
.
Namespace
.
GetName
()
}
...
...
@@ -317,31 +307,31 @@ func (f *Framework) patchNamespace(item *string) {
func
(
f
*
Framework
)
patchItemRecursively
(
item
interface
{})
error
{
switch
item
:=
item
.
(
type
)
{
case
*
rbac
.
Subject
:
f
.
p
atchNamespace
(
&
item
.
Namespace
)
f
.
P
atchNamespace
(
&
item
.
Namespace
)
case
*
rbac
.
RoleRef
:
// TODO: avoid hard-coding this special name. Perhaps add a Framework.PredefinedRoles
// which contains all role names that are defined cluster-wide before the test starts?
// All those names are excempt from renaming. That list could be populated by querying
// and get extended by tests.
if
item
.
Name
!=
"e2e-test-privileged-psp"
{
f
.
uniquify
Name
(
&
item
.
Name
)
f
.
Patch
Name
(
&
item
.
Name
)
}
case
*
rbac
.
ClusterRole
:
f
.
uniquify
Name
(
&
item
.
Name
)
f
.
Patch
Name
(
&
item
.
Name
)
case
*
rbac
.
Role
:
f
.
p
atchNamespace
(
&
item
.
Namespace
)
f
.
P
atchNamespace
(
&
item
.
Namespace
)
// Roles are namespaced, but because for RoleRef above we don't
// know whether the referenced role is a ClusterRole or Role
// and therefore always renames, we have to do the same here.
f
.
uniquify
Name
(
&
item
.
Name
)
f
.
Patch
Name
(
&
item
.
Name
)
case
*
storage
.
StorageClass
:
f
.
randomizeStorageClass
Name
(
&
item
.
Name
)
f
.
Patch
Name
(
&
item
.
Name
)
case
*
v1
.
ServiceAccount
:
f
.
p
atchNamespace
(
&
item
.
ObjectMeta
.
Namespace
)
f
.
P
atchNamespace
(
&
item
.
ObjectMeta
.
Namespace
)
case
*
v1
.
Secret
:
f
.
p
atchNamespace
(
&
item
.
ObjectMeta
.
Namespace
)
f
.
P
atchNamespace
(
&
item
.
ObjectMeta
.
Namespace
)
case
*
rbac
.
ClusterRoleBinding
:
f
.
uniquify
Name
(
&
item
.
Name
)
f
.
Patch
Name
(
&
item
.
Name
)
for
i
:=
range
item
.
Subjects
{
if
err
:=
f
.
patchItemRecursively
(
&
item
.
Subjects
[
i
]);
err
!=
nil
{
return
errors
.
Wrapf
(
err
,
"%T"
,
f
)
...
...
@@ -351,7 +341,7 @@ func (f *Framework) patchItemRecursively(item interface{}) error {
return
errors
.
Wrapf
(
err
,
"%T"
,
f
)
}
case
*
rbac
.
RoleBinding
:
f
.
p
atchNamespace
(
&
item
.
Namespace
)
f
.
P
atchNamespace
(
&
item
.
Namespace
)
for
i
:=
range
item
.
Subjects
{
if
err
:=
f
.
patchItemRecursively
(
&
item
.
Subjects
[
i
]);
err
!=
nil
{
return
errors
.
Wrapf
(
err
,
"%T"
,
f
)
...
...
@@ -361,11 +351,11 @@ func (f *Framework) patchItemRecursively(item interface{}) error {
return
errors
.
Wrapf
(
err
,
"%T"
,
f
)
}
case
*
v1
.
Service
:
f
.
p
atchNamespace
(
&
item
.
ObjectMeta
.
Namespace
)
f
.
P
atchNamespace
(
&
item
.
ObjectMeta
.
Namespace
)
case
*
apps
.
StatefulSet
:
f
.
p
atchNamespace
(
&
item
.
ObjectMeta
.
Namespace
)
f
.
P
atchNamespace
(
&
item
.
ObjectMeta
.
Namespace
)
case
*
apps
.
DaemonSet
:
f
.
p
atchNamespace
(
&
item
.
ObjectMeta
.
Namespace
)
f
.
P
atchNamespace
(
&
item
.
ObjectMeta
.
Namespace
)
default
:
return
errors
.
Errorf
(
"missing support for patching item of type %T"
,
item
)
}
...
...
test/e2e/storage/external/BUILD
View file @
69b52633
...
...
@@ -11,6 +11,7 @@ go_library(
"//staging/src/k8s.io/apimachinery/pkg/runtime:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/util/sets:go_default_library",
"//staging/src/k8s.io/apiserver/pkg/storage/names:go_default_library",
"//staging/src/k8s.io/client-go/kubernetes/scheme:go_default_library",
"//test/e2e/framework:go_default_library",
"//test/e2e/storage/testpatterns:go_default_library",
...
...
test/e2e/storage/external/external.go
View file @
69b52633
...
...
@@ -27,6 +27,7 @@ import (
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/util/sets"
"k8s.io/apiserver/pkg/storage/names"
"k8s.io/client-go/kubernetes/scheme"
"k8s.io/kubernetes/test/e2e/framework"
"k8s.io/kubernetes/test/e2e/storage/testpatterns"
...
...
@@ -242,6 +243,9 @@ func (d *driverDefinition) GetDynamicProvisionStorageClass(config *testsuites.Pe
sc
,
ok
:=
items
[
0
]
.
(
*
storagev1
.
StorageClass
)
gomega
.
Expect
(
ok
)
.
To
(
gomega
.
BeTrue
(),
"storage class from %s"
,
d
.
StorageClass
.
FromFile
)
// Ensure that we can load more than once as required for
// GetDynamicProvisionStorageClass by adding a random suffix.
sc
.
Name
=
names
.
SimpleNameGenerator
.
GenerateName
(
sc
.
Name
+
"-"
)
if
fsType
!=
""
{
if
sc
.
Parameters
==
nil
{
sc
.
Parameters
=
map
[
string
]
string
{}
...
...
test/e2e/storage/testsuites/testdriver.go
View file @
69b52633
...
...
@@ -88,6 +88,9 @@ type PreprovisionedPVTestDriver interface {
type
DynamicPVTestDriver
interface
{
TestDriver
// GetDynamicProvisionStorageClass returns a StorageClass dynamic provision Persistent Volume.
// The StorageClass must be created in the current test's namespace and have
// a unique name inside that namespace because GetDynamicProvisionStorageClass might
// be called more than once per test.
// It will set fsType to the StorageClass, if TestDriver supports it.
// It will return nil, if the TestDriver doesn't support it.
GetDynamicProvisionStorageClass
(
config
*
PerTestConfig
,
fsType
string
)
*
storagev1
.
StorageClass
...
...
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