-
Notifications
You must be signed in to change notification settings - Fork 128
Expand file tree
/
Copy pathinstall-dataplane-serviceaccount
More file actions
executable file
·43 lines (34 loc) · 1.58 KB
/
install-dataplane-serviceaccount
File metadata and controls
executable file
·43 lines (34 loc) · 1.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/bin/bash
DIR="$(dirname "$0")"
. "${DIR}/config"
set -v
# Doc:
# https://github.com/google/knative-gcp/blob/master/docs/install/dataplane-service-account.md
# Enable the Cloud Pub/Sub API on your project:
gcloud services enable pubsub.googleapis.com
# Create a new Service Account named
gcloud iam service-accounts create events-sources-gsa
# Give that Service Account the necessary permissions
# Note: You probably need something more fine-grained than roles/pubsub.editor
gcloud projects add-iam-policy-binding ${PROJECT_ID} \
--member=serviceAccount:events-sources-gsa@${PROJECT_ID}.iam.gserviceaccount.com \
--role roles/pubsub.editor
# Needed for init scripts
curl -s https://raw.githubusercontent.com/google/knative-gcp/master/hack/lib.sh --output lib.sh
gcloud config set run/cluster ${CLUSTER_NAME}
gcloud config set run/cluster_location ${CLUSTER_ZONE}
gcloud config set project ${PROJECT_ID}
if [ "$1" == "workload" ]; then
echo "TODO"
# gcloud iam service-accounts add-iam-policy-binding \
# cre-dataplane@${PROJECT_ID}.iam.gserviceaccount.com \
# --member=serviceAccount:cloud-run-events@${PROJECT_ID}.iam.gserviceaccount.com \
# --role=roles/iam.serviceAccountAdmin
# echo "Note: You need to manually modify clusterDefaults in ConfigMap config-gcp-auth, as described in the docs."
else
#bash <(curl -s https://raw.githubusercontent.com/google/knative-gcp/master/hack/init_data_plane.sh)
curl -s https://raw.githubusercontent.com/google/knative-gcp/master/hack/init_data_plane.sh --output init_data_plane.sh
bash init_data_plane.sh
rm init_data_plane.sh
fi
rm lib.sh