blob: 90c87b9caca2b39804453a45213e22692b5f3214 [file] [log] [blame]
# Creates the service account for perf.
set -e -x
source ../kube/
source ../bash/
# New service account we will create.
cd /tmp/ramdisk
gcloud iam service-accounts create "${SA_NAME}" --display-name="perf-ingest service account"
gcloud projects add-iam-policy-binding --project ${PROJECT} \
--member serviceAccount:${SA_NAME}@${PROJECT_SUBDOMAIN} \
--role roles/cloudtrace.agent
gcloud projects add-iam-policy-binding "${PROJECT_ID}" \
--member "serviceAccount:${SA_NAME}@${PROJECT_SUBDOMAIN}" \
--role roles/pubsub.editor
# Allow the new service account to impersonate the Google Cloud service account. See
gcloud iam service-accounts add-iam-policy-binding \
--role roles/iam.workloadIdentityUser \
--member "[default/skia-perf]" \
gsutil iam ch "serviceAccount:${SA_NAME}@${PROJECT_SUBDOMAIN}" gs://skia-perf
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
cd -