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
39263a3f
Commit
39263a3f
authored
May 29, 2018
by
Jan Safranek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add reliable wait for volume server startup.
Remove sleep(20) and check for readiness of volume servers by checking logs.
parent
4a7a1865
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
14 deletions
+15
-14
volume_util.go
test/e2e/framework/volume_util.go
+15
-14
No files found.
test/e2e/framework/volume_util.go
View file @
39263a3f
...
@@ -66,7 +66,7 @@ const (
...
@@ -66,7 +66,7 @@ const (
TiB
int64
=
1024
*
GiB
TiB
int64
=
1024
*
GiB
// Waiting period for volume server (Ceph, ...) to initialize itself.
// Waiting period for volume server (Ceph, ...) to initialize itself.
VolumeServerPodStartup
Sleep
=
20
*
time
.
Second
VolumeServerPodStartup
Timeout
=
1
*
time
.
Minute
// Waiting period for pod to be cleaned up and unmount its volumes so we
// Waiting period for pod to be cleaned up and unmount its volumes so we
// don't tear down containers with NFS/Ceph/Gluster server too early.
// don't tear down containers with NFS/Ceph/Gluster server too early.
...
@@ -92,6 +92,8 @@ type VolumeTestConfig struct {
...
@@ -92,6 +92,8 @@ type VolumeTestConfig struct {
// map <host (source) path> -> <container (dst.) path>
// map <host (source) path> -> <container (dst.) path>
// if <host (source) path> is empty, mount a tmpfs emptydir
// if <host (source) path> is empty, mount a tmpfs emptydir
ServerVolumes
map
[
string
]
string
ServerVolumes
map
[
string
]
string
// Message to wait for before starting clients
ServerReadyMessage
string
// Wait for the pod to terminate successfully
// Wait for the pod to terminate successfully
// False indicates that the pod is long running
// False indicates that the pod is long running
WaitForCompletion
bool
WaitForCompletion
bool
...
@@ -114,11 +116,12 @@ type VolumeTest struct {
...
@@ -114,11 +116,12 @@ type VolumeTest struct {
// NFS-specific wrapper for CreateStorageServer.
// NFS-specific wrapper for CreateStorageServer.
func
NewNFSServer
(
cs
clientset
.
Interface
,
namespace
string
,
args
[]
string
)
(
config
VolumeTestConfig
,
pod
*
v1
.
Pod
,
ip
string
)
{
func
NewNFSServer
(
cs
clientset
.
Interface
,
namespace
string
,
args
[]
string
)
(
config
VolumeTestConfig
,
pod
*
v1
.
Pod
,
ip
string
)
{
config
=
VolumeTestConfig
{
config
=
VolumeTestConfig
{
Namespace
:
namespace
,
Namespace
:
namespace
,
Prefix
:
"nfs"
,
Prefix
:
"nfs"
,
ServerImage
:
imageutils
.
GetE2EImage
(
imageutils
.
VolumeNFSServer
),
ServerImage
:
imageutils
.
GetE2EImage
(
imageutils
.
VolumeNFSServer
),
ServerPorts
:
[]
int
{
2049
},
ServerPorts
:
[]
int
{
2049
},
ServerVolumes
:
map
[
string
]
string
{
""
:
"/exports"
},
ServerVolumes
:
map
[
string
]
string
{
""
:
"/exports"
},
ServerReadyMessage
:
"NFS started"
,
}
}
if
len
(
args
)
>
0
{
if
len
(
args
)
>
0
{
config
.
ServerArgs
=
args
config
.
ServerArgs
=
args
...
@@ -180,6 +183,7 @@ func NewISCSIServer(cs clientset.Interface, namespace string) (config VolumeTest
...
@@ -180,6 +183,7 @@ func NewISCSIServer(cs clientset.Interface, namespace string) (config VolumeTest
// iSCSI container needs to insert modules from the host
// iSCSI container needs to insert modules from the host
"/lib/modules"
:
"/lib/modules"
,
"/lib/modules"
:
"/lib/modules"
,
},
},
ServerReadyMessage
:
"Configuration restored from /etc/target/saveconfig.json"
,
}
}
pod
,
ip
=
CreateStorageServer
(
cs
,
config
)
pod
,
ip
=
CreateStorageServer
(
cs
,
config
)
return
config
,
pod
,
ip
return
config
,
pod
,
ip
...
@@ -195,16 +199,9 @@ func NewRBDServer(cs clientset.Interface, namespace string) (config VolumeTestCo
...
@@ -195,16 +199,9 @@ func NewRBDServer(cs clientset.Interface, namespace string) (config VolumeTestCo
ServerVolumes
:
map
[
string
]
string
{
ServerVolumes
:
map
[
string
]
string
{
"/lib/modules"
:
"/lib/modules"
,
"/lib/modules"
:
"/lib/modules"
,
},
},
ServerReadyMessage
:
"Ceph is ready"
,
}
}
pod
,
ip
=
CreateStorageServer
(
cs
,
config
)
pod
,
ip
=
CreateStorageServer
(
cs
,
config
)
// Ceph server container needs some time to start. Tests continue working if
// this sleep is removed, however kubelet logs (and kubectl describe
// <client pod>) would be cluttered with error messages about non-existing
// image.
Logf
(
"sleeping a bit to give ceph server time to initialize"
)
time
.
Sleep
(
VolumeServerPodStartupSleep
)
// create secrets for the server
// create secrets for the server
secret
=
&
v1
.
Secret
{
secret
=
&
v1
.
Secret
{
TypeMeta
:
metav1
.
TypeMeta
{
TypeMeta
:
metav1
.
TypeMeta
{
...
@@ -350,6 +347,10 @@ func StartVolumeServer(client clientset.Interface, config VolumeTestConfig) *v1.
...
@@ -350,6 +347,10 @@ func StartVolumeServer(client clientset.Interface, config VolumeTestConfig) *v1.
ExpectNoError
(
err
,
"Cannot locate the server pod %q: %v"
,
serverPodName
,
err
)
ExpectNoError
(
err
,
"Cannot locate the server pod %q: %v"
,
serverPodName
,
err
)
}
}
}
}
if
config
.
ServerReadyMessage
!=
""
{
_
,
err
:=
LookForStringInLog
(
pod
.
Namespace
,
pod
.
Name
,
serverPodName
,
config
.
ServerReadyMessage
,
VolumeServerPodStartupTimeout
)
ExpectNoError
(
err
,
"Failed to find %q in pod logs: %s"
,
config
.
ServerReadyMessage
,
err
)
}
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