builds/infra-sa-gke-mci-roles.yaml (21 lines of code) (raw):

# Copyright 2022 Google LLC # # 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. timeout: 7200s # 2hr tags: - infra-sa-gke-mci-roles substitutions: _PROJECT_ID: ${PROJECT_ID} steps: - name: "gcr.io/cloud-builders/gcloud" id: "infra-sa-gke-mci-roles" entrypoint: bash dir: "infra" args: - -c - | PROJECT_NUMBER=$(gcloud projects describe ${_PROJECT_ID} --format="value(projectNumber)") echo -e "PROJECT_NUMBER is $${PROJECT_NUMBER}" gcloud projects add-iam-policy-binding ${_PROJECT_ID} \ --member "serviceAccount:service-$${PROJECT_NUMBER}@gcp-sa-multiclusteringress.iam.gserviceaccount.com" \ --role "roles/container.admin" gcloud projects add-iam-policy-binding ${_PROJECT_ID} \ --member "serviceAccount:service-$${PROJECT_NUMBER}@gcp-sa-multiclusteringress.iam.gserviceaccount.com" \ --role "roles/compute.networkViewer"