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
e3faa003
Commit
e3faa003
authored
Feb 07, 2019
by
Hemant Kumar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add e2e test when expansion is disabled
Also refactor some of the code that creates resizable SC
parent
7944fed4
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
64 additions
and
20 deletions
+64
-20
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
+2
-1
provisioning.go
test/e2e/storage/testsuites/provisioning.go
+1
-0
volume_expand.go
test/e2e/storage/volume_expand.go
+39
-4
No files found.
test/e2e/storage/flexvolume_mounted_volume_resize.go
View file @
e3faa003
...
@@ -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 @
e3faa003
...
@@ -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 @
e3faa003
...
@@ -76,8 +76,9 @@ var _ = utils.SIGDescribe("Mounted volume expand[Slow]", func() {
...
@@ -76,8 +76,9 @@ 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 @
e3faa003
...
@@ -51,6 +51,7 @@ type StorageClassTest struct {
...
@@ -51,6 +51,7 @@ type StorageClassTest struct {
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 @
e3faa003
...
@@ -58,8 +58,9 @@ var _ = utils.SIGDescribe("Volume expand [Slow]", func() {
...
@@ -58,8 +58,9 @@ var _ = utils.SIGDescribe("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
)
.
NotTo
(
BeNil
())
Expect
(
resizableSc
.
AllowVolumeExpansion
)
.
NotTo
(
BeNil
())
Expect
(
*
resizableSc
.
AllowVolumeExpansion
)
.
To
(
BeTrue
())
Expect
(
*
resizableSc
.
AllowVolumeExpansion
)
.
To
(
BeTrue
())
...
@@ -75,6 +76,42 @@ var _ = utils.SIGDescribe("Volume expand [Slow]", func() {
...
@@ -75,6 +76,42 @@ 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"
,
AllowVolumeExpansion
:
false
,
}
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
)
.
NotTo
(
BeNil
())
Expect
(
*
resizableSc
.
AllowVolumeExpansion
)
.
To
(
BeFalse
())
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"
)
pvc
,
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 +171,8 @@ var _ = utils.SIGDescribe("Volume expand [Slow]", func() {
...
@@ -134,10 +171,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
)
...
...
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