From 19c19c2e0f8a0f7105d6a5c6f660bc902aba3386 Mon Sep 17 00:00:00 2001 From: Vishnu kannan Date: Fri, 21 Oct 2016 17:36:17 -0700 Subject: [PATCH] Updating GCI mounter to be containerized Signed-off-by: Vishnu kannan --- cluster/gce/gci/mounter/mounter | 18 +++++++++++++++++- test/e2e_node/remote/remote.go | 12 ++++++------ 2 files changed, 23 insertions(+), 7 deletions(-) mode change 100644 => 100755 cluster/gce/gci/mounter/mounter diff --git a/cluster/gce/gci/mounter/mounter b/cluster/gce/gci/mounter/mounter old mode 100644 new mode 100755 index 78ad6c0d424..4c80eb566f9 --- a/cluster/gce/gci/mounter/mounter +++ b/cluster/gce/gci/mounter/mounter @@ -17,4 +17,20 @@ set -e set -o pipefail -sudo /bin/mount "$@" \ No newline at end of file +MOUNTER_DOCKER_IMAGE=gcr.io/google_containers/gci-mounter +MOUNTER_DOCKER_VERSION=v1 +MOUNTER_USER=root +RKT_BINARY=/home/kubernetes/bin/rkt + +function gc { + ${RKT_BINARY} gc --grace-period=0s &> /dev/null +} + +# Garbage collect old rkt containers on exit +trap gc EXIT + +${RKT_BINARY} run --stage1-name="coreos.com/rkt/stage1-fly:1.17.0" \ + --insecure-options=image \ + --volume=rootfs,kind=host,source=/,readOnly=false,recursive=true \ + --mount volume=rootfs,target=/media/root \ + docker://${MOUNTER_DOCKER_IMAGE}:${MOUNTER_DOCKER_VERSION} --user=${MOUNTER_USER} --exec /bin/mount -- "$@" diff --git a/test/e2e_node/remote/remote.go b/test/e2e_node/remote/remote.go index e5fbd40c029..4252b3416e4 100644 --- a/test/e2e_node/remote/remote.go +++ b/test/e2e_node/remote/remote.go @@ -42,10 +42,11 @@ var resultsDir = flag.String("results-dir", "/tmp/", "Directory to scp test resu var sshOptionsMap map[string]string const ( - archiveName = "e2e_node_test.tar.gz" - CNIRelease = "07a8a28637e97b22eb8dfe710eeae1344f69d16e" - CNIDirectory = "cni" - mounterRootfsPath string = "/" + archiveName = "e2e_node_test.tar.gz" + CNIRelease = "07a8a28637e97b22eb8dfe710eeae1344f69d16e" + CNIDirectory = "cni" + // Note: This path needs to be in sync with the "target" path for `/` in cluster/gce/gci/mounter/mounter + mounterRootfsPath string = "/media/root" ) var CNIURL = fmt.Sprintf("https://storage.googleapis.com/kubernetes-release/network-plugins/cni-%s.tar.gz", CNIRelease) @@ -264,8 +265,6 @@ func RunRemote(archive string, host string, cleanup bool, junitFilePrefix string return "", false, fmt.Errorf("Issue detecting node's OS via node's /etc/os-release. Err: %v, Output:\n%s", err, output) } if strings.Contains(output, "ID=gci") { - glog.Infof("GCI node and GCI mounter both detected, modifying --mounter-path & --experimental-mounter-rootfs-path accordingly") - // Note this implicitly requires the script to be where we expect in the tarball, so if that location changes the error // here will tell us to update the remote test runner. mounterPath := filepath.Join(tmp, "cluster/gce/gci/mounter/mounter") @@ -277,6 +276,7 @@ func RunRemote(archive string, host string, cleanup bool, junitFilePrefix string // Insert args at beginning of testArgs, so any values from command line take precedence testArgs = fmt.Sprintf("--experimental-mounter-rootfs-path=%s ", mounterRootfsPath) + testArgs testArgs = fmt.Sprintf("--experimental-mounter-path=%s ", mounterPath) + testArgs + glog.Infof("GCI node and GCI mounter both detected, setting --experimental-mounter-path=%q and --experimental-mounter-rootfs-path=%q accordingly", mounterPath, mounterRootfsPath) } // Run the tests