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
de6d8705
Commit
de6d8705
authored
Jul 24, 2015
by
Mike Danese
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #11741 from jsafrane/devel/service-test
Use a service between e2e volume tests clients and servers.
parents
08671ed4
118004c1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
37 additions
and
53 deletions
+37
-53
run_nfs.sh
contrib/for-tests/volumes-tester/nfs/run_nfs.sh
+3
-1
persistent_volumes.go
test/e2e/persistent_volumes.go
+1
-2
volumes.go
test/e2e/volumes.go
+33
-50
No files found.
contrib/for-tests/volumes-tester/nfs/run_nfs.sh
View file @
de6d8705
...
...
@@ -20,7 +20,9 @@ function start()
# prepare /etc/exports
for
i
in
"
$@
"
;
do
# fsid=0: needed for NFSv4
echo
"
$i
*(rw,fsid=0,no_root_squash)"
>>
/etc/exports
# no_root_squash: root can read/write
# insecure: allow access from ports > 1024
echo
"
$i
*(rw,fsid=0,no_root_squash,insecure)"
>>
/etc/exports
echo
"Serving
$i
"
done
...
...
test/e2e/persistent_volumes.go
View file @
de6d8705
...
...
@@ -63,8 +63,7 @@ var _ = Describe("[Skipped] persistentVolumes", func() {
volumeTestCleanup
(
c
,
config
)
}()
pod
:=
startVolumeServer
(
c
,
config
)
serverIP
:=
pod
.
Status
.
PodIP
serverIP
:=
startVolumeServer
(
c
,
config
)
Logf
(
"NFS server IP address: %v"
,
serverIP
)
pv
:=
makePersistentVolume
(
serverIP
)
...
...
test/e2e/volumes.go
View file @
de6d8705
...
...
@@ -35,6 +35,7 @@ import (
"fmt"
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
"github.com/GoogleCloudPlatform/kubernetes/pkg/client"
"github.com/GoogleCloudPlatform/kubernetes/pkg/util"
"time"
.
"github.com/onsi/ginkgo"
...
...
@@ -55,13 +56,15 @@ type VolumeTestConfig struct {
}
// Starts a container specified by config.serverImage and exports all
// config.serverPorts from it
. The returned pod should be used to get the server
//
IP address and create appropriate VolumeSour
ce.
func
startVolumeServer
(
client
*
client
.
Client
,
config
VolumeTestConfig
)
*
api
.
Pod
{
// config.serverPorts from it
via a service. The function returns IP
//
address of the servi
ce.
func
startVolumeServer
(
client
*
client
.
Client
,
config
VolumeTestConfig
)
string
{
podClient
:=
client
.
Pods
(
config
.
namespace
)
serviceClient
:=
client
.
Services
(
config
.
namespace
)
portCount
:=
len
(
config
.
serverPorts
)
serverPodPorts
:=
make
([]
api
.
ContainerPort
,
portCount
)
servicePorts
:=
make
([]
api
.
ServicePort
,
portCount
)
for
i
:=
0
;
i
<
portCount
;
i
++
{
portName
:=
fmt
.
Sprintf
(
"%s-%d"
,
config
.
prefix
,
i
)
...
...
@@ -71,6 +74,12 @@ func startVolumeServer(client *client.Client, config VolumeTestConfig) *api.Pod
ContainerPort
:
config
.
serverPorts
[
i
],
Protocol
:
api
.
ProtocolTCP
,
}
servicePorts
[
i
]
=
api
.
ServicePort
{
Name
:
portName
,
Protocol
:
"TCP"
,
Port
:
config
.
serverPorts
[
i
],
TargetPort
:
util
.
NewIntOrStringFromInt
(
config
.
serverPorts
[
i
]),
}
}
By
(
fmt
.
Sprint
(
"creating "
,
config
.
prefix
,
" server pod"
))
...
...
@@ -106,13 +115,26 @@ func startVolumeServer(client *client.Client, config VolumeTestConfig) *api.Pod
expectNoError
(
waitForPodRunningInNamespace
(
client
,
serverPod
.
Name
,
config
.
namespace
))
By
(
"locating the server pod"
)
pod
,
err
:=
podClient
.
Get
(
serverPod
.
Name
)
expectNoError
(
err
,
"Cannot locate the server pod %v: %v"
,
serverPod
.
Name
,
err
)
By
(
fmt
.
Sprint
(
"creating "
,
config
.
prefix
,
" service"
))
service
:=
&
api
.
Service
{
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
config
.
prefix
+
"-server"
,
},
Spec
:
api
.
ServiceSpec
{
Selector
:
map
[
string
]
string
{
"role"
:
config
.
prefix
+
"-server"
,
},
Ports
:
servicePorts
,
},
}
createdService
,
err
:=
serviceClient
.
Create
(
service
)
expectNoError
(
err
,
"Failed to create %s service: %v"
,
service
.
Name
,
err
)
By
(
"sleeping a bit to give the server time to start"
)
time
.
Sleep
(
20
*
time
.
Second
)
return
pod
ip
:=
createdService
.
Spec
.
ClusterIP
return
ip
}
// Clean both server and client pods.
...
...
@@ -122,9 +144,11 @@ func volumeTestCleanup(client *client.Client, config VolumeTestConfig) {
defer
GinkgoRecover
()
podClient
:=
client
.
Pods
(
config
.
namespace
)
serviceClient
:=
client
.
Services
(
config
.
namespace
)
// ignore all errors, the pods may not be even created
podClient
.
Delete
(
config
.
prefix
+
"-client"
,
nil
)
serviceClient
.
Delete
(
config
.
prefix
+
"-server"
)
podClient
.
Delete
(
config
.
prefix
+
"-server"
,
nil
)
}
...
...
@@ -237,8 +261,7 @@ var _ = Describe("Volumes", func() {
volumeTestCleanup
(
c
,
config
)
}
}()
pod
:=
startVolumeServer
(
c
,
config
)
serverIP
:=
pod
.
Status
.
PodIP
serverIP
:=
startVolumeServer
(
c
,
config
)
Logf
(
"NFS server IP address: %v"
,
serverIP
)
volume
:=
api
.
VolumeSource
{
...
...
@@ -274,49 +297,9 @@ var _ = Describe("Volumes", func() {
volumeTestCleanup
(
c
,
config
)
}
}()
pod
:=
startVolumeServer
(
c
,
config
)
serverIP
:=
pod
.
Status
.
PodIP
serverIP
:=
startVolumeServer
(
c
,
config
)
Logf
(
"Gluster server IP address: %v"
,
serverIP
)
// create Endpoints for the server
endpoints
:=
api
.
Endpoints
{
TypeMeta
:
api
.
TypeMeta
{
Kind
:
"Endpoints"
,
APIVersion
:
"v1"
,
},
ObjectMeta
:
api
.
ObjectMeta
{
Name
:
config
.
prefix
+
"-server"
,
},
Subsets
:
[]
api
.
EndpointSubset
{
{
Addresses
:
[]
api
.
EndpointAddress
{
{
IP
:
serverIP
,
},
},
Ports
:
[]
api
.
EndpointPort
{
{
Name
:
"gluster"
,
Port
:
24007
,
Protocol
:
api
.
ProtocolTCP
,
},
},
},
},
}
endClient
:=
c
.
Endpoints
(
config
.
namespace
)
defer
func
()
{
if
clean
{
endClient
.
Delete
(
config
.
prefix
+
"-server"
)
}
}()
if
_
,
err
:=
endClient
.
Create
(
&
endpoints
);
err
!=
nil
{
Failf
(
"Failed to create endpoints for Gluster server: %v"
,
err
)
}
volume
:=
api
.
VolumeSource
{
Glusterfs
:
&
api
.
GlusterfsVolumeSource
{
EndpointsName
:
config
.
prefix
+
"-server"
,
...
...
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