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
...
@@ -368,7 +368,7 @@ if [[ -n "${GCE_GLBC_IMAGE:-}" ]]; then
fi
fi
if
[[
-z
"
${
KUBE_ADMISSION_CONTROL
:-}
"
]]
;
then
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
if
[[
"
${
ENABLE_POD_SECURITY_POLICY
:-}
"
==
"true"
]]
;
then
ADMISSION_CONTROL
=
"
${
ADMISSION_CONTROL
}
,PodSecurityPolicy"
ADMISSION_CONTROL
=
"
${
ADMISSION_CONTROL
}
,PodSecurityPolicy"
fi
fi
...
...
test/e2e/storage/flexvolume_mounted_volume_resize.go
View file @
812016fa
...
@@ -18,6 +18,8 @@ package storage
...
@@ -18,6 +18,8 @@ package storage
import
(
import
(
"fmt"
"fmt"
"path"
.
"github.com/onsi/ginkgo"
.
"github.com/onsi/ginkgo"
.
"github.com/onsi/gomega"
.
"github.com/onsi/gomega"
"k8s.io/api/core/v1"
"k8s.io/api/core/v1"
...
@@ -27,8 +29,8 @@ import (
...
@@ -27,8 +29,8 @@ import (
utilerrors
"k8s.io/apimachinery/pkg/util/errors"
utilerrors
"k8s.io/apimachinery/pkg/util/errors"
clientset
"k8s.io/client-go/kubernetes"
clientset
"k8s.io/client-go/kubernetes"
"k8s.io/kubernetes/test/e2e/framework"
"k8s.io/kubernetes/test/e2e/framework"
"k8s.io/kubernetes/test/e2e/storage/testsuites"
"k8s.io/kubernetes/test/e2e/storage/utils"
"k8s.io/kubernetes/test/e2e/storage/utils"
"path"
)
)
var
_
=
utils
.
SIGDescribe
(
"Mounted flexvolume expand[Slow]"
,
func
()
{
var
_
=
utils
.
SIGDescribe
(
"Mounted flexvolume expand[Slow]"
,
func
()
{
...
@@ -72,7 +74,14 @@ var _ = utils.SIGDescribe("Mounted flexvolume expand[Slow]", func() {
...
@@ -72,7 +74,14 @@ var _ = utils.SIGDescribe("Mounted flexvolume expand[Slow]", func() {
isNodeLabeled
=
true
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
{
if
err
!=
nil
{
fmt
.
Printf
(
"storage class creation error: %v
\n
"
,
err
)
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
...
@@ -18,6 +18,8 @@ package storage
import
(
import
(
"fmt"
"fmt"
"path"
.
"github.com/onsi/ginkgo"
.
"github.com/onsi/ginkgo"
.
"github.com/onsi/gomega"
.
"github.com/onsi/gomega"
"k8s.io/api/core/v1"
"k8s.io/api/core/v1"
...
@@ -26,21 +28,10 @@ import (
...
@@ -26,21 +28,10 @@ import (
utilerrors
"k8s.io/apimachinery/pkg/util/errors"
utilerrors
"k8s.io/apimachinery/pkg/util/errors"
clientset
"k8s.io/client-go/kubernetes"
clientset
"k8s.io/client-go/kubernetes"
"k8s.io/kubernetes/test/e2e/framework"
"k8s.io/kubernetes/test/e2e/framework"
"k8s.io/kubernetes/test/e2e/storage/testsuites"
"k8s.io/kubernetes/test/e2e/storage/utils"
"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
_
=
utils
.
SIGDescribe
(
"Mounted flexvolume volume expand [Slow] [Feature:ExpandInUsePersistentVolumes]"
,
func
()
{
var
(
var
(
c
clientset
.
Interface
c
clientset
.
Interface
...
@@ -82,7 +73,14 @@ var _ = utils.SIGDescribe("Mounted flexvolume volume expand [Slow] [Feature:Expa
...
@@ -82,7 +73,14 @@ var _ = utils.SIGDescribe("Mounted flexvolume volume expand [Slow] [Feature:Expa
isNodeLabeled
=
true
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
{
if
err
!=
nil
{
fmt
.
Printf
(
"storage class creation error: %v
\n
"
,
err
)
fmt
.
Printf
(
"storage class creation error: %v
\n
"
,
err
)
}
}
...
...
test/e2e/storage/mounted_volume_resize.go
View file @
812016fa
...
@@ -35,7 +35,7 @@ import (
...
@@ -35,7 +35,7 @@ import (
"k8s.io/kubernetes/test/e2e/storage/utils"
"k8s.io/kubernetes/test/e2e/storage/utils"
)
)
var
_
=
utils
.
SIGDescribe
(
"Mounted volume expand
[Slow]
"
,
func
()
{
var
_
=
utils
.
SIGDescribe
(
"Mounted volume expand"
,
func
()
{
var
(
var
(
c
clientset
.
Interface
c
clientset
.
Interface
ns
string
ns
string
...
@@ -74,10 +74,11 @@ var _ = utils.SIGDescribe("Mounted volume expand[Slow]", func() {
...
@@ -74,10 +74,11 @@ var _ = utils.SIGDescribe("Mounted volume expand[Slow]", func() {
}
}
test
:=
testsuites
.
StorageClassTest
{
test
:=
testsuites
.
StorageClassTest
{
Name
:
"default"
,
Name
:
"default"
,
ClaimSize
:
"2Gi"
,
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
(
err
)
.
NotTo
(
HaveOccurred
(),
"Error creating resizable storage class"
)
Expect
(
*
resizableSc
.
AllowVolumeExpansion
)
.
To
(
BeTrue
())
Expect
(
*
resizableSc
.
AllowVolumeExpansion
)
.
To
(
BeTrue
())
...
...
test/e2e/storage/testsuites/provisioning.go
View file @
812016fa
...
@@ -41,16 +41,17 @@ import (
...
@@ -41,16 +41,17 @@ import (
// StorageClassTest represents parameters to be used by provisioning tests.
// StorageClassTest represents parameters to be used by provisioning tests.
// Not all parameters are used by all tests.
// Not all parameters are used by all tests.
type
StorageClassTest
struct
{
type
StorageClassTest
struct
{
Name
string
Name
string
CloudProviders
[]
string
CloudProviders
[]
string
Provisioner
string
Provisioner
string
StorageClassName
string
StorageClassName
string
Parameters
map
[
string
]
string
Parameters
map
[
string
]
string
DelayBinding
bool
DelayBinding
bool
ClaimSize
string
ClaimSize
string
ExpectedSize
string
ExpectedSize
string
PvCheck
func
(
claim
*
v1
.
PersistentVolumeClaim
,
volume
*
v1
.
PersistentVolume
)
PvCheck
func
(
claim
*
v1
.
PersistentVolumeClaim
,
volume
*
v1
.
PersistentVolume
)
VolumeMode
*
v1
.
PersistentVolumeMode
VolumeMode
*
v1
.
PersistentVolumeMode
AllowVolumeExpansion
bool
}
}
type
provisioningTestSuite
struct
{
type
provisioningTestSuite
struct
{
...
...
test/e2e/storage/volume_expand.go
View file @
812016fa
...
@@ -40,7 +40,7 @@ const (
...
@@ -40,7 +40,7 @@ const (
totalResizeWaitPeriod
=
20
*
time
.
Minute
totalResizeWaitPeriod
=
20
*
time
.
Minute
)
)
var
_
=
utils
.
SIGDescribe
(
"Volume expand
[Slow]
"
,
func
()
{
var
_
=
utils
.
SIGDescribe
(
"Volume expand"
,
func
()
{
var
(
var
(
c
clientset
.
Interface
c
clientset
.
Interface
ns
string
ns
string
...
@@ -56,10 +56,11 @@ var _ = utils.SIGDescribe("Volume expand [Slow]", func() {
...
@@ -56,10 +56,11 @@ var _ = utils.SIGDescribe("Volume expand [Slow]", func() {
ns
=
f
.
Namespace
.
Name
ns
=
f
.
Namespace
.
Name
framework
.
ExpectNoError
(
framework
.
WaitForAllNodesSchedulable
(
c
,
framework
.
TestContext
.
NodeSchedulableTimeout
))
framework
.
ExpectNoError
(
framework
.
WaitForAllNodesSchedulable
(
c
,
framework
.
TestContext
.
NodeSchedulableTimeout
))
test
:=
testsuites
.
StorageClassTest
{
test
:=
testsuites
.
StorageClassTest
{
Name
:
"default"
,
Name
:
"default"
,
ClaimSize
:
"2Gi"
,
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
(
err
)
.
NotTo
(
HaveOccurred
(),
"Error creating resizable storage class"
)
Expect
(
resizableSc
.
AllowVolumeExpansion
)
.
NotTo
(
BeNil
())
Expect
(
resizableSc
.
AllowVolumeExpansion
)
.
NotTo
(
BeNil
())
Expect
(
*
resizableSc
.
AllowVolumeExpansion
)
.
To
(
BeTrue
())
Expect
(
*
resizableSc
.
AllowVolumeExpansion
)
.
To
(
BeTrue
())
...
@@ -75,6 +76,39 @@ var _ = utils.SIGDescribe("Volume expand [Slow]", func() {
...
@@ -75,6 +76,39 @@ var _ = utils.SIGDescribe("Volume expand [Slow]", func() {
framework
.
ExpectNoError
(
c
.
StorageV1
()
.
StorageClasses
()
.
Delete
(
resizableSc
.
Name
,
nil
))
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
()
{
It
(
"Verify if editing PVC allows resize"
,
func
()
{
By
(
"Waiting for pvc to be in bound phase"
)
By
(
"Waiting for pvc to be in bound phase"
)
pvcClaims
:=
[]
*
v1
.
PersistentVolumeClaim
{
pvc
}
pvcClaims
:=
[]
*
v1
.
PersistentVolumeClaim
{
pvc
}
...
@@ -134,10 +168,8 @@ var _ = utils.SIGDescribe("Volume expand [Slow]", func() {
...
@@ -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
)
stKlass
:=
newStorageClass
(
t
,
ns
,
suffix
)
allowExpansion
:=
true
stKlass
.
AllowVolumeExpansion
=
&
allowExpansion
var
err
error
var
err
error
stKlass
,
err
=
c
.
StorageV1
()
.
StorageClasses
()
.
Create
(
stKlass
)
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
...
@@ -1063,7 +1063,11 @@ func newStorageClass(t testsuites.StorageClassTest, ns string, suffix string) *s
if
t
.
DelayBinding
{
if
t
.
DelayBinding
{
bindingMode
=
storage
.
VolumeBindingWaitForFirstConsumer
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
(
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