forked from kubernetes/k8s.io
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathensure-releng.sh
executable file
·69 lines (57 loc) · 1.99 KB
/
ensure-releng.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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/usr/bin/env bash
#
# Copyright 2019 The Kubernetes Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# This script is used to ensure Release Engineering subproject owners have the
# appropriate access to SIG Release prod GCP projects.
#
# Projects:
# - k8s-releng-prod - Stores KMS objects which other release projects will
# be granted permission to decrypt e.g., GITHUB_TOKEN
set -o errexit
set -o nounset
set -o pipefail
SCRIPT_DIR=$(dirname "${BASH_SOURCE[0]}")
. "${SCRIPT_DIR}/lib.sh"
function usage() {
echo "usage: $0 [project...]" > /dev/stderr
echo "example:" > /dev/stderr
echo " $0 # do all release projects" > /dev/stderr
echo " $0 k8s-releng-prod # just do one" > /dev/stderr
echo > /dev/stderr
}
# NB: Please keep this sorted.
PROJECTS=(
k8s-releng-prod
)
if [ $# = 0 ]; then
# default to all release projects
set -- "${PROJECTS[@]}"
fi
for PROJECT; do
color 3 "Configuring: ${PROJECT}"
# Make the project, if needed
color 6 "Ensuring project exists: ${PROJECT}"
ensure_project "${PROJECT}"
# Enable admins to use the UI
color 6 "Empowering ${RELEASE_ADMINS} as project viewers"
empower_group_as_viewer "${PROJECT}" "${RELEASE_ADMINS}"
# Enable KMS APIs
color 6 "Enabling the KMS API"
enable_api "${PROJECT}" cloudkms.googleapis.com
# Let project admins use KMS.
color 6 "Empowering ${RELEASE_ADMINS} as KMS admins"
empower_group_for_kms "${PROJECT}" "${RELEASE_ADMINS}"
color 6 "Done"
done