vendor files

This commit is contained in:
Serguei Bezverkhi
2018-01-09 13:57:14 -05:00
parent 558bc6c02a
commit 7b24313bd6
16547 changed files with 4527373 additions and 0 deletions

View File

@ -0,0 +1,25 @@
# Copyright 2016 The Kubernetes Authors.
#
# 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 centos:6
ADD install.sh /usr/local/bin/
RUN /usr/local/bin/install.sh
ADD init.sh /usr/local/bin/
ADD index.html /tmp/
RUN chmod 644 /tmp/index.html
EXPOSE 6789/tcp
ENTRYPOINT ["/usr/local/bin/init.sh"]

View File

@ -0,0 +1,30 @@
# Copyright 2016 The Kubernetes Authors.
#
# 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.
TAG = 0.1
PREFIX = gcr.io/google_containers
all: push
container: image
image:
docker build --pull -t $(PREFIX)/volume-ceph . # Build new image and automatically tag it as latest
docker tag $(PREFIX)/volume-ceph $(PREFIX)/volume-ceph:$(TAG) # Add the version tag to the latest image
push: image
gcloud docker -- push $(PREFIX)/volume-ceph # Push image tagged as latest to repository
gcloud docker -- push $(PREFIX)/volume-ceph:$(TAG) # Push version tagged image to repository (since this image is already pushed it will simply create or update version tag)
clean:

View File

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

View File

@ -0,0 +1 @@
Hello Ceph!

View File

@ -0,0 +1,93 @@
#!/bin/bash
# Copyright 2015 The Kubernetes Authors.
#
# 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.
#set -e
set -x
# clean up
rm -f /etc/ceph/*
pkill -9 ceph-mon
pkill -9 ceph-osd
pkill -9 ceph-mds
mkdir -p /var/lib/ceph
mkdir -p /var/lib/ceph/osd
mkdir -p /var/lib/ceph/osd/ceph-0
# create hostname for ceph monitor
MASTER=`hostname -s`
ip=$(ip -4 -o a | grep eth0 | awk '{print $4}' | cut -d'/' -f1)
echo "$ip $MASTER" >> /etc/hosts
#create ceph cluster
ceph-deploy --overwrite-conf new ${MASTER}
ceph-deploy --overwrite-conf mon create-initial ${MASTER}
ceph-deploy --overwrite-conf mon create ${MASTER}
ceph-deploy gatherkeys ${MASTER}
# set osd params for minimal configuration
echo "osd crush chooseleaf type = 0" >> /etc/ceph/ceph.conf
echo "osd journal size = 100" >> /etc/ceph/ceph.conf
echo "osd pool default size = 1" >> /etc/ceph/ceph.conf
echo "osd pool default pgp num = 8" >> /etc/ceph/ceph.conf
echo "osd pool default pg num = 8" >> /etc/ceph/ceph.conf
/sbin/service ceph -c /etc/ceph/ceph.conf stop mon.${MASTER}
/sbin/service ceph -c /etc/ceph/ceph.conf start mon.${MASTER}
# create ceph osd
ceph osd create
ceph-osd -i 0 --mkfs --mkkey
ceph auth add osd.0 osd 'allow *' mon 'allow rwx' -i /var/lib/ceph/osd/ceph-0/keyring
ceph osd crush add 0 1 root=default host=${MASTER}
ceph-osd -i 0 -k /var/lib/ceph/osd/ceph-0/keyring
#see if we are ready to go
ceph osd tree
# create ceph fs
ceph osd pool create cephfs_data 4
ceph osd pool create cephfs_metadata 4
ceph fs new cephfs cephfs_metadata cephfs_data
ceph-deploy --overwrite-conf mds create ${MASTER}
# uncomment the following for rbd test
# ceph osd pool create kube 4
# rbd create foo --size 10 --pool kube
ps -ef |grep ceph
ceph osd dump
# add new client with a pre defined keyring
# this keyring must match the ceph secret in e2e test
cat > /etc/ceph/ceph.client.kube.keyring <<EOF
[client.kube]
key = AQAMgXhVwBCeDhAA9nlPaFyfUSatGD4drFWDvQ==
caps mds = "allow rwx"
caps mon = "allow rwx"
caps osd = "allow rwx"
EOF
ceph auth import -i /etc/ceph/ceph.client.kube.keyring
# mount it through ceph-fuse and copy file to ceph fs
ceph-fuse -m ${MASTER}:6789 /mnt
cp /tmp/index.html /mnt
chmod 644 /mnt/index.html
# watch
ceph -w

View File

@ -0,0 +1,27 @@
#!/bin/bash
# Copyright 2015 The Kubernetes Authors.
#
# 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.
yum update -y -v
yum install openssh openssh-server openssh-clients hostname -y -q
ssh-keygen -f ~/.ssh/id_rsa -t rsa -N ''
cat ~/.ssh/id_rsa.pub |awk '{print $1, $2, "Generated"}' >> ~/.ssh/authorized_keys2
cat ~/.ssh/id_rsa.pub |awk '{print $1, $2, "Generated"}' >> ~/.ssh/authorized_keys
rpm -Uvh http://ceph.com/rpm/rhel6/noarch/ceph-release-1-0.el6.noarch.rpm
yum install -y -q python-itsdangerous python-werkzeug python-jinja2 python-flask ceph-deploy epel-release
# ceph pkg depends on epel-release
yum install -y -q ceph ceph-fuse

View File

@ -0,0 +1,24 @@
# Copyright 2016 The Kubernetes Authors.
#
# 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 centos
RUN yum -y install hostname centos-release-gluster && yum -y install glusterfs-server && yum clean all
ADD glusterd.vol /etc/glusterfs/
ADD run_gluster.sh /usr/local/bin/
ADD index.html /vol/
RUN chmod 644 /vol/index.html
EXPOSE 24007/tcp 49152/tcp
ENTRYPOINT ["/usr/local/bin/run_gluster.sh"]

View File

@ -0,0 +1,30 @@
# Copyright 2016 The Kubernetes Authors.
#
# 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.
TAG = 0.4
PREFIX = gcr.io/google_containers
all: push
container: image
image:
docker build --pull -t $(PREFIX)/volume-gluster . # Build new image and automatically tag it as latest
docker tag $(PREFIX)/volume-gluster $(PREFIX)/volume-gluster:$(TAG) # Add the version tag to the latest image
push: image
gcloud docker -- push $(PREFIX)/volume-gluster # Push image tagged as latest to repository
gcloud docker -- push $(PREFIX)/volume-gluster:$(TAG) # Push version tagged image to repository (since this image is already pushed it will simply create or update version 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/test/images/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,46 @@
#!/bin/bash
# Copyright 2015 The Kubernetes Authors.
#
# 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.
DIR=`mktemp -d`
function start()
{
mount -t tmpfs test $DIR
chmod 755 $DIR
cp /vol/* $DIR/
/usr/sbin/glusterd -p /run/glusterd.pid
gluster volume create test_vol `hostname -i`:$DIR force
gluster volume start test_vol
}
function stop()
{
gluster --mode=script volume stop test_vol force
kill $(cat /run/glusterd.pid)
umount $DIR
rm -rf $DIR
exit 0
}
trap stop TERM
start "$@"
while true; do
sleep 5
done

View File

@ -0,0 +1,32 @@
# Copyright 2016 The Kubernetes Authors.
#
# 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 fedora
RUN yum install -y iscsi-initiator-utils targetcli net-tools strace && yum clean all
ADD run_iscsid.sh /usr/local/bin/
ADD initiatorname.iscsi /etc/iscsi/
ADD block.tar.gz /
# This JSON file was generated by targetcli with these commands:
# /backstores/fileio create block /block
# /iscsi create
# # Enable demo mode (no authentication!):
# /iscsi/iqn.2003-01.org.linux-iscsi.f21.x8664:sn.4b0aae584f7c/tpg1 set attribute authentication=0 demo_mode_write_protect=0 generate_node_acls=1 cache_dynamic_acls=1
# /iscsi/iqn.2003-01.org.linux-iscsi.f21.x8664:sn.4b0aae584f7c/tpg1/luns create /backstores/fileio/block
# saveconfig
ADD saveconfig.json /etc/target/
EXPOSE 3260/tcp
ENTRYPOINT ["/usr/local/bin/run_iscsid.sh"]

View File

@ -0,0 +1,41 @@
# Copyright 2016 The Kubernetes Authors.
#
# 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.
TAG = 0.1
PREFIX = gcr.io/google_containers
all: push
container: image
image:
# Build new image and automatically tag it as latest
docker build --pull -t $(PREFIX)/volume-iscsi .
# Add the version tag to the latest image
docker tag $(PREFIX)/volume-iscsi $(PREFIX)/volume-iscsi:$(TAG)
block:
# Create block.tar.gz with ext2 block device with index.html inside.
# block.tar.gz is already available in git and users don't need to
# regenerate it, this target is here just for reference.
# Run as root!
./create_block.sh
push: image
# Push image tagged as latest to repository
gcloud docker -- push $(PREFIX)/volume-iscsi
# Push version tagged image to repository (since this image is already pushed it will simply create or update version tag)
gcloud docker -- push $(PREFIX)/volume-iscsi:$(TAG)
clean:

View File

@ -0,0 +1,14 @@
# iSCSI target container for testing.
Inspired by https://github.com/rvykydal/dockerfile-iscsid
* The container needs /lib/modules from the host to insert appropriate
kernel modules for iscsi. This assumes that these modules are installed
on the host!
* The container needs to run with docker --privileged
block.tar.gz is a small ext2 filesystem created by `make block` (run as root!)
[![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/test/images/volumes-tester/iscsi/README.md?pixel)]()

Binary file not shown.

View File

@ -0,0 +1,46 @@
#!/bin/bash
# Copyright 2015 The Kubernetes Authors.
#
# 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.
# Exit on the first error.
set -e
MNTDIR=`mktemp -d`
cleanup()
{
# Make sure we return the right exit code
RET=$?
# Silently remove everything and ignore errors
set +e
/bin/umount $MNTDIR 2>/dev/null
/bin/rmdir $MNTDIR 2>/dev/null
/bin/rm block 2>/dev/null
exit $RET
}
trap cleanup TERM EXIT
# Create 1MB device with ext2
dd if=/dev/zero of=block count=1 bs=1M
mkfs.ext2 block
# Add index.html to it
mount -o loop block $MNTDIR
echo "Hello from iSCSI" > $MNTDIR/index.html
umount $MNTDIR
rm block.tar.gz 2>/dev/null || :
tar cfz block.tar.gz block

View File

@ -0,0 +1 @@
InitiatorName=iqn.1994-05.com.redhat:eb59fbe2c4c5

View File

@ -0,0 +1,41 @@
#!/bin/bash
# Copyright 2015 The Kubernetes Authors.
#
# 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()
{
targetcli restoreconfig
iscsid
echo "iscsid started"
}
function stop()
{
echo "Stopping iscsid"
kill $( cat /var/run/iscsid.pid )
targetcli clearconfig confirm=True
echo "iscsid stopped"
exit 0
}
trap stop TERM
start
while true; do
sleep 5
done

View File

@ -0,0 +1,102 @@
{
"fabric_modules": [],
"storage_objects": [
{
"attributes": {
"block_size": 512,
"emulate_3pc": 1,
"emulate_caw": 1,
"emulate_dpo": 0,
"emulate_fua_read": 0,
"emulate_fua_write": 1,
"emulate_model_alias": 1,
"emulate_rest_reord": 0,
"emulate_tas": 1,
"emulate_tpu": 0,
"emulate_tpws": 0,
"emulate_ua_intlck_ctrl": 0,
"emulate_write_cache": 1,
"enforce_pr_isids": 1,
"force_pr_aptpl": 0,
"is_nonrot": 0,
"max_unmap_block_desc_count": 1,
"max_unmap_lba_count": 8192,
"max_write_same_len": 4096,
"optimal_sectors": 16384,
"pi_prot_format": 0,
"pi_prot_type": 0,
"queue_depth": 128,
"unmap_granularity": 1,
"unmap_granularity_alignment": 0
},
"dev": "block",
"name": "block",
"plugin": "fileio",
"size": 1048576,
"write_back": true,
"wwn": "521c57aa-9d9b-4e5d-ab1a-527487f92a33"
}
],
"targets": [
{
"fabric": "iscsi",
"tpgs": [
{
"attributes": {
"authentication": 0,
"cache_dynamic_acls": 1,
"default_cmdsn_depth": 64,
"default_erl": 0,
"demo_mode_discovery": 1,
"demo_mode_write_protect": 0,
"generate_node_acls": 1,
"login_timeout": 15,
"netif_timeout": 2,
"prod_mode_write_protect": 0,
"t10_pi": 0
},
"enable": true,
"luns": [
{
"index": 0,
"storage_object": "/backstores/fileio/block"
}
],
"node_acls": [],
"parameters": {
"AuthMethod": "CHAP,None",
"DataDigest": "CRC32C,None",
"DataPDUInOrder": "Yes",
"DataSequenceInOrder": "Yes",
"DefaultTime2Retain": "20",
"DefaultTime2Wait": "2",
"ErrorRecoveryLevel": "0",
"FirstBurstLength": "65536",
"HeaderDigest": "CRC32C,None",
"IFMarkInt": "2048~65535",
"IFMarker": "No",
"ImmediateData": "Yes",
"InitialR2T": "Yes",
"MaxBurstLength": "262144",
"MaxConnections": "1",
"MaxOutstandingR2T": "1",
"MaxRecvDataSegmentLength": "8192",
"MaxXmitDataSegmentLength": "262144",
"OFMarkInt": "2048~65535",
"OFMarker": "No",
"TargetAlias": "LIO Target"
},
"portals": [
{
"ip_address": "0.0.0.0",
"iser": false,
"port": 3260
}
],
"tag": 1
}
],
"wwn": "iqn.2003-01.org.linux-iscsi.f21.x8664:sn.4b0aae584f7c"
}
]
}

View File

@ -0,0 +1,28 @@
# Copyright 2016 The Kubernetes Authors.
#
# 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 centos
RUN yum -y install /usr/bin/ps nfs-utils && yum clean all
RUN mkdir -p /exports
ADD run_nfs.sh /usr/local/bin/
ADD index.html /tmp/index.html
RUN chmod 644 /tmp/index.html
# mark /exports as a mount point
VOLUME /exports
# expose mountd 20048/tcp and nfsd 2049/tcp
EXPOSE 2049/tcp 20048/tcp
ENTRYPOINT ["/usr/local/bin/run_nfs.sh"]
CMD ["/exports", "/"]

View File

@ -0,0 +1,30 @@
# Copyright 2016 The Kubernetes Authors.
#
# 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.
TAG = 0.8
PREFIX = gcr.io/google_containers
all: push
container: image
image:
docker build --pull -t $(PREFIX)/volume-nfs . # Build new image and automatically tag it as latest
docker tag $(PREFIX)/volume-nfs $(PREFIX)/volume-nfs:$(TAG) # Add the version tag to the latest image
push: image
gcloud docker -- push $(PREFIX)/volume-nfs # Push image tagged as latest to repository
gcloud docker -- push $(PREFIX)/volume-nfs:$(TAG) # Push version tagged image to repository (since this image is already pushed it will simply create or update version tag)
clean:

View File

@ -0,0 +1,13 @@
# NFS server container for testing
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!
[![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/test/images/volumes-tester/nfs/README.md?pixel)]()

View File

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

View File

@ -0,0 +1,84 @@
#!/bin/bash
# Copyright 2015 The Kubernetes Authors.
#
# 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()
{
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
echo "Serving $i"
done
# start rpcbind if it is not started yet
/usr/sbin/rpcinfo 127.0.0.1 > /dev/null; s=$?
if [ $s -ne 0 ]; then
echo "Starting rpcbind"
/usr/sbin/rpcbind -w
fi
mount -t nfsd nfds /proc/fs/nfsd
# -V 3: enable NFSv3
/usr/sbin/rpc.mountd -N 2 -V 3
/usr/sbin/exportfs -r
# -G 10 to reduce grace time to 10 seconds (the lowest allowed)
/usr/sbin/rpc.nfsd -G 10 -N 2 -V 3
/usr/sbin/rpc.statd --no-notify
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
sleep 5
done

View File

@ -0,0 +1,33 @@
# Copyright 2016 The Kubernetes Authors.
#
# 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.
# CEPH all in one
# Based on image by Ricardo Rocha, ricardo@catalyst.net.nz
FROM fedora
# Base Packages
RUN yum install -y wget ceph ceph-fuse strace && yum clean all
# Get ports exposed
EXPOSE 6789
ADD ./bootstrap.sh /bootstrap.sh
ADD ./mon.sh /mon.sh
ADD ./osd.sh /osd.sh
ADD ./ceph.conf.sh /ceph.conf.sh
ADD ./keyring /var/lib/ceph/mon/keyring
ADD ./block.tar.gz /
CMD /bootstrap.sh

View File

@ -0,0 +1,41 @@
# Copyright 2016 The Kubernetes Authors.
#
# 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.
TAG = 0.1
PREFIX = gcr.io/google_containers
all: push
container: image
image:
# Build new image and automatically tag it as latest
docker build --pull -t $(PREFIX)/volume-rbd .
# Add the version tag to the latest image
docker tag $(PREFIX)/volume-rbd $(PREFIX)/volume-rbd:$(TAG)
block:
# Create block.tar.gz with ext2 block device with index.html inside.
# block.tar.gz is already available in git and users don't need to
# regenerate it, this target is here just for reference.
# Run as root!
./create_block.sh
push: image
# Push image tagged as latest to repository
gcloud docker -- push $(PREFIX)/volume-rbd
# Push version tagged image to repository (since this image is already pushed it will simply create or update version tag)
gcloud docker -- push $(PREFIX)/volume-rbd:$(TAG)
clean:

Binary file not shown.

View File

@ -0,0 +1,47 @@
#!/bin/bash
# Copyright 2015 The Kubernetes Authors.
#
# 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.
#
# Bootstraps a CEPH server.
# It creates two OSDs on local machine, creates RBD pool there
# and imports 'block' device there.
#
# We must create fresh OSDs and filesystem here, because shipping it
# in a container would increase the image by ~300MB.
#
# Create /etc/ceph/ceph.conf
sh ./ceph.conf.sh `hostname -i`
# Configure and start ceph-mon
sh ./mon.sh `hostname -i`
# Configure and start 2x ceph-osd
mkdir -p /var/lib/ceph/osd/ceph-0 /var/lib/ceph/osd/ceph-1
sh ./osd.sh 0
sh ./osd.sh 1
# Prepare a RBD volume
# NOTE: we need Ceph kernel modules on the host!
rbd import block foo
echo "Ceph is ready"
# Wait forever
while true; do
sleep 10
done

View File

@ -0,0 +1,38 @@
#!/bin/bash
# Copyright 2015 The Kubernetes Authors.
#
# 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.
#
# Configures /etc/ceph.conf from a template.
#
echo "
[global]
auth cluster required = none
auth service required = none
auth client required = none
[mon.a]
host = cephbox
mon addr = $1
[osd]
osd journal size = 128
journal dio = false
[osd.0]
osd host = cephbox
" > /etc/ceph/ceph.conf

View File

@ -0,0 +1,49 @@
#!/bin/bash
# Copyright 2015 The Kubernetes Authors.
#
# 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.
# Create block.tar.gz with a small ext2 filesystem.
# It must be run as root (to mount with '-o loop')!
# Exit on the first error.
set -e
MNTDIR=`mktemp -d`
cleanup()
{
# Make sure we return the right exit code
RET=$?
# Silently remove everything and ignore errors
set +e
/bin/umount $MNTDIR 2>/dev/null
/bin/rmdir $MNTDIR 2>/dev/null
/bin/rm block 2>/dev/null
exit $RET
}
trap cleanup TERM EXIT
# Create 1MB device with ext2
dd if=/dev/zero of=block count=1 bs=1M
mkfs.ext2 block
# Add index.html to it
mount -o loop block $MNTDIR
echo "Hello from RBD" > $MNTDIR/index.html
umount $MNTDIR
rm block.tar.gz 2>/dev/null || :
tar cfz block.tar.gz block

View File

@ -0,0 +1,8 @@
[mon.]
key = AQDRrKNV6z4UChAABzP1ZyysTU4pjgjNOf/p3A==
[client.admin]
key = AQDRrKNVbEevChAAEmRC+pW/KBVHxa0w/POILA==
auid = 0
caps mds = "allow *"
caps mon = "allow *"
caps osd = "allow *"

View File

@ -0,0 +1,36 @@
#!/bin/bash
# Copyright 2015 The Kubernetes Authors.
#
# 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.
#
# Configures and launches a new MON.
#
# monitor setup
monmaptool --create --clobber --fsid `uuidgen` --add a $1:6789 /etc/ceph/monmap
mkdir /var/lib/ceph/mon/ceph-a
ceph-mon -i a --mkfs --monmap /etc/ceph/monmap -k /var/lib/ceph/mon/keyring
cp /var/lib/ceph/mon/keyring /var/lib/ceph/mon/ceph-a
ceph-mon -i a --monmap /etc/ceph/monmap -k /var/lib/ceph/mon/ceph-a/keyring
# client setup (handy)
cp /var/lib/ceph/mon/keyring /etc/ceph
# for this test we want to
ceph osd getcrushmap -o /tmp/crushc
crushtool -d /tmp/crushc -o /tmp/crushd
sed -i 's/step chooseleaf firstn 0 type host/step chooseleaf firstn 0 type osd/' /tmp/crushd
crushtool -c /tmp/crushd -o /tmp/crushc
ceph osd setcrushmap -i /tmp/crushc

View File

@ -0,0 +1,25 @@
#!/bin/bash
# Copyright 2015 The Kubernetes Authors.
#
# 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.
#
# Configures and launches a new OSD.
#
ceph osd create
ceph-osd -i $1 --mkfs --mkkey
ceph auth add osd.$1 osd 'allow *' mon 'allow rwx' -i /var/lib/ceph/osd/ceph-$1/keyring
ceph osd crush add $1 1 root=default host=cephbox
ceph-osd -i $1 -k /var/lib/ceph/osd/ceph-$1/keyring