blob: 804d63917aa47f702358df0e89b0d54dfb613f0d [file] [log] [blame]
# Creates the service account for alert-to-pubsub in skia-corp.
set -e -x
source ../kube/
source ../bash/
# New service account we will create. Name must be the same for all clusters
# that alert-to-pubsub runs in.
cd /tmp/ramdisk
# Create the service account in skia-corp and add as a secret to the cluster.
gcloud iam service-accounts create "${SA_NAME}" --display-name="alert-to-pubsub service account."
gcloud beta iam service-accounts keys create ${SA_NAME}.json --iam-account="${SA_NAME}@${PROJECT_SUBDOMAIN}"
kubectl create secret generic "${SA_NAME}" --from-file=key.json=${SA_NAME}.json
# Change to skia-public and give the service account editor access to PubSub.
gcloud projects add-iam-policy-binding skia-public \
--member "serviceAccount:${SA_NAME}@${PROJECT_SUBDOMAIN}" \
--role roles/pubsub.editor
cd -