From e5c61922f877d1e9c5ccd18532528498d0b9ea8d Mon Sep 17 00:00:00 2001 From: Vishnu Kannan Date: Fri, 28 Oct 2016 13:40:30 -0700 Subject: [PATCH] In gci mounter script, expose /var/lib/kubelet only and add more debugging logs. Added a retry for rkt gc just to be safe. Signed-off-by: Vishnu Kannan --- cluster/gce/gci/mounter/mounter | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/cluster/gce/gci/mounter/mounter b/cluster/gce/gci/mounter/mounter index e8a6dd2ec8..9953beadce 100755 --- a/cluster/gce/gci/mounter/mounter +++ b/cluster/gce/gci/mounter/mounter @@ -23,14 +23,25 @@ MOUNTER_USER=root RKT_BINARY=/home/kubernetes/bin/rkt function gc { - ${RKT_BINARY} gc --grace-period=0s &> /dev/null + # Attempt to garbage collect rkt pods with 5 retries. + # Rkt pods end up creating new copies of mounts on the host. Hence it is ideal to clean them up right away. + attempt=0 + until [ $attempt -ge 5 ]; do + ${RKT_BINARY} gc --grace-period=0s && break + attempt=$[$attempt+1] + sleep 1 + done } # Garbage collect old rkt containers on exit trap gc EXIT +echo "Running mount using a rkt fly container" + ${RKT_BINARY} run --stage1-name="coreos.com/rkt/stage1-fly:1.18.0" \ --insecure-options=image \ - --volume=rootfs,kind=host,source=/,readOnly=false,recursive=true \ - --mount volume=rootfs,target=/media/root \ + --volume=kubelet,kind=host,source=/var/lib/kubelet,readOnly=false,recursive=true \ + --mount volume=kubelet,target=/var/lib/kubelet \ docker://${MOUNTER_DOCKER_IMAGE}:${MOUNTER_DOCKER_VERSION} --user=${MOUNTER_USER} --exec /bin/mount -- "$@" + +echo "Successfully ran mount using a rkt fly container" \ No newline at end of file