From e2db919508237cfac619a85b0d362bbd44c14b03 Mon Sep 17 00:00:00 2001 From: Dustin Specker Date: Tue, 23 Mar 2021 10:31:39 -0500 Subject: [PATCH] feat(deploy-k8s): only create tempfs for etcd data during CI This enables rebooting the Vagrant VM during local development and having the Kubernetes cluster persist. Without this change, the etcd data directory does not persist during reboots, meaning all Kubernetes resources (besides static pods) are lost. Change-Id: I3538491ee69fbb955049130634d7b03ed520403f --- tools/gate/deploy-k8s.sh | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/tools/gate/deploy-k8s.sh b/tools/gate/deploy-k8s.sh index ffaed25e..0aea5720 100755 --- a/tools/gate/deploy-k8s.sh +++ b/tools/gate/deploy-k8s.sh @@ -119,9 +119,14 @@ sudo -E apt-get install -y \ git-review \ notary -# Prepare tmpfs for etcd -sudo mkdir -p /var/lib/minikube/etcd -sudo mount -t tmpfs -o size=512m tmpfs /var/lib/minikube/etcd +# Prepare tmpfs for etcd when running on CI +# CI VMs can have slow I/O causing issues for etcd +# Only do this on CI (when user is zuul), so that local development can have a kubernetes +# environment that will persist on reboot since etcd data will stay intact +if [ "$USER" = "zuul" ]; then + sudo mkdir -p /var/lib/minikube/etcd + sudo mount -t tmpfs -o size=512m tmpfs /var/lib/minikube/etcd +fi # Install YQ wget https://github.com/mikefarah/yq/releases/download/${YQ_VERSION}/yq_linux_amd64.tar.gz -O - | tar xz && sudo mv yq_linux_amd64 /usr/local/bin/yq