-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsetup_storage.sh
executable file
·32 lines (27 loc) · 1.45 KB
/
setup_storage.sh
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
#!/bin/bash -
#===============================================================================
#
# FILE: setup_storage.sh
#
# USAGE: ./setup_storage.sh
#
# DESCRIPTION: Configures storage for personal prow instance
# Plank has a dependancy on Google Cloud Storage
# REFS: taken from getting_started_deploy.md#configure-cloud-storage
# in test-infra repo
# AUTHOR: Robert Kielty (robk), [email protected]
# ORGANIZATION:
# CREATED: 03/11/19 10:56:25
#===============================================================================
set -o nounset # Treat unset variables as an error
set -o errexit
declare PERSONAL_PROW_ARTEFACTS="robk-personal-prow-artifacts"
# TODO make idempotent if gcloud iam service-accounts list --filter='name:prow-gcs-publisher'
# TODO gcloud iam service-accounts create prow-gcs-publisher # step 1
identifier="$( gcloud iam service-accounts list --filter 'name:prow-gcs-publisher' --format 'value(email)' )"
#gsutil mb gs://"${PERSONAL_PROW_ARTEFACTS}"/ # step 2
# gsutil iam ch allUsers:objectViewer gs://"${PERSONAL_PROW_ARTIFACTS}"
# step 3
gsutil iam ch "serviceAccount:${identifier}:objectAdmin" gs://"${PERSONAL_PROW_ARTEFACTS}" # step 4
gcloud iam service-accounts keys create --iam-account "${identifier}" service-account.json # step 5
kubectl -n test-pods create secret generic gcs-credentials --from-file=service-account.json # step 6