Skip to content

Commit

Permalink
Improvements in run-script
Browse files Browse the repository at this point in the history
fix a bad-check in run-script
add more install dependencies needed on gce vm
improvement dependency installations for gce vm
fixes in run-script for gce vm
Install docker as a dependency
Don't create package bucket with google in name
fix helm installation
add mash installation
  • Loading branch information
gargnitingoogle committed Aug 16, 2024
1 parent 411e983 commit b6a0e76
Showing 1 changed file with 45 additions and 5 deletions.
50 changes: 45 additions & 5 deletions perfmetrics/scripts/testing_on_gke/examples/run-gke-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -116,12 +116,14 @@ test -z "${gcsfuse_mount_options}" || (echo "gcsfuse_mount_options set by user i
# Test runtime configuration
test -n "${pod_wait_time_in_seconds}" || export pod_wait_time_in_seconds="${DEFAULT_POD_WAIT_TIME_IN_SECONDS}"
test -n "${instance_id}" || export instance_id="${DEFAULT_INSTANCE_ID}"

if test -n "${workload_config}"; then
workload_config="$(realpath "${workload_config}")"
test -f "${workload_config}"
else
export workload_config="${gke_testing_dir}"/examples/workloads.json
fi
test -f "${workload_config}"

if test -n "${output_dir}"; then
output_dir="$(realpath "${output_dir}")"
else
Expand Down Expand Up @@ -161,12 +163,50 @@ function printRunParameters() {

# Install dependencies.
function installDependencies() {
# Ensure that realpath is installed
which realpath
# Ensure that python3 is installed.
which python3
# Ensure that make is installed
which make || (sudo apt-get update && sudo apt-get install -y make time)
# Ensure that go is installed
which go || (version=1.22.4 && wget -O go_tar.tar.gz https://go.dev/dl/go${version}.linux-amd64.tar.gz 1>/dev/null && sudo rm -rf /usr/local/go && tar -xzf go_tar.tar.gz 1>/dev/null && sudo mv go /usr/local && echo $PATH && export PATH=$PATH:/usr/local/go/bin && echo $PATH && echo 'export PATH=$PATH:/usr/local/go/bin'>>~/.bashrc && go version)
# for some reason, the above is unable to update the value of $PATH, so doing it explicitly below
export PATH=$PATH:/usr/local/go/bin
which go
# Ensure that python-absl is installed.
sudo apt-get update && sudo apt-get install -y pip && pip install absl-py
# Ensure that helm is installed
which helm || (cd "${src_dir}" && (test -d "./helm" || git clone https://github.com/helm/helm.git) && cd helm && make && ls -lh bin/ && mkdir -pv ~/bin && cp -fv bin/helm ~/bin/ && chmod +x ~/bin/helm && export PATH=$PATH:$HOME/bin && echo $PATH && which helm && cd - && cd -)
which go || (version=1.22.4 && wget -O go_tar.tar.gz https://go.dev/dl/go${version}.linux-amd64.tar.gz && sudo rm -rf /usr/local/go && tar -xzf go_tar.tar.gz && sudo mv go /usr/local && export PATH=${PATH}:/usr/local/go/bin && go version && rm -rfv go_tar.tar.gz && echo 'export PATH=${PATH}:/usr/local/go/bin' >>~/.bashrc)
which python3 && sudo apt-get install python3-absl
(which kubectl && kubectl version --client) || (gcloud components install kubectl && which kubectl && kubectl version --client) || (sudo apt-get update -y && sudo apt-get install -y kubectl && which kubectl && kubectl version --client)
# for some reason, the above is unable to update the value of $PATH, so doing it explicitly below
export PATH=$PATH:$HOME/bin
which helm
# Ensure that kubectl is installed
if ! which kubectl; then
# full instructions at https://cloud.google.com/kubernetes-engine/docs/how-to/cluster-access-for-kubectl .
#install the latest gcloud cli
sudo apt-get update && sudo apt-get install -y apt-transport-https ca-certificates gnupg curl
# Import the Google Cloud public key (Debian 9+ or Ubuntu 18.04+)
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo gpg --dearmor -o /usr/share/keyrings/cloud.google.gpg
# Add the gcloud CLI distribution URI as a package source (Debian 9+ or Ubuntu 18.04+)
echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main" | sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list
# Update and install the gcloud CLI
sudo apt-get update && sudo apt-get install -y google-cloud-cli
# install kubectl
(gcloud components install kubectl && kubectl version --client) || (sudo apt-get update && sudo apt-get install -y kubectl && kubectl version --client)
fi
gke-gcloud-auth-plugin --version || (gcloud components install gke-gcloud-auth-plugin && gke-gcloud-auth-plugin --version) || (sudo apt-get update -y && sudo apt-get install -y google-cloud-cli-gke-gcloud-auth-plugin && gke-gcloud-auth-plugin --version)
# Ensure that docker is installed.
if ! which docker ; then
sudo apt-get update
sudo apt install apt-transport-https ca-certificates curl software-properties-common -y
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable"
apt-cache policy docker-ce
sudo apt install docker-ce -y
fi
# Ensure that mash is available.
which mash || (sudo apt-get update && sudo apt-get install -y monarch-tools)
}

# Ensure gcloud auth/config.
Expand Down Expand Up @@ -363,7 +403,7 @@ function createCustomCsiDriverIfNeeded() {
echo "Building custom CSI driver ..."

# Create a bucket for storing custom-csi driver.
test -n "${package_bucket}" || export package_bucket=${USER}-gcsfuse-binary-package
test -n "${package_bucket}" || export package_bucket=${USER/google/}-gcsfuse-binary-package
(gcloud storage buckets list | grep -wqo ${package_bucket}) || (region=$(echo ${zone} | rev | cut -d- -f2- | rev) && gcloud storage buckets create gs://${package_bucket} --location=${region})

# Build a new gcsfuse binary
Expand Down

0 comments on commit b6a0e76

Please sign in to comment.