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
8823c229
Commit
8823c229
authored
Feb 13, 2018
by
Divyen Patel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Addressed review comments
parent
c0490fa6
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
37 additions
and
53 deletions
+37
-53
volumes.go
test/e2e/storage/volumes.go
+1
-4
bootstrap.go
test/e2e/storage/vsphere/bootstrap.go
+6
-3
pv_reclaimpolicy.go
test/e2e/storage/vsphere/pv_reclaimpolicy.go
+1
-5
pvc_label_selector.go
test/e2e/storage/vsphere/pvc_label_selector.go
+1
-5
vsphere_utils.go
test/e2e/storage/vsphere/vsphere_utils.go
+20
-16
vsphere_volume_cluster_ds.go
test/e2e/storage/vsphere/vsphere_volume_cluster_ds.go
+1
-8
vsphere_volume_diskformat.go
test/e2e/storage/vsphere/vsphere_volume_diskformat.go
+1
-9
vsphere_volume_fstype.go
test/e2e/storage/vsphere/vsphere_volume_fstype.go
+4
-1
vsphere_volume_placement.go
test/e2e/storage/vsphere/vsphere_volume_placement.go
+2
-2
No files found.
test/e2e/storage/volumes.go
View file @
8823c229
...
@@ -504,10 +504,7 @@ var _ = utils.SIGDescribe("Volumes", func() {
...
@@ -504,10 +504,7 @@ var _ = utils.SIGDescribe("Volumes", func() {
It
(
"should be mountable"
,
func
()
{
It
(
"should be mountable"
,
func
()
{
framework
.
SkipUnlessProviderIs
(
"vsphere"
)
framework
.
SkipUnlessProviderIs
(
"vsphere"
)
vspheretest
.
Bootstrap
(
f
)
vspheretest
.
Bootstrap
(
f
)
nodeList
:=
framework
.
GetReadySchedulableNodesOrDie
(
f
.
ClientSet
)
nodeInfo
:=
vspheretest
.
GetReadySchedulableRandomNodeInfo
()
Expect
(
nodeList
.
Items
)
.
NotTo
(
BeEmpty
(),
"Unable to find ready and schedulable Node"
)
nodeInfo
:=
vspheretest
.
TestContext
.
NodeMapper
.
GetNodeInfo
(
nodeList
.
Items
[
0
]
.
Name
)
var
volumePath
string
var
volumePath
string
config
:=
framework
.
VolumeTestConfig
{
config
:=
framework
.
VolumeTestConfig
{
Namespace
:
namespace
.
Name
,
Namespace
:
namespace
.
Name
,
...
...
test/e2e/storage/vsphere/bootstrap.go
View file @
8823c229
...
@@ -17,6 +17,7 @@ limitations under the License.
...
@@ -17,6 +17,7 @@ limitations under the License.
package
vsphere
package
vsphere
import
(
import
(
metav1
"k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/kubernetes/test/e2e/framework"
"k8s.io/kubernetes/test/e2e/framework"
"sync"
"sync"
)
)
...
@@ -43,10 +44,12 @@ func bootstrapOnce() {
...
@@ -43,10 +44,12 @@ func bootstrapOnce() {
if
err
!=
nil
{
if
err
!=
nil
{
framework
.
Failf
(
"Failed to bootstrap vSphere with error: %v"
,
err
)
framework
.
Failf
(
"Failed to bootstrap vSphere with error: %v"
,
err
)
}
}
// 2. Get all ready nodes
// 2. Get all nodes
nodeList
:=
framework
.
GetReadySchedulableNodesOrDie
(
f
.
ClientSet
)
nodeList
,
err
:=
f
.
ClientSet
.
CoreV1
()
.
Nodes
()
.
List
(
metav1
.
ListOptions
{})
if
err
!=
nil
{
framework
.
Failf
(
"Failed to get nodes: %v"
,
err
)
}
TestContext
=
VSphereContext
{
NodeMapper
:
&
NodeMapper
{},
VSphereInstances
:
vsphereInstances
}
TestContext
=
VSphereContext
{
NodeMapper
:
&
NodeMapper
{},
VSphereInstances
:
vsphereInstances
}
// 3. Get Node to VSphere mapping
// 3. Get Node to VSphere mapping
err
=
TestContext
.
NodeMapper
.
GenerateNodeMap
(
vsphereInstances
,
*
nodeList
)
err
=
TestContext
.
NodeMapper
.
GenerateNodeMap
(
vsphereInstances
,
*
nodeList
)
if
err
!=
nil
{
if
err
!=
nil
{
...
...
test/e2e/storage/vsphere/pv_reclaimpolicy.go
View file @
8823c229
...
@@ -51,11 +51,7 @@ var _ = utils.SIGDescribe("PersistentVolumes [Feature:ReclaimPolicy]", func() {
...
@@ -51,11 +51,7 @@ var _ = utils.SIGDescribe("PersistentVolumes [Feature:ReclaimPolicy]", func() {
BeforeEach
(
func
()
{
BeforeEach
(
func
()
{
framework
.
SkipUnlessProviderIs
(
"vsphere"
)
framework
.
SkipUnlessProviderIs
(
"vsphere"
)
Bootstrap
(
f
)
Bootstrap
(
f
)
nodes
:=
framework
.
GetReadySchedulableNodesOrDie
(
c
)
nodeInfo
=
GetReadySchedulableRandomNodeInfo
()
if
len
(
nodes
.
Items
)
<
1
{
framework
.
Skipf
(
"Requires at least %d node"
,
1
)
}
nodeInfo
=
TestContext
.
NodeMapper
.
GetNodeInfo
(
nodes
.
Items
[
0
]
.
Name
)
pv
=
nil
pv
=
nil
pvc
=
nil
pvc
=
nil
volumePath
=
""
volumePath
=
""
...
...
test/e2e/storage/vsphere/pvc_label_selector.go
View file @
8823c229
...
@@ -63,11 +63,7 @@ var _ = utils.SIGDescribe("PersistentVolumes [Feature:LabelSelector]", func() {
...
@@ -63,11 +63,7 @@ var _ = utils.SIGDescribe("PersistentVolumes [Feature:LabelSelector]", func() {
c
=
f
.
ClientSet
c
=
f
.
ClientSet
ns
=
f
.
Namespace
.
Name
ns
=
f
.
Namespace
.
Name
Bootstrap
(
f
)
Bootstrap
(
f
)
nodes
:=
framework
.
GetReadySchedulableNodesOrDie
(
c
)
nodeInfo
=
GetReadySchedulableRandomNodeInfo
()
if
len
(
nodes
.
Items
)
<
1
{
framework
.
Skipf
(
"Requires at least %d node"
,
1
)
}
nodeInfo
=
TestContext
.
NodeMapper
.
GetNodeInfo
(
nodes
.
Items
[
0
]
.
Name
)
framework
.
ExpectNoError
(
framework
.
WaitForAllNodesSchedulable
(
c
,
framework
.
TestContext
.
NodeSchedulableTimeout
))
framework
.
ExpectNoError
(
framework
.
WaitForAllNodesSchedulable
(
c
,
framework
.
TestContext
.
NodeSchedulableTimeout
))
ssdlabels
=
make
(
map
[
string
]
string
)
ssdlabels
=
make
(
map
[
string
]
string
)
ssdlabels
[
"volume-type"
]
=
"ssd"
ssdlabels
[
"volume-type"
]
=
"ssd"
...
...
test/e2e/storage/vsphere/vsphere_utils.go
View file @
8823c229
...
@@ -18,6 +18,7 @@ package vsphere
...
@@ -18,6 +18,7 @@ package vsphere
import
(
import
(
"fmt"
"fmt"
"math/rand"
"path/filepath"
"path/filepath"
"time"
"time"
...
@@ -513,18 +514,6 @@ func removeStorageClusterORFolderNameFromVDiskPath(vDiskPath string) string {
...
@@ -513,18 +514,6 @@ func removeStorageClusterORFolderNameFromVDiskPath(vDiskPath string) string {
return
vDiskPath
return
vDiskPath
}
}
// isDiskAttached checks if disk is attached to the VM.
func
isDiskAttached
(
ctx
context
.
Context
,
vm
*
object
.
VirtualMachine
,
diskPath
string
)
(
bool
,
error
)
{
device
,
err
:=
getVirtualDeviceByPath
(
ctx
,
vm
,
diskPath
)
if
err
!=
nil
{
return
false
,
err
}
if
device
!=
nil
{
return
true
,
nil
}
return
false
,
nil
}
// getVirtualDeviceByPath gets the virtual device by path
// getVirtualDeviceByPath gets the virtual device by path
func
getVirtualDeviceByPath
(
ctx
context
.
Context
,
vm
*
object
.
VirtualMachine
,
diskPath
string
)
(
vim25types
.
BaseVirtualDevice
,
error
)
{
func
getVirtualDeviceByPath
(
ctx
context
.
Context
,
vm
*
object
.
VirtualMachine
,
diskPath
string
)
(
vim25types
.
BaseVirtualDevice
,
error
)
{
vmDevices
,
err
:=
vm
.
Device
(
ctx
)
vmDevices
,
err
:=
vm
.
Device
(
ctx
)
...
@@ -541,6 +530,8 @@ func getVirtualDeviceByPath(ctx context.Context, vm *object.VirtualMachine, disk
...
@@ -541,6 +530,8 @@ func getVirtualDeviceByPath(ctx context.Context, vm *object.VirtualMachine, disk
if
matchVirtualDiskAndVolPath
(
backing
.
FileName
,
diskPath
)
{
if
matchVirtualDiskAndVolPath
(
backing
.
FileName
,
diskPath
)
{
framework
.
Logf
(
"Found VirtualDisk backing with filename %q for diskPath %q"
,
backing
.
FileName
,
diskPath
)
framework
.
Logf
(
"Found VirtualDisk backing with filename %q for diskPath %q"
,
backing
.
FileName
,
diskPath
)
return
device
,
nil
return
device
,
nil
}
else
{
framework
.
Logf
(
"VirtualDisk backing filename %q does not match with diskPath %q"
,
backing
.
FileName
,
diskPath
)
}
}
}
}
}
}
...
@@ -715,21 +706,34 @@ func diskIsAttached(volPath string, nodeName string) (bool, error) {
...
@@ -715,21 +706,34 @@ func diskIsAttached(volPath string, nodeName string) (bool, error) {
// Create context
// Create context
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
ctx
,
cancel
:=
context
.
WithCancel
(
context
.
Background
())
defer
cancel
()
defer
cancel
()
nodeInfo
:=
TestContext
.
NodeMapper
.
GetNodeInfo
(
nodeName
)
nodeInfo
:=
TestContext
.
NodeMapper
.
GetNodeInfo
(
nodeName
)
Connect
(
ctx
,
nodeInfo
.
VSphere
)
Connect
(
ctx
,
nodeInfo
.
VSphere
)
vm
:=
object
.
NewVirtualMachine
(
nodeInfo
.
VSphere
.
Client
.
Client
,
nodeInfo
.
VirtualMachineRef
)
vm
:=
object
.
NewVirtualMachine
(
nodeInfo
.
VSphere
.
Client
.
Client
,
nodeInfo
.
VirtualMachineRef
)
volPath
=
removeStorageClusterORFolderNameFromVDiskPath
(
volPath
)
volPath
=
removeStorageClusterORFolderNameFromVDiskPath
(
volPath
)
attached
,
err
:=
isDiskAttached
(
ctx
,
vm
,
volPath
)
device
,
err
:=
getVirtualDeviceByPath
(
ctx
,
vm
,
volPath
)
if
err
!=
nil
{
if
err
!=
nil
{
framework
.
Logf
(
"diskIsAttached failed to determine whether disk %q is still attached on node %q"
,
framework
.
Logf
(
"diskIsAttached failed to determine whether disk %q is still attached on node %q"
,
volPath
,
volPath
,
nodeName
)
nodeName
)
return
false
,
err
}
if
device
!=
nil
{
framework
.
Logf
(
"diskIsAttached found the disk %q attached on node %q"
,
volPath
,
nodeName
)
}
}
framework
.
Logf
(
"diskIsAttached result: %v and error: %v, for volume: %s"
,
attached
,
err
,
volPath
)
return
true
,
nil
return
attached
,
err
}
}
func
getUUIDFromProviderID
(
providerID
string
)
string
{
func
getUUIDFromProviderID
(
providerID
string
)
string
{
return
strings
.
TrimPrefix
(
providerID
,
ProviderPrefix
)
return
strings
.
TrimPrefix
(
providerID
,
ProviderPrefix
)
}
}
func
GetReadySchedulableRandomNodeInfo
()
*
NodeInfo
{
nodeList
:=
framework
.
GetReadySchedulableNodesOrDie
(
f
.
ClientSet
)
Expect
(
nodeList
.
Items
)
.
NotTo
(
BeEmpty
(),
"Unable to find ready and schedulable Node"
)
rand
.
Seed
(
time
.
Now
()
.
Unix
())
nodeInfo
:=
TestContext
.
NodeMapper
.
GetNodeInfo
(
nodeList
.
Items
[
rand
.
Int
()
%
len
(
nodeList
.
Items
)]
.
Name
)
Expect
(
nodeInfo
)
.
NotTo
(
BeNil
())
return
nodeInfo
}
test/e2e/storage/vsphere/vsphere_volume_cluster_ds.go
View file @
8823c229
...
@@ -18,9 +18,6 @@ package vsphere
...
@@ -18,9 +18,6 @@ package vsphere
import
(
import
(
"fmt"
"fmt"
"math/rand"
"time"
.
"github.com/onsi/ginkgo"
.
"github.com/onsi/ginkgo"
.
"github.com/onsi/gomega"
.
"github.com/onsi/gomega"
metav1
"k8s.io/apimachinery/pkg/apis/meta/v1"
metav1
"k8s.io/apimachinery/pkg/apis/meta/v1"
...
@@ -55,11 +52,7 @@ var _ = utils.SIGDescribe("Volume Provisioning On Clustered Datastore [Feature:v
...
@@ -55,11 +52,7 @@ var _ = utils.SIGDescribe("Volume Provisioning On Clustered Datastore [Feature:v
Bootstrap
(
f
)
Bootstrap
(
f
)
client
=
f
.
ClientSet
client
=
f
.
ClientSet
namespace
=
f
.
Namespace
.
Name
namespace
=
f
.
Namespace
.
Name
nodeList
:=
framework
.
GetReadySchedulableNodesOrDie
(
f
.
ClientSet
)
nodeInfo
=
GetReadySchedulableRandomNodeInfo
()
Expect
(
nodeList
.
Items
)
.
NotTo
(
BeEmpty
(),
"Unable to find ready and schedulable Node"
)
rand
.
Seed
(
time
.
Now
()
.
Unix
())
nodeInfo
=
TestContext
.
NodeMapper
.
GetNodeInfo
(
nodeList
.
Items
[
rand
.
Int
()
%
len
(
nodeList
.
Items
)]
.
Name
)
scParameters
=
make
(
map
[
string
]
string
)
scParameters
=
make
(
map
[
string
]
string
)
clusterDatastore
=
GetAndExpectStringEnvVar
(
VCPClusterDatastore
)
clusterDatastore
=
GetAndExpectStringEnvVar
(
VCPClusterDatastore
)
})
})
...
...
test/e2e/storage/vsphere/vsphere_volume_diskformat.go
View file @
8823c229
...
@@ -17,9 +17,7 @@ limitations under the License.
...
@@ -17,9 +17,7 @@ limitations under the License.
package
vsphere
package
vsphere
import
(
import
(
"math/rand"
"path/filepath"
"path/filepath"
"time"
.
"github.com/onsi/ginkgo"
.
"github.com/onsi/ginkgo"
.
"github.com/onsi/gomega"
.
"github.com/onsi/gomega"
...
@@ -70,14 +68,8 @@ var _ = utils.SIGDescribe("Volume Disk Format [Feature:vsphere]", func() {
...
@@ -70,14 +68,8 @@ var _ = utils.SIGDescribe("Volume Disk Format [Feature:vsphere]", func() {
Bootstrap
(
f
)
Bootstrap
(
f
)
client
=
f
.
ClientSet
client
=
f
.
ClientSet
namespace
=
f
.
Namespace
.
Name
namespace
=
f
.
Namespace
.
Name
nodeList
:=
framework
.
GetReadySchedulableNodesOrDie
(
f
.
ClientSet
)
if
len
(
nodeList
.
Items
)
!=
0
{
rand
.
Seed
(
time
.
Now
()
.
Unix
())
nodeName
=
nodeList
.
Items
[
rand
.
Int
()
%
len
(
nodeList
.
Items
)]
.
Name
}
else
{
framework
.
Failf
(
"Unable to find ready and schedulable Node"
)
}
if
!
isNodeLabeled
{
if
!
isNodeLabeled
{
nodeName
=
GetReadySchedulableRandomNodeInfo
()
.
Name
nodeLabelValue
=
"vsphere_e2e_"
+
string
(
uuid
.
NewUUID
())
nodeLabelValue
=
"vsphere_e2e_"
+
string
(
uuid
.
NewUUID
())
nodeKeyValueLabel
=
make
(
map
[
string
]
string
)
nodeKeyValueLabel
=
make
(
map
[
string
]
string
)
nodeKeyValueLabel
[
NodeLabelKey
]
=
nodeLabelValue
nodeKeyValueLabel
[
NodeLabelKey
]
=
nodeLabelValue
...
...
test/e2e/storage/vsphere/vsphere_volume_fstype.go
View file @
8823c229
...
@@ -175,11 +175,14 @@ func createPodAndVerifyVolumeAccessible(client clientset.Interface, namespace st
...
@@ -175,11 +175,14 @@ func createPodAndVerifyVolumeAccessible(client clientset.Interface, namespace st
}
}
func
detachVolume
(
f
*
framework
.
Framework
,
client
clientset
.
Interface
,
pod
*
v1
.
Pod
,
volPath
string
)
{
func
detachVolume
(
f
*
framework
.
Framework
,
client
clientset
.
Interface
,
pod
*
v1
.
Pod
,
volPath
string
)
{
pod
,
err
:=
f
.
ClientSet
.
CoreV1
()
.
Pods
(
pod
.
Namespace
)
.
Get
(
pod
.
Name
,
metav1
.
GetOptions
{})
Expect
(
err
)
.
To
(
BeNil
())
nodeName
:=
pod
.
Spec
.
NodeName
By
(
"Deleting pod"
)
By
(
"Deleting pod"
)
framework
.
DeletePodWithWait
(
f
,
client
,
pod
)
framework
.
DeletePodWithWait
(
f
,
client
,
pod
)
By
(
"Waiting for volumes to be detached from the node"
)
By
(
"Waiting for volumes to be detached from the node"
)
waitForVSphereDiskToDetach
(
volPath
,
pod
.
Spec
.
N
odeName
)
waitForVSphereDiskToDetach
(
volPath
,
n
odeName
)
}
}
func
deleteVolume
(
client
clientset
.
Interface
,
pvclaimName
string
,
namespace
string
)
{
func
deleteVolume
(
client
clientset
.
Interface
,
pvclaimName
string
,
namespace
string
)
{
...
...
test/e2e/storage/vsphere/vsphere_volume_placement.go
View file @
8823c229
...
@@ -56,9 +56,9 @@ var _ = utils.SIGDescribe("Volume Placement", func() {
...
@@ -56,9 +56,9 @@ var _ = utils.SIGDescribe("Volume Placement", func() {
if
!
isNodeLabeled
{
if
!
isNodeLabeled
{
node1Name
,
node1KeyValueLabel
,
node2Name
,
node2KeyValueLabel
=
testSetupVolumePlacement
(
c
,
ns
)
node1Name
,
node1KeyValueLabel
,
node2Name
,
node2KeyValueLabel
=
testSetupVolumePlacement
(
c
,
ns
)
isNodeLabeled
=
true
isNodeLabeled
=
true
nodeInfo
=
TestContext
.
NodeMapper
.
GetNodeInfo
(
node1Name
)
vsp
=
nodeInfo
.
VSphere
}
}
nodeInfo
=
TestContext
.
NodeMapper
.
GetNodeInfo
(
node1Name
)
vsp
=
nodeInfo
.
VSphere
By
(
"creating vmdk"
)
By
(
"creating vmdk"
)
volumePath
,
err
:=
vsp
.
CreateVolume
(
&
VolumeOptions
{},
nodeInfo
.
DataCenterRef
)
volumePath
,
err
:=
vsp
.
CreateVolume
(
&
VolumeOptions
{},
nodeInfo
.
DataCenterRef
)
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
Expect
(
err
)
.
NotTo
(
HaveOccurred
())
...
...
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