mirror of https://github.com/k3s-io/k3s
Merge pull request #36610 from jingxu97/Nov/nfsv3
Automatic merge from submit-queue Modify GCI mounter to enable NFSv3 In order to make NFSv3 work, mounter needs to start rpcbind daemon. This change modify mounter's Dockerfile and mounter script to start the rpcbind daemon if it is not running on the host. After this change, need to make push the image and update the sha number in Changelog.pull/6/head
commit
e801fcfc4a
|
@ -100,10 +100,10 @@ function split-commas {
|
||||||
|
|
||||||
function install-gci-mounter-tools {
|
function install-gci-mounter-tools {
|
||||||
local -r rkt_version="v1.18.0"
|
local -r rkt_version="v1.18.0"
|
||||||
local -r gci_mounter_version="v2"
|
local -r gci_mounter_version="v3"
|
||||||
local -r rkt_binary_sha1="75fc8f29c79bc9e505f3e7f6e8fadf2425c21967"
|
local -r rkt_binary_sha1="75fc8f29c79bc9e505f3e7f6e8fadf2425c21967"
|
||||||
local -r rkt_stage1_fly_sha1="474df5a1f934960ba669b360ab713d0a54283091"
|
local -r rkt_stage1_fly_sha1="474df5a1f934960ba669b360ab713d0a54283091"
|
||||||
local -r gci_mounter_sha1="851e841d8640d6a05e64e22c493f5ac3c4cba561"
|
local -r gci_mounter_sha1="6ae71998bf9deba06468b036c2ba126626e0050d"
|
||||||
download-or-bust "${rkt_binary_sha1}" "https://storage.googleapis.com/kubernetes-release/rkt/${rkt_version}/rkt"
|
download-or-bust "${rkt_binary_sha1}" "https://storage.googleapis.com/kubernetes-release/rkt/${rkt_version}/rkt"
|
||||||
download-or-bust "${rkt_stage1_fly_sha1}" "https://storage.googleapis.com/kubernetes-release/rkt/${rkt_version}/stage1-fly.aci"
|
download-or-bust "${rkt_stage1_fly_sha1}" "https://storage.googleapis.com/kubernetes-release/rkt/${rkt_version}/stage1-fly.aci"
|
||||||
download-or-bust "${gci_mounter_sha1}" "https://storage.googleapis.com/kubernetes-release/gci-mounter/gci-mounter-${gci_mounter_version}.aci"
|
download-or-bust "${gci_mounter_sha1}" "https://storage.googleapis.com/kubernetes-release/gci-mounter/gci-mounter-${gci_mounter_version}.aci"
|
||||||
|
|
|
@ -5,3 +5,8 @@
|
||||||
## v2 (Fri Oct 28 2016 Vishnu Kannan <vishh@google.com>)
|
## v2 (Fri Oct 28 2016 Vishnu Kannan <vishh@google.com>)
|
||||||
- Adding netbase package.
|
- Adding netbase package.
|
||||||
- Digest: sha256:c7dfe059fbbf976fc4284a87eb18adf0f8e0c4cf30a30f5a852842c772a64c2d
|
- Digest: sha256:c7dfe059fbbf976fc4284a87eb18adf0f8e0c4cf30a30f5a852842c772a64c2d
|
||||||
|
|
||||||
|
## v3 (Fri Nov 11 2016 Jing Xu <jingxu@google.com>)
|
||||||
|
- Add startmounter.sh script to start rpcbind before mounting for NFSv3
|
||||||
|
- Digest: sha256:35bc48a1ca97c3971611dc4662d08d131869daa692acb281c7e9e052924e38b1
|
||||||
|
|
||||||
|
|
|
@ -16,5 +16,5 @@ FROM ubuntu:xenial
|
||||||
MAINTAINER vishh@google.com
|
MAINTAINER vishh@google.com
|
||||||
|
|
||||||
RUN apt-get update && apt-get install -y netbase nfs-common=1:1.2.8-9ubuntu12 glusterfs-client=3.7.6-1ubuntu1
|
RUN apt-get update && apt-get install -y netbase nfs-common=1:1.2.8-9ubuntu12 glusterfs-client=3.7.6-1ubuntu1
|
||||||
|
ADD startmounter.sh /startmounter.sh
|
||||||
ENTRYPOINT ["/bin/mount"]
|
ENTRYPOINT ["/startmounter.sh"]
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
TAG=v2
|
TAG=v3
|
||||||
REGISTRY=gcr.io/google_containers
|
REGISTRY=gcr.io/google_containers
|
||||||
IMAGE=gci-mounter
|
IMAGE=gci-mounter
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ set -o errexit
|
||||||
set -o nounset
|
set -o nounset
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
|
|
||||||
MOUNTER_VERSION=v2
|
MOUNTER_VERSION=v3
|
||||||
MOUNTER_USER=root
|
MOUNTER_USER=root
|
||||||
ROOT_DIR=/home/kubernetes/bin
|
ROOT_DIR=/home/kubernetes/bin
|
||||||
RKT_BINARY=${ROOT_DIR}/rkt
|
RKT_BINARY=${ROOT_DIR}/rkt
|
||||||
|
@ -31,9 +31,9 @@ function gc {
|
||||||
# Rkt pods end up creating new copies of mounts on the host. Hence it is ideal to clean them up right away.
|
# Rkt pods end up creating new copies of mounts on the host. Hence it is ideal to clean them up right away.
|
||||||
attempt=0
|
attempt=0
|
||||||
until [ $attempt -ge 5 ]; do
|
until [ $attempt -ge 5 ]; do
|
||||||
${RKT_BINARY} gc --grace-period=0s &> /dev/null && break
|
${RKT_BINARY} gc --grace-period=0s &> /dev/null && break
|
||||||
attempt=$[$attempt+1]
|
attempt=$[$attempt+1]
|
||||||
sleep 1
|
sleep 1
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,11 +45,17 @@ if [[ ! $(${RKT_BINARY} image list | grep ${MOUNTER_IMAGE}) ]]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Running mount using a rkt fly container"
|
echo "Running mount using a rkt fly container"
|
||||||
|
if ["$#" -eq 0 ]; then
|
||||||
${RKT_BINARY} run --stage1-path=${STAGE1_ACI} \
|
${RKT_BINARY} run --stage1-path=${STAGE1_ACI} \
|
||||||
--insecure-options=image \
|
--insecure-options=image \
|
||||||
--volume=kubelet,kind=host,source=/var/lib/kubelet,readOnly=false,recursive=true \
|
--volume=kubelet,kind=host,source=/var/lib/kubelet,readOnly=false,recursive=true \
|
||||||
--mount volume=kubelet,target=/var/lib/kubelet \
|
--mount volume=kubelet,target=/var/lib/kubelet \
|
||||||
${MOUNTER_IMAGE} --user=${MOUNTER_USER} --exec /bin/mount -- "$@"
|
${MOUNTER_IMAGE} --user=${MOUNTER_USER} --exec /bin/mount
|
||||||
|
else
|
||||||
|
${RKT_BINARY} run --stage1-path=${STAGE1_ACI} \
|
||||||
|
--insecure-options=image \
|
||||||
|
--volume=kubelet,kind=host,source=/var/lib/kubelet,readOnly=false,recursive=true \
|
||||||
|
--mount volume=kubelet,target=/var/lib/kubelet \
|
||||||
|
${MOUNTER_IMAGE} --user=${MOUNTER_USER} --exec /startmounter.sh -- "$@"
|
||||||
|
fi
|
||||||
echo "Successfully ran mount using a rkt fly container"
|
echo "Successfully ran mount using a rkt fly container"
|
||||||
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# 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.
|
||||||
|
|
||||||
|
# start rpcbind if it is not started yet
|
||||||
|
s=`/etc/init.d/rpcbind status`
|
||||||
|
if [[ $s == *"not running"* ]]; then
|
||||||
|
echo "Starting rpcbind: /sbin/rpcbind -w"
|
||||||
|
/sbin/rpcbind -w
|
||||||
|
fi
|
||||||
|
echo `/etc/init.d/rpcbind status`
|
||||||
|
|
||||||
|
# mount with passing paramaters
|
||||||
|
/bin/mount "${@}"
|
|
@ -360,7 +360,7 @@ var _ = framework.KubeDescribe("GCP Volumes", func() {
|
||||||
})
|
})
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////
|
||||||
// NFS
|
// NFSv4
|
||||||
////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
framework.KubeDescribe("NFSv4", func() {
|
framework.KubeDescribe("NFSv4", func() {
|
||||||
|
@ -393,6 +393,40 @@ var _ = framework.KubeDescribe("GCP Volumes", func() {
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
// NFSv3
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
framework.KubeDescribe("NFSv3", func() {
|
||||||
|
It("should be mountable for NFSv3", func() {
|
||||||
|
config := VolumeTestConfig{
|
||||||
|
namespace: namespace.Name,
|
||||||
|
prefix: "nfs",
|
||||||
|
serverImage: "gcr.io/google_containers/volume-nfs:0.8",
|
||||||
|
serverPorts: []int{2049, 20048},
|
||||||
|
}
|
||||||
|
|
||||||
|
defer func() {
|
||||||
|
if clean {
|
||||||
|
volumeTestCleanup(f, config)
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
pod := startVolumeServer(f, config)
|
||||||
|
serverIP := pod.Status.PodIP
|
||||||
|
framework.Logf("NFS server IP address: %v", serverIP)
|
||||||
|
|
||||||
|
volume := api.VolumeSource{
|
||||||
|
NFS: &api.NFSVolumeSource{
|
||||||
|
Server: serverIP,
|
||||||
|
Path: "/exports",
|
||||||
|
ReadOnly: true,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
// Must match content of test/images/volumes-tester/nfs/index.html
|
||||||
|
testVolumeClient(f, config, volume, nil, "Hello from NFS!")
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////
|
||||||
// Gluster
|
// Gluster
|
||||||
////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
|
|
@ -8,5 +8,5 @@ runcmd:
|
||||||
- mount -B -o remount,exec /home/kubernetes/bin
|
- mount -B -o remount,exec /home/kubernetes/bin
|
||||||
- wget https://storage.googleapis.com/kubernetes-release/rkt/v1.18.0/rkt -O /home/kubernetes/bin/rkt
|
- wget https://storage.googleapis.com/kubernetes-release/rkt/v1.18.0/rkt -O /home/kubernetes/bin/rkt
|
||||||
- wget https://storage.googleapis.com/kubernetes-release/rkt/v1.18.0/stage1-fly.aci -O /home/kubernetes/bin/stage1-fly.aci
|
- wget https://storage.googleapis.com/kubernetes-release/rkt/v1.18.0/stage1-fly.aci -O /home/kubernetes/bin/stage1-fly.aci
|
||||||
- wget https://storage.googleapis.com/kubernetes-release/gci-mounter/gci-mounter-v2.aci -O /home/kubernetes/bin/gci-mounter-v2.aci
|
- wget https://storage.googleapis.com/kubernetes-release/gci-mounter/gci-mounter-v3.aci -O /home/kubernetes/bin/gci-mounter-v3.aci
|
||||||
- chmod a+x /home/kubernetes/bin/rkt
|
- chmod a+x /home/kubernetes/bin/rkt
|
||||||
|
|
Loading…
Reference in New Issue