Skip to content

Commit

Permalink
local SSD provision: reduce network traffic
Browse files Browse the repository at this point in the history
* use a single install command
* reduce the number of repositories that are updated
  • Loading branch information
gregwebs authored Jun 25, 2019
1 parent a1815fe commit 33c6cc4
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 24 deletions.
20 changes: 11 additions & 9 deletions manifests/gke/local-ssd-optimize.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,19 @@ spec:
value: |
#!/usr/bin/env bash
set -euo pipefail
export DEBIAN_FRONTEND=noninteractive
# Fix any issues
dpkg --configure -a
apt-get -y autoremove
apt-get update
apt-get install -y software-properties-common
apt-add-repository universe
# Avoid unecessary repository listings
test -f /etc/apt/sources.list.orig || cp /etc/apt/sources.list /etc/apt/sources.list.orig
cat /etc/apt/sources.list.orig | awk '/bionic main|bionic-updates main|bionic-updates universe/' > /etc/apt/sources.list
apt-get update
declare -a PKG_LIST=(python-google-compute-engine \
python3-google-compute-engine \
google-compute-engine-oslogin \
gce-compute-image-packages)
for pkg in ${PKG_LIST[@]}; do
apt-get install -y $pkg || echo "Not available: $pkg"
done
# Install required packages
apt-get install -y lvm2 python-google-compute-engine python3-google-compute-engine google-compute-engine-oslogin gce-compute-image-packages
# Restore original repository listings
cp /etc/apt/sources.list.orig /etc/apt/sources.list
mount | grep -v nobarrier | awk '/ssd/{print $1}' | xargs -i mount {} -o remount,nobarrier
volumeMounts:
- mountPath: /mnt/disks
Expand Down
24 changes: 9 additions & 15 deletions manifests/gke/local-ssd-provision/local-ssd-provision.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,24 +58,18 @@ spec:
# Install the linux guest environment tools
export DEBIAN_FRONTEND=noninteractive
cat /etc/apt/sources.list
# Fix any issues
dpkg --configure -a
apt-get update
apt-get install -y software-properties-common || echo "could not install software-properties-common"
apt-add-repository universe
apt-get update
declare -a PKG_LIST=(python-google-compute-engine \
python3-google-compute-engine \
google-compute-engine-oslogin \
gce-compute-image-packages)
for pkg in ${PKG_LIST[@]}; do
apt-get install -y $pkg || echo "Not available: $pkg"
done
apt-get install -y lvm2
apt-get -y autoremove
# Avoid unecessary repository listings
test -f /etc/apt/sources.list.orig || cp /etc/apt/sources.list /etc/apt/sources.list.orig
cat /etc/apt/sources.list.orig | awk '/bionic main|bionic-updates main|bionic-updates universe/' > /etc/apt/sources.list
apt-get update
# Install required packages
apt-get install -y lvm2 python-google-compute-engine python3-google-compute-engine google-compute-engine-oslogin gce-compute-image-packages
# Restore original repository listings
cp /etc/apt/sources.list.orig /etc/apt/sources.list
set -x
if ! findmnt -n -a -l | grep /mnt/disks/ssd ; then
if test -f /etc/ssd_mounts ; then
ssd_mounts=$(cat /etc/ssd_mounts)
Expand Down

0 comments on commit 33c6cc4

Please sign in to comment.