Commit 0e7dc8f7 authored by Daniel Stone's avatar Daniel Stone
Browse files

Move misc GCP scripts to their own folder



Signed-off-by: Daniel Stone's avatarDaniel Stone <daniels@collabora.com>
parent 9b10a961
......@@ -58,6 +58,11 @@ Runners are created with `gitlab-runner-provision/gitlab-runner-packet.sh`, whic
The runners should mostly not be reconfigured on the fly with SSH, but instead deleted and reprovisioned.
## Scripts for backup and re-deployment
The `gcp-scripts` folder holds a number of scripts used to create new Kubernetes clusters, imaging and attaching the existing volumes used for data storage, and allowing them to be copied between clusters. This is mostly only used when recreating a Kubernetes cluster, which is not something we have done since GKE has got better support for dynamically changing cluster attributes. Nevertheless, they're probably still useful to someone somewhere, particularly if you want to set up a new test cluster instance with the existing data.
## Creating a new GitLab deployment
Something bad has happened! Time to rebuild from scratch. :(
......
#!/bin/bash
for disk in $(gcloud compute disks list --format='value(name)'); do
echo checking $disk
users=$(gcloud compute disks describe --zone=us-east1-b --format='value(users)' $disk | xargs echo -n)
if [ -z "$users" ]; then
echo " ... disk not in use, last attached $(gcloud compute disks describe --zone=us-east1-b --format='value(lastAttachTimestamp)' $disk)"
gcloud compute disks delete --zone=us-east1-b $disk
else
echo " ... disk in use by $users"
fi
done
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment