blob: 8c07276e2cf6f03c3a81efd668f18e86f3e3b3fe [file] [log] [blame]
# Creates the service account for alert-to-pubsub.
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
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}"
gcloud projects add-iam-policy-binding "${PROJECT_ID}" \
--member "serviceAccount:${SA_NAME}@${PROJECT_SUBDOMAIN}" \
--role roles/pubsub.editor
kubectl create secret generic "${SA_NAME}" --from-file=key.json=${SA_NAME}.json
cd -