File tree 1 file changed +9
-9
lines changed
1 file changed +9
-9
lines changed Original file line number Diff line number Diff line change @@ -12,24 +12,24 @@ IAM_NAME="${GCEPD_SA_NAME}@${PROJECT}.iam.gserviceaccount.com"
12
12
# Create or Update Custom Role
13
13
if gcloud iam roles describe gcp_compute_persistent_disk_csi_driver_custom_role --project " ${PROJECT} " ;
14
14
then
15
- yes | gcloud iam roles update gcp_compute_persistent_disk_csi_driver_custom_role \
16
- --project " ${PROJECT} " \
15
+ gcloud iam roles update gcp_compute_persistent_disk_csi_driver_custom_role --quiet \
16
+ --project " ${PROJECT} " \
17
17
--file " ${PKGDIR} /deploy/gcp-compute-persistent-disk-csi-driver-custom-role.yaml"
18
18
else
19
- gcloud iam roles create gcp_compute_persistent_disk_csi_driver_custom_role \
20
- --project " ${PROJECT} " \
19
+ gcloud iam roles create gcp_compute_persistent_disk_csi_driver_custom_role --quiet \
20
+ --project " ${PROJECT} " \
21
21
--file " ${PKGDIR} /deploy/gcp-compute-persistent-disk-csi-driver-custom-role.yaml"
22
22
fi
23
23
24
24
# Delete Service Account Key
25
25
if [ -f $SA_FILE ]; then
26
26
rm " $SA_FILE "
27
27
fi
28
- # Delete Bindings
29
- for role in ${BIND_ROLES}
30
- do
31
- gcloud projects remove -iam-policy-binding " ${PROJECT} " --member serviceAccount: " ${IAM_NAME} " --role $role --quiet || true
32
- done
28
+ # Delete ALL EXISTING Bindings
29
+ gcloud projects get-iam-policy " ${PROJECT} " --format json > " ${PKGDIR} /deploy/iam.json "
30
+ sed -i " / ${IAM_NAME} /d " " ${PKGDIR} /deploy/iam.json "
31
+ gcloud projects set -iam-policy " ${PROJECT} " " ${PKGDIR} /deploy/iam.json "
32
+ rm -f " ${PKGDIR} /deploy/iam.json "
33
33
# Delete Service Account
34
34
gcloud iam service-accounts delete " $IAM_NAME " --quiet || true
35
35
You can’t perform that action at this time.
0 commit comments