Google Cloud Storage
Using Google Cloud Storage (GCS) as a storage source means that Spinnaker will store all of its persistent data in a Bucket .
Prerequisites
You need a
Google Cloud Platform
(GCP) project to host your bucket in. The next steps assume you’ve already
created a project
,
and installed
gcloud
.
You can check that gcloud
is installed and authenticated by running:
gcloud info
Downloading credentials
Spinnaker needs a
service
account
to authenticate as against GCP, with the roles/storage.admin
role enabled. If
you don’t already have such a service account with the corresponding JSON key
downloaded, you can run the following commands to do so:
SERVICE_ACCOUNT_NAME=spinnaker-gcs-account
SERVICE_ACCOUNT_DEST=~/.gcp/gcs-account.json
gcloud iam service-accounts create \
$SERVICE_ACCOUNT_NAME \
--display-name $SERVICE_ACCOUNT_NAME
SA_EMAIL=$(gcloud iam service-accounts list \
--filter="displayName:$SERVICE_ACCOUNT_NAME" \
--format='value(email)')
PROJECT=$(gcloud config get-value project)
gcloud projects add-iam-policy-binding $PROJECT \
--role roles/storage.admin --member serviceAccount:$SA_EMAIL
mkdir -p $(dirname $SERVICE_ACCOUNT_DEST)
gcloud iam service-accounts keys create $SERVICE_ACCOUNT_DEST \
--iam-account $SA_EMAIL
Once you have run these commands, your GCS JSON key is sitting in a file
called $SERVICE_ACCOUNT_DEST
.
Editing Your Storage Settings
Halyard will create a bucket for you if the bucket you specify doesn’t exist yet, or if you don’t specify one at all. All that’s required are the following values (we’ve provided defaults for you):
PROJECT=$(gcloud config get-value project)
# see https://cloud.google.com/storage/docs/bucket-locations
BUCKET_LOCATION=us
SERVICE_ACCOUNT_DEST=# see Prerequisites section above
First, edit the storage settings:
hal config storage gcs edit --project $PROJECT \
--bucket-location $BUCKET_LOCATION \
--json-path $SERVICE_ACCOUNT_DEST
There are more options described here if you need more control over your configuration.
Finally, set the storage source to GCS:
hal config storage edit --type gcs
Next steps
After you’ve set up GCS as your external storage service, you’re ready to deploy Spinnaker .