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
a7145c01
Commit
a7145c01
authored
Aug 09, 2016
by
Matthew Wong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add test for supplemental gid annotation to pv e2e test
parent
86e9b4bc
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
29 additions
and
4 deletions
+29
-4
persistent_volumes.go
test/e2e/persistent_volumes.go
+7
-2
volumes.go
test/e2e/volumes.go
+3
-0
Dockerfile
test/images/volumes-tester/nfs/Dockerfile
+2
-1
Makefile
test/images/volumes-tester/nfs/Makefile
+1
-1
README.md
test/images/volumes-tester/nfs/README.md
+3
-0
run_nfs.sh
test/images/volumes-tester/nfs/run_nfs.sh
+13
-0
No files found.
test/e2e/persistent_volumes.go
View file @
a7145c01
...
...
@@ -28,6 +28,7 @@ import (
"k8s.io/kubernetes/pkg/api/testapi"
"k8s.io/kubernetes/pkg/api/unversioned"
client
"k8s.io/kubernetes/pkg/client/unversioned"
"k8s.io/kubernetes/pkg/volume/util/volumehelper"
"k8s.io/kubernetes/test/e2e/framework"
)
...
...
@@ -343,8 +344,9 @@ var _ = framework.KubeDescribe("PersistentVolumes", func() {
NFSconfig
=
VolumeTestConfig
{
namespace
:
api
.
NamespaceDefault
,
prefix
:
"nfs"
,
serverImage
:
"gcr.io/google_containers/volume-nfs:0.
6
"
,
serverImage
:
"gcr.io/google_containers/volume-nfs:0.
7
"
,
serverPorts
:
[]
int
{
2049
},
serverArgs
:
[]
string
{
"-G"
,
"777"
,
"/exports"
},
}
BeforeEach
(
func
()
{
...
...
@@ -486,6 +488,9 @@ func makePersistentVolume(serverIP string, pvc *api.PersistentVolumeClaim) *api.
return
&
api
.
PersistentVolume
{
ObjectMeta
:
api
.
ObjectMeta
{
GenerateName
:
"nfs-"
,
Annotations
:
map
[
string
]
string
{
volumehelper
.
VolumeGidAnnotationKey
:
"777"
,
},
},
Spec
:
api
.
PersistentVolumeSpec
{
PersistentVolumeReclaimPolicy
:
api
.
PersistentVolumeReclaimRecycle
,
...
...
@@ -555,7 +560,7 @@ func makeWritePod(ns string, pvcName string) *api.Pod {
Name
:
"write-pod"
,
Image
:
"gcr.io/google_containers/busybox:1.24"
,
Command
:
[]
string
{
"/bin/sh"
},
Args
:
[]
string
{
"-c"
,
"touch /mnt/SUCCESS &&
exit 0 || exit 1
"
},
Args
:
[]
string
{
"-c"
,
"touch /mnt/SUCCESS &&
(id -G | grep -E '
\\
b777
\\
b')
"
},
VolumeMounts
:
[]
api
.
VolumeMount
{
{
Name
:
"nfs-pvc"
,
...
...
test/e2e/volumes.go
View file @
a7145c01
...
...
@@ -68,6 +68,8 @@ type VolumeTestConfig struct {
serverImage
string
// Ports to export from the server pod. TCP only.
serverPorts
[]
int
// Arguments to pass to the container image.
serverArgs
[]
string
// Volumes needed to be mounted to the server container from the host
// map <host (source) path> -> <container (dst.) path>
volumes
map
[
string
]
string
...
...
@@ -134,6 +136,7 @@ func startVolumeServer(client *client.Client, config VolumeTestConfig) *api.Pod
SecurityContext
:
&
api
.
SecurityContext
{
Privileged
:
privileged
,
},
Args
:
config
.
serverArgs
,
Ports
:
serverPodPorts
,
VolumeMounts
:
mounts
,
},
...
...
test/images/volumes-tester/nfs/Dockerfile
View file @
a7145c01
...
...
@@ -23,4 +23,5 @@ RUN chmod 644 /tmp/index.html
# expose mountd 20048/tcp and nfsd 2049/tcp
EXPOSE
2049/tcp 20048/tcp
ENTRYPOINT
["/usr/local/bin/run_nfs.sh", "/exports", "/"]
ENTRYPOINT
["/usr/local/bin/run_nfs.sh"]
CMD
["/exports", "/"]
test/images/volumes-tester/nfs/Makefile
View file @
a7145c01
...
...
@@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
TAG
=
0.
6
TAG
=
0.
7
PREFIX
=
gcr.io/google_containers
all
:
push
...
...
test/images/volumes-tester/nfs/README.md
View file @
a7145c01
...
...
@@ -2,6 +2,9 @@
This container exports '/' directory with an index.html inside. NFSv4 only.
Accepts a -G option for specifying a group id to give exported directories.
Clients in the specified group will have full rwx permissions, others none.
Inspired by https://github.com/cpuguy83/docker-nfs-server.
Used by test/e2e/
*
to test NFSVolumeSource. Not for production use!
...
...
test/images/volumes-tester/nfs/run_nfs.sh
View file @
a7145c01
...
...
@@ -17,10 +17,23 @@
function
start
()
{
unset
gid
# accept "-G gid" option
while
getopts
"G:"
opt
;
do
case
${
opt
}
in
G
)
gid
=
${
OPTARG
}
;;
esac
done
shift
$((
$OPTIND
-
1
))
# prepare /etc/exports
for
i
in
"
$@
"
;
do
# fsid=0: needed for NFSv4
echo
"
$i
*(rw,fsid=0,insecure,no_root_squash)"
>>
/etc/exports
if
[
-v
gid
]
;
then
chmod
070
$i
chgrp
$gid
$i
fi
# move index.html to here
/bin/cp /tmp/index.html
$i
/
chmod
644
$i
/index.html
...
...
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