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
812016fa
Unverified
Commit
812016fa
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 #73818 from gnufied/add-e2e-for-no-expand
add e2e test when expansion is disabled
parents
aefd2811
7d823e5d
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
83 additions
and
38 deletions
+83
-38
config-test.sh
cluster/gce/config-test.sh
+1
-1
flexvolume_mounted_volume_resize.go
test/e2e/storage/flexvolume_mounted_volume_resize.go
+11
-2
flexvolume_online_resize.go
test/e2e/storage/flexvolume_online_resize.go
+11
-13
mounted_volume_resize.go
test/e2e/storage/mounted_volume_resize.go
+5
-4
provisioning.go
test/e2e/storage/testsuites/provisioning.go
+11
-10
volume_expand.go
test/e2e/storage/volume_expand.go
+39
-7
volume_provisioning.go
test/e2e/storage/volume_provisioning.go
+5
-1
No files found.
cluster/gce/config-test.sh
View file @
812016fa
...
...
@@ -368,7 +368,7 @@ if [[ -n "${GCE_GLBC_IMAGE:-}" ]]; then
fi
if
[[
-z
"
${
KUBE_ADMISSION_CONTROL
:-}
"
]]
;
then
ADMISSION_CONTROL
=
"NamespaceLifecycle,LimitRanger,ServiceAccount,PersistentVolumeLabel,PodPreset,DefaultStorageClass,DefaultTolerationSeconds,NodeRestriction,Priority,StorageObjectInUseProtection"
ADMISSION_CONTROL
=
"NamespaceLifecycle,LimitRanger,ServiceAccount,PersistentVolumeLabel,PodPreset,DefaultStorageClass,DefaultTolerationSeconds,NodeRestriction,Priority,StorageObjectInUseProtection
,PersistentVolumeClaimResize
"
if
[[
"
${
ENABLE_POD_SECURITY_POLICY
:-}
"
==
"true"
]]
;
then
ADMISSION_CONTROL
=
"
${
ADMISSION_CONTROL
}
,PodSecurityPolicy"
fi
...
...
test/e2e/storage/flexvolume_mounted_volume_resize.go
View file @
812016fa
...
...
@@ -18,6 +18,8 @@ package storage
import
(
"fmt"
"path"
.
"github.com/onsi/ginkgo"
.
"github.com/onsi/gomega"
"k8s.io/api/core/v1"
...
...
@@ -27,8 +29,8 @@ import (
utilerrors
"k8s.io/apimachinery/pkg/util/errors"
clientset
"k8s.io/client-go/kubernetes"
"k8s.io/kubernetes/test/e2e/framework"
"k8s.io/kubernetes/test/e2e/storage/testsuites"
"k8s.io/kubernetes/test/e2e/storage/utils"
"path"
)
var
_
=
utils
.
SIGDescribe
(
"Mounted flexvolume expand[Slow]"
,
func
()
{
...
...
@@ -72,7 +74,14 @@ var _ = utils.SIGDescribe("Mounted flexvolume expand[Slow]", func() {
isNodeLabeled
=
true
}
resizableSc
,
err
=
createStorageClass
(
ns
,
c
)
test
:=
testsuites
.
StorageClassTest
{
Name
:
"flexvolume-resize"
,
ClaimSize
:
"2Gi"
,
AllowVolumeExpansion
:
true
,
Provisioner
:
"flex-expand"
,
}
resizableSc
,
err
=
createStorageClass
(
test
,
ns
,
"resizing"
,
c
)
if
err
!=
nil
{
fmt
.
Printf
(
"storage class creation error: %v
\n
"
,
err
)
}
...
...
test/e2e/storage/flexvolume_online_resize.go
View file @
812016fa
...
...
@@ -18,6 +18,8 @@ package storage
import
(
"fmt"
"path"
.
"github.com/onsi/ginkgo"
.
"github.com/onsi/gomega"
"k8s.io/api/core/v1"
...
...
@@ -26,21 +28,10 @@ import (
utilerrors
"k8s.io/apimachinery/pkg/util/errors"
clientset
"k8s.io/client-go/kubernetes"
"k8s.io/kubernetes/test/e2e/framework"
"k8s.io/kubernetes/test/e2e/storage/testsuites"
"k8s.io/kubernetes/test/e2e/storage/utils"
"path"
)
func
createStorageClass
(
ns
string
,
c
clientset
.
Interface
)
(
*
storage
.
StorageClass
,
error
)
{
bindingMode
:=
storage
.
VolumeBindingImmediate
stKlass
:=
getStorageClass
(
"flex-expand"
,
map
[
string
]
string
{},
&
bindingMode
,
ns
,
"resizing"
)
allowExpansion
:=
true
stKlass
.
AllowVolumeExpansion
=
&
allowExpansion
var
err
error
stKlass
,
err
=
c
.
StorageV1
()
.
StorageClasses
()
.
Create
(
stKlass
)
return
stKlass
,
err
}
var
_
=
utils
.
SIGDescribe
(
"Mounted flexvolume volume expand [Slow] [Feature:ExpandInUsePersistentVolumes]"
,
func
()
{
var
(
c
clientset
.
Interface
...
...
@@ -82,7 +73,14 @@ var _ = utils.SIGDescribe("Mounted flexvolume volume expand [Slow] [Feature:Expa
isNodeLabeled
=
true
}
resizableSc
,
err
=
createStorageClass
(
ns
,
c
)
test
:=
testsuites
.
StorageClassTest
{
Name
:
"flexvolume-resize"
,
ClaimSize
:
"2Gi"
,
AllowVolumeExpansion
:
true
,
Provisioner
:
"flex-expand"
,
}
resizableSc
,
err
=
createStorageClass
(
test
,
ns
,
"resizing"
,
c
)
if
err
!=
nil
{
fmt
.
Printf
(
"storage class creation error: %v
\n
"
,
err
)
}
...
...
test/e2e/storage/mounted_volume_resize.go
View file @
812016fa
...
...
@@ -35,7 +35,7 @@ import (
"k8s.io/kubernetes/test/e2e/storage/utils"
)
var
_
=
utils
.
SIGDescribe
(
"Mounted volume expand
[Slow]
"
,
func
()
{
var
_
=
utils
.
SIGDescribe
(
"Mounted volume expand"
,
func
()
{
var
(
c
clientset
.
Interface
ns
string
...
...
@@ -74,10 +74,11 @@ var _ = utils.SIGDescribe("Mounted volume expand[Slow]", func() {
}
test
:=
testsuites
.
StorageClassTest
{
Name
:
"default"
,
ClaimSize
:
"2Gi"
,
Name
:
"default"
,
ClaimSize
:
"2Gi"
,
AllowVolumeExpansion
:
true
,
}
resizableSc
,
err
=
create
Resizable
StorageClass
(
test
,
ns
,
"resizing"
,
c
)
resizableSc
,
err
=
createStorageClass
(
test
,
ns
,
"resizing"
,
c
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
(),
"Error creating resizable storage class"
)
Expect
(
*
resizableSc
.
AllowVolumeExpansion
)
.
To
(
BeTrue
())
...
...
test/e2e/storage/testsuites/provisioning.go
View file @
812016fa
...
...
@@ -41,16 +41,17 @@ import (
// StorageClassTest represents parameters to be used by provisioning tests.
// Not all parameters are used by all tests.
type
StorageClassTest
struct
{
Name
string
CloudProviders
[]
string
Provisioner
string
StorageClassName
string
Parameters
map
[
string
]
string
DelayBinding
bool
ClaimSize
string
ExpectedSize
string
PvCheck
func
(
claim
*
v1
.
PersistentVolumeClaim
,
volume
*
v1
.
PersistentVolume
)
VolumeMode
*
v1
.
PersistentVolumeMode
Name
string
CloudProviders
[]
string
Provisioner
string
StorageClassName
string
Parameters
map
[
string
]
string
DelayBinding
bool
ClaimSize
string
ExpectedSize
string
PvCheck
func
(
claim
*
v1
.
PersistentVolumeClaim
,
volume
*
v1
.
PersistentVolume
)
VolumeMode
*
v1
.
PersistentVolumeMode
AllowVolumeExpansion
bool
}
type
provisioningTestSuite
struct
{
...
...
test/e2e/storage/volume_expand.go
View file @
812016fa
...
...
@@ -40,7 +40,7 @@ const (
totalResizeWaitPeriod
=
20
*
time
.
Minute
)
var
_
=
utils
.
SIGDescribe
(
"Volume expand
[Slow]
"
,
func
()
{
var
_
=
utils
.
SIGDescribe
(
"Volume expand"
,
func
()
{
var
(
c
clientset
.
Interface
ns
string
...
...
@@ -56,10 +56,11 @@ var _ = utils.SIGDescribe("Volume expand [Slow]", func() {
ns
=
f
.
Namespace
.
Name
framework
.
ExpectNoError
(
framework
.
WaitForAllNodesSchedulable
(
c
,
framework
.
TestContext
.
NodeSchedulableTimeout
))
test
:=
testsuites
.
StorageClassTest
{
Name
:
"default"
,
ClaimSize
:
"2Gi"
,
Name
:
"default"
,
ClaimSize
:
"2Gi"
,
AllowVolumeExpansion
:
true
,
}
resizableSc
,
err
=
create
Resizable
StorageClass
(
test
,
ns
,
"resizing"
,
c
)
resizableSc
,
err
=
createStorageClass
(
test
,
ns
,
"resizing"
,
c
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
(),
"Error creating resizable storage class"
)
Expect
(
resizableSc
.
AllowVolumeExpansion
)
.
NotTo
(
BeNil
())
Expect
(
*
resizableSc
.
AllowVolumeExpansion
)
.
To
(
BeTrue
())
...
...
@@ -75,6 +76,39 @@ var _ = utils.SIGDescribe("Volume expand [Slow]", func() {
framework
.
ExpectNoError
(
c
.
StorageV1
()
.
StorageClasses
()
.
Delete
(
resizableSc
.
Name
,
nil
))
})
It
(
"should not allow expansion of pvcs without AllowVolumeExpansion property"
,
func
()
{
test
:=
testsuites
.
StorageClassTest
{
Name
:
"no-expansion"
,
ClaimSize
:
"2Gi"
,
}
regularSC
,
err
:=
createStorageClass
(
test
,
ns
,
"noexpand"
,
c
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
(),
"Error creating non-expandable storage class"
)
defer
func
()
{
framework
.
ExpectNoError
(
c
.
StorageV1
()
.
StorageClasses
()
.
Delete
(
regularSC
.
Name
,
nil
))
}()
Expect
(
regularSC
.
AllowVolumeExpansion
)
.
To
(
BeNil
())
noExpandPVC
:=
newClaim
(
test
,
ns
,
"noexpand"
)
noExpandPVC
.
Spec
.
StorageClassName
=
&
regularSC
.
Name
noExpandPVC
,
err
=
c
.
CoreV1
()
.
PersistentVolumeClaims
(
noExpandPVC
.
Namespace
)
.
Create
(
noExpandPVC
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
(),
"Error creating pvc"
)
defer
func
()
{
framework
.
ExpectNoError
(
framework
.
DeletePersistentVolumeClaim
(
c
,
noExpandPVC
.
Name
,
noExpandPVC
.
Namespace
))
}()
pvcClaims
:=
[]
*
v1
.
PersistentVolumeClaim
{
noExpandPVC
}
pvs
,
err
:=
framework
.
WaitForPVClaimBoundPhase
(
c
,
pvcClaims
,
framework
.
ClaimProvisionTimeout
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
(),
"Failed waiting for PVC to be bound %v"
,
err
)
Expect
(
len
(
pvs
))
.
To
(
Equal
(
1
))
By
(
"Expanding non-expandable pvc"
)
newSize
:=
resource
.
MustParse
(
"6Gi"
)
noExpandPVC
,
err
=
expandPVCSize
(
noExpandPVC
,
newSize
,
c
)
Expect
(
err
)
.
To
(
HaveOccurred
(),
"While updating non-expandable PVC"
)
})
It
(
"Verify if editing PVC allows resize"
,
func
()
{
By
(
"Waiting for pvc to be in bound phase"
)
pvcClaims
:=
[]
*
v1
.
PersistentVolumeClaim
{
pvc
}
...
...
@@ -134,10 +168,8 @@ var _ = utils.SIGDescribe("Volume expand [Slow]", func() {
})
})
func
create
Resizable
StorageClass
(
t
testsuites
.
StorageClassTest
,
ns
string
,
suffix
string
,
c
clientset
.
Interface
)
(
*
storage
.
StorageClass
,
error
)
{
func
createStorageClass
(
t
testsuites
.
StorageClassTest
,
ns
string
,
suffix
string
,
c
clientset
.
Interface
)
(
*
storage
.
StorageClass
,
error
)
{
stKlass
:=
newStorageClass
(
t
,
ns
,
suffix
)
allowExpansion
:=
true
stKlass
.
AllowVolumeExpansion
=
&
allowExpansion
var
err
error
stKlass
,
err
=
c
.
StorageV1
()
.
StorageClasses
()
.
Create
(
stKlass
)
...
...
test/e2e/storage/volume_provisioning.go
View file @
812016fa
...
...
@@ -1063,7 +1063,11 @@ func newStorageClass(t testsuites.StorageClassTest, ns string, suffix string) *s
if
t
.
DelayBinding
{
bindingMode
=
storage
.
VolumeBindingWaitForFirstConsumer
}
return
getStorageClass
(
pluginName
,
t
.
Parameters
,
&
bindingMode
,
ns
,
suffix
)
sc
:=
getStorageClass
(
pluginName
,
t
.
Parameters
,
&
bindingMode
,
ns
,
suffix
)
if
t
.
AllowVolumeExpansion
{
sc
.
AllowVolumeExpansion
=
&
t
.
AllowVolumeExpansion
}
return
sc
}
func
getStorageClass
(
...
...
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