Merge from master

This commit is contained in:
Mikhail Timofeev
2020-05-14 15:29:37 +03:00
5 changed files with 57 additions and 95 deletions

View File

@@ -1,42 +0,0 @@
#!/bin/bash
################################################################################
## File: kubernetes-tools.sh
## Desc: Installs kubectl, helm
################################################################################
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
source $HELPER_SCRIPTS/apt.sh
## Install kubectl
apt-get install -y apt-transport-https
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -
touch /etc/apt/sources.list.d/kubernetes.list
# Based on https://kubernetes.io/docs/tasks/tools/install-kubectl/, package is still called xenial
echo "deb http://apt.kubernetes.io/ kubernetes-xenial main" | tee -a /etc/apt/sources.list.d/kubernetes.list
apt-get update
apt-get install -y kubectl
# Install Helm
curl https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | bash
# Run tests to determine that the software installed as expected
echo "Testing to make sure that script performed as expected, and basic scenarios work"
if ! command -v kubectl; then
echo "kubectl was not installed"
exit 1
fi
if ! command -v helm; then
echo "helm was not installed"
exit 1
fi
echo "Initializing helm"
helm init --client-only
# Document what was added to the image
echo "Lastly, documenting what we added to the metadata file"
DocumentInstalledItem "kubectl ($(kubectl version --short |& head -n 1))"
DocumentInstalledItem "helm ($(helm version --short |& head -n 1))"

View File

@@ -6,6 +6,7 @@ before=$(df / -Pm | awk 'NR==2{print $4}')
# clears out the local repository of retrieved package files
# It removes everything but the lock file from /var/cache/apt/archives/ and /var/cache/apt/archives/partial
apt-get clean
rm -rf /tmp/*
# after cleanup
after=$(df / -Pm | awk 'NR==2{print $4}')

View File

@@ -5,7 +5,7 @@
################################################################################
availableSpaceMB=$(df / -hm | sed 1d | awk '{ print $4}')
minimumFreeSpaceMB=18000
minimumFreeSpaceMB=17800
echo "Available disk space: $availableSpaceMB MB"
if [ $availableSpaceMB -le $minimumFreeSpaceMB ]; then