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
d1ab959b
Commit
d1ab959b
authored
Feb 02, 2017
by
Jon Cope
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change NFS host pod to recreate per It()
parent
ab794c61
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
58 deletions
+35
-58
persistent_volumes-disruptive.go
test/e2e/persistent_volumes-disruptive.go
+17
-31
persistent_volumes.go
test/e2e/persistent_volumes.go
+18
-25
volumes.go
test/e2e/volumes.go
+0
-2
No files found.
test/e2e/persistent_volumes-disruptive.go
View file @
d1ab959b
...
@@ -59,14 +59,6 @@ var _ = framework.KubeDescribe("PersistentVolumes [Volume][Disruptive]", func()
...
@@ -59,14 +59,6 @@ var _ = framework.KubeDescribe("PersistentVolumes [Volume][Disruptive]", func()
clientNode
*
v1
.
Node
clientNode
*
v1
.
Node
)
)
nfsServerConfig
:=
VolumeTestConfig
{
namespace
:
metav1
.
NamespaceDefault
,
prefix
:
"nfs"
,
serverImage
:
NfsServerImage
,
serverPorts
:
[]
int
{
2049
},
serverArgs
:
[]
string
{
"-G"
,
"777"
,
"/exports"
},
}
BeforeEach
(
func
()
{
BeforeEach
(
func
()
{
// To protect the NFS volume pod from the kubelet restart, we isolate it on its own node.
// To protect the NFS volume pod from the kubelet restart, we isolate it on its own node.
framework
.
SkipUnlessNodeCountIsAtLeast
(
MinNodes
)
framework
.
SkipUnlessNodeCountIsAtLeast
(
MinNodes
)
...
@@ -74,23 +66,21 @@ var _ = framework.KubeDescribe("PersistentVolumes [Volume][Disruptive]", func()
...
@@ -74,23 +66,21 @@ var _ = framework.KubeDescribe("PersistentVolumes [Volume][Disruptive]", func()
ns
=
f
.
Namespace
.
Name
ns
=
f
.
Namespace
.
Name
// Start the NFS server pod.
// Start the NFS server pod.
if
nfsServerPod
==
nil
{
framework
.
Logf
(
"[BeforeEach] Creating NFS Server Pod"
)
framework
.
Logf
(
"[BeforeEach] Initializing NFS Server Pod"
)
nfsServerPod
=
initNFSserverPod
(
c
,
ns
)
nfsServerPod
=
startVolumeServer
(
c
,
nfsServerConfig
)
framework
.
Logf
(
"[BeforeEach] Configuring PersistentVolume"
)
framework
.
Logf
(
"[BeforeEach] Configuring PersistentVolume"
)
nfsServerIP
=
nfsServerPod
.
Status
.
PodIP
nfsServerIP
=
nfsServerPod
.
Status
.
PodIP
Expect
(
nfsServerIP
)
.
NotTo
(
BeEmpty
())
Expect
(
nfsServerIP
)
.
NotTo
(
BeEmpty
())
nfsPVconfig
=
persistentVolumeConfig
{
nfsPVconfig
=
persistentVolumeConfig
{
namePrefix
:
"nfs-"
,
namePrefix
:
"nfs-"
,
pvSource
:
v1
.
PersistentVolumeSource
{
pvSource
:
v1
.
PersistentVolumeSource
{
NFS
:
&
v1
.
NFSVolumeSource
{
NFS
:
&
v1
.
NFSVolumeSource
{
Server
:
nfsServerIP
,
Server
:
nfsServerIP
,
Path
:
"/exports"
,
Path
:
"/exports"
,
ReadOnly
:
false
,
ReadOnly
:
false
,
},
},
},
}
}
,
}
}
// Get the first ready node IP that is not hosting the NFS pod.
// Get the first ready node IP that is not hosting the NFS pod.
if
clientNodeIP
==
""
{
if
clientNodeIP
==
""
{
...
@@ -100,19 +90,15 @@ var _ = framework.KubeDescribe("PersistentVolumes [Volume][Disruptive]", func()
...
@@ -100,19 +90,15 @@ var _ = framework.KubeDescribe("PersistentVolumes [Volume][Disruptive]", func()
if
node
.
Name
!=
nfsServerPod
.
Spec
.
NodeName
{
if
node
.
Name
!=
nfsServerPod
.
Spec
.
NodeName
{
clientNode
=
&
node
clientNode
=
&
node
clientNodeIP
=
framework
.
GetNodeExternalIP
(
clientNode
)
clientNodeIP
=
framework
.
GetNodeExternalIP
(
clientNode
)
Expect
(
clientNodeIP
)
.
NotTo
(
BeEmpty
())
break
break
}
}
}
}
Expect
(
clientNodeIP
)
.
NotTo
(
BeEmpty
())
}
}
})
})
AddCleanupAction
(
func
()
{
AfterEach
(
func
()
{
if
nfsServerPod
!=
nil
&&
c
!=
nil
{
deletePodWithWait
(
f
,
c
,
nfsServerPod
)
By
(
"Deleting NFS server pod"
)
nfsServerPodCleanup
(
c
,
nfsServerConfig
)
nfsServerPod
=
nil
}
})
})
Context
(
"when kubelet restarts"
,
func
()
{
Context
(
"when kubelet restarts"
,
func
()
{
...
...
test/e2e/persistent_volumes.go
View file @
d1ab959b
...
@@ -85,6 +85,18 @@ func initializeGCETestSpec(c clientset.Interface, ns string, pvConfig persistent
...
@@ -85,6 +85,18 @@ func initializeGCETestSpec(c clientset.Interface, ns string, pvConfig persistent
return
clientPod
,
pv
,
pvc
return
clientPod
,
pv
,
pvc
}
}
// initNFSserverPod wraps volumes.go's startVolumeServer to return a running nfs host pod
// commonly used by persistent volume testing
func
initNFSserverPod
(
c
clientset
.
Interface
,
ns
string
)
*
v1
.
Pod
{
return
startVolumeServer
(
c
,
VolumeTestConfig
{
namespace
:
ns
,
prefix
:
"nfs"
,
serverImage
:
NfsServerImage
,
serverPorts
:
[]
int
{
2049
},
serverArgs
:
[]
string
{
"-G"
,
"777"
,
"/exports"
},
})
}
var
_
=
framework
.
KubeDescribe
(
"PersistentVolumes [Volume][Serial]"
,
func
()
{
var
_
=
framework
.
KubeDescribe
(
"PersistentVolumes [Volume][Serial]"
,
func
()
{
// global vars for the Context()s and It()'s below
// global vars for the Context()s and It()'s below
...
@@ -105,30 +117,16 @@ var _ = framework.KubeDescribe("PersistentVolumes [Volume][Serial]", func() {
...
@@ -105,30 +117,16 @@ var _ = framework.KubeDescribe("PersistentVolumes [Volume][Serial]", func() {
framework
.
KubeDescribe
(
"PersistentVolumes:NFS"
,
func
()
{
framework
.
KubeDescribe
(
"PersistentVolumes:NFS"
,
func
()
{
var
(
var
(
NFSconfig
VolumeTestConfig
nfsServerPod
*
v1
.
Pod
nfsServerPod
*
v1
.
Pod
serverIP
string
serverIP
string
pvConfig
persistentVolumeConfig
pvConfig
persistentVolumeConfig
)
)
// config for the nfs-server pod in the default namespace
NFSconfig
=
VolumeTestConfig
{
namespace
:
metav1
.
NamespaceDefault
,
prefix
:
"nfs"
,
serverImage
:
NfsServerImage
,
serverPorts
:
[]
int
{
2049
},
serverArgs
:
[]
string
{
"-G"
,
"777"
,
"/exports"
},
}
BeforeEach
(
func
()
{
BeforeEach
(
func
()
{
// If it doesn't exist, create the nfs server pod in the "default" ns.
framework
.
Logf
(
"[BeforeEach] Creating NFS Server Pod"
)
// The "default" ns is used so that individual tests can delete their
nfsServerPod
=
initNFSserverPod
(
c
,
ns
)
// ns without impacting the nfs-server pod.
serverIP
=
nfsServerPod
.
Status
.
PodIP
if
nfsServerPod
==
nil
{
framework
.
Logf
(
"[BeforeEach] Configuring PersistentVolume"
)
nfsServerPod
=
startVolumeServer
(
c
,
NFSconfig
)
serverIP
=
nfsServerPod
.
Status
.
PodIP
framework
.
Logf
(
"NFS server IP address: %v"
,
serverIP
)
}
pvConfig
=
persistentVolumeConfig
{
pvConfig
=
persistentVolumeConfig
{
namePrefix
:
"nfs-"
,
namePrefix
:
"nfs-"
,
pvSource
:
v1
.
PersistentVolumeSource
{
pvSource
:
v1
.
PersistentVolumeSource
{
...
@@ -141,13 +139,8 @@ var _ = framework.KubeDescribe("PersistentVolumes [Volume][Serial]", func() {
...
@@ -141,13 +139,8 @@ var _ = framework.KubeDescribe("PersistentVolumes [Volume][Serial]", func() {
}
}
})
})
// Execute after *all* the tests have run
AfterEach
(
func
()
{
AddCleanupAction
(
func
()
{
deletePodWithWait
(
f
,
c
,
nfsServerPod
)
if
nfsServerPod
!=
nil
&&
c
!=
nil
{
framework
.
Logf
(
"AfterSuite: nfs-server pod %v is non-nil, deleting pod"
,
nfsServerPod
.
Name
)
nfsServerPodCleanup
(
c
,
NFSconfig
)
nfsServerPod
=
nil
}
})
})
Context
(
"with Single PV - PVC pairs"
,
func
()
{
Context
(
"with Single PV - PVC pairs"
,
func
()
{
...
...
test/e2e/volumes.go
View file @
d1ab959b
...
@@ -183,8 +183,6 @@ func startVolumeServer(client clientset.Interface, config VolumeTestConfig) *v1.
...
@@ -183,8 +183,6 @@ func startVolumeServer(client clientset.Interface, config VolumeTestConfig) *v1.
By
(
fmt
.
Sprintf
(
"locating the %q server pod"
,
serverPodName
))
By
(
fmt
.
Sprintf
(
"locating the %q server pod"
,
serverPodName
))
pod
,
err
=
podClient
.
Get
(
serverPodName
,
metav1
.
GetOptions
{})
pod
,
err
=
podClient
.
Get
(
serverPodName
,
metav1
.
GetOptions
{})
framework
.
ExpectNoError
(
err
,
"Cannot locate the server pod %q: %v"
,
serverPodName
,
err
)
framework
.
ExpectNoError
(
err
,
"Cannot locate the server pod %q: %v"
,
serverPodName
,
err
)
By
(
"sleeping a bit to give the server time to start"
)
time
.
Sleep
(
20
*
time
.
Second
)
}
}
return
pod
return
pod
...
...
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