Add e2e tests for Gluster and NFS tests.

- add appropriate server containers into contrib/for-tests/volumes-tester
- the tests are off by default (they need kubelet --allow_privileged=True)
  - enable by 'go run hack/e2e.go ... --ginkgo.focus=Volume'
- add glusterfs tools to list of installed packages on each node
This commit is contained in:
Jan Safranek
2015-05-25 12:02:41 +02:00
parent 10339d72b6
commit 20004e0c16
14 changed files with 541 additions and 1 deletions

View File

@@ -0,0 +1,25 @@
# Copyright 2015 Google Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
FROM ubuntu:14.04
MAINTAINER Jan Safranek, jsafrane@redhat.com
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update -qq && apt-get install -y glusterfs-server -qq
ADD glusterd.vol /etc/glusterfs/
ADD run_gluster.sh /usr/local/bin/
ADD index.html /vol/
EXPOSE 24007/tcp 24008/tcp 49152/tcp
ENTRYPOINT ["/usr/local/bin/run_gluster.sh"]

View File

@@ -0,0 +1,11 @@
all: push
TAG = 0.1
container:
docker build -t gcr.io/google_containers/volume-gluster:$(TAG) .
push: container
gcloud preview docker push gcr.io/google_containers/volume-gluster:$(TAG)
clean:

View File

@@ -0,0 +1,8 @@
# Gluster server container for testing
This container exports test_vol volume with an index.html inside.
Used by test/e2e/* to test GlusterfsVolumeSource. Not for production use!
[![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/contrib/for-tests/volumes-tester/gluster/README.md?pixel)]()

View File

@@ -0,0 +1,14 @@
# This is default glusterd.vol (incl. commented out base-port),
# with added "rpc-auth-allow-insecure on" to allow connection
# from non-privileged ports.
volume management
type mgmt/glusterd
option working-directory /var/lib/glusterd
option transport-type socket,rdma
option transport.socket.keepalive-time 10
option transport.socket.keepalive-interval 2
option transport.socket.read-fail-log off
# option base-port 49152
option rpc-auth-allow-insecure on
end-volume

View File

@@ -0,0 +1 @@
Hello from GlusterFS!

View File

@@ -0,0 +1,39 @@
#!/bin/bash
# Copyright 2015 The Kubernetes Authors All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
function start()
{
/usr/sbin/glusterd -p /run/glusterd.pid
gluster volume create test_vol `hostname -i`:/vol force
gluster volume start test_vol
}
function stop()
{
gluster --mode=script volume stop test_vol force
kill $(cat /run/glusterd.pid)
exit 0
}
trap stop TERM
start "$@"
while true; do
read
done

View File

@@ -0,0 +1,25 @@
# Copyright 2015 Google Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
FROM ubuntu:14.04
MAINTAINER Jan Safranek, jsafrane@redhat.com
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update -qq && apt-get install -y nfs-kernel-server -qq
RUN mkdir -p /exports
ADD run_nfs.sh /usr/local/bin/
ADD index.html /exports/index.html
EXPOSE 2049/tcp
ENTRYPOINT ["/usr/local/bin/run_nfs.sh", "/exports"]

View File

@@ -0,0 +1,11 @@
all: push
TAG = 0.1
container:
docker build -t gcr.io/google_containers/volume-nfs:$(TAG) .
push: container
gcloud preview docker push gcr.io/google_containers/volume-nfs:$(TAG)
clean:

View File

@@ -0,0 +1,10 @@
# NFS server container for testing
This container exports '/' directory with an index.html inside. NFSv4 only.
Inspired by https://github.com/cpuguy83/docker-nfs-server.
Used by test/e2e/* to test NFSVolumeSource. Not for production use!
[![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/contrib/for-tests/volumes-tester/nfs/README.md?pixel)]()

View File

@@ -0,0 +1 @@
Hello from NFS!

View File

@@ -0,0 +1,61 @@
#!/bin/bash
# Copyright 2015 The Kubernetes Authors All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
function start()
{
# prepare /etc/exports
for i in "$@"; do
# fsid=0: needed for NFSv4
echo "$i *(rw,fsid=0)" >> /etc/exports
echo "Serving $i"
done
mount -t nfsd nfds /proc/fs/nfsd
# -N 2 -N 3: disable NFSv2+3
# -V 4.x: enable NFSv4
/usr/sbin/rpc.mountd -N 2 -N 3 -V 4 -V 4.1
/usr/sbin/exportfs -r
/usr/sbin/rpc.nfsd -N 2 -N 3 -V 4 -V 4.1 2
echo "NFS started"
}
function stop()
{
echo "Stopping NFS"
/usr/sbin/rpc.nfsd 0
/usr/sbin/exportfs -au
/usr/sbin/exportfs -f
kill $( pidof rpc.mountd )
umount /proc/fs/nfsd
echo > /etc/exports
exit 0
}
trap stop TERM
start "$@"
# Ugly hack to do nothing and wait for SIGTERM
while true; do
read
done