blob: 1bafb16574f42fbe91f109f7756a8a106223440c [file] [log] [blame]
# Creates the service account for perf-ingest.
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_ID}" \
--member "serviceAccount:${SA_NAME}@${PROJECT_SUBDOMAIN}" \
--role roles/pubsub.editor
gcloud projects add-iam-policy-binding --project ${PROJECT} \
--member serviceAccount:${SA_NAME}@${PROJECT_SUBDOMAIN} \
--role roles/cloudtrace.agent
# 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/perf-ingest]" \
gsutil iam ch "serviceAccount:${SA_NAME}@${PROJECT_SUBDOMAIN}" gs://skia-perf
gsutil iam ch "serviceAccount:${SA_NAME}@${PROJECT_SUBDOMAIN}" gs://cluster-telemetry-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 -