-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(deploy): ensure build_sa iams are set before it can be used (#394)
* fix(deploy): ensure build_sa iams are set before it can be used Fixes possible race condition in cloud functions deployment where the function build started before the build_sa had all its IAMs bound. * fix: Updates following further investigation/testing --------- Co-authored-by: henrybell <[email protected]>
- Loading branch information
Showing
16 changed files
with
146 additions
and
96 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -210,35 +210,6 @@ Autoscaler infrastructure, with the exception of Cloud Scheduler, lives. | |
[known issue][provider-issue] in the Terraform Google provider, please retry | ||
with -parallelism=1. | ||
|
||
If you are using a recently created project, or one that does not have permissions | ||
automatically assigned to default service accounts, you may see an error message | ||
similar to the following: | ||
|
||
```sh | ||
Error: Error waiting for Creating CloudFunctions Function: Error code 3, message: Build failed: failed to Fetch: failed to download archive gs://gcf-sources-[PROJECT_NUMBER]-us-central1/tf-poller-function-[UID]/version-1/function-source.zip: | ||
Access to bucket gcf-sources-[PROJECT_NUMBER]-us-central1 denied. You must grant Storage Object Viewer permission to [PROJECT_NUMBER][email protected]. | ||
``` | ||
|
||
A workaround for this issue is to run the following commands, which assign additional | ||
permissions to the default compute service account, which is used by Cloud Build: | ||
|
||
```sh | ||
PROJECT_ID=$(gcloud config get-value project) | ||
PROJECT_NUMBER=$(gcloud projects list --filter="$(gcloud config get-value project)" --format="value(PROJECT_NUMBER)") | ||
gcloud projects add-iam-policy-binding "${PROJECT_ID}" --member="serviceAccount:${PROJECT_NUMBER}"[email protected] --role='roles/storage.objectViewer' | ||
gcloud projects add-iam-policy-binding "${PROJECT_ID}" --member="serviceAccount:${PROJECT_NUMBER}"[email protected] --role='roles/logging.logWriter' | ||
gcloud projects add-iam-policy-binding "${PROJECT_ID}" --member="serviceAccount:${PROJECT_NUMBER}"[email protected] --role='roles/artifactregistry.writer' | ||
``` | ||
|
||
You can then re-run the `terraform apply` command listed above. | ||
|
||
Please note that the updates to the service account may take several | ||
minutes to propagate. The requirement for this workaround will be removed | ||
in an upcoming release. | ||
|
||
We recommend that you remove any unneeded permissions from the default compute | ||
service account when your use of the Spanner Autoscaler is complete. | ||
|
||
## Preparing the Application Project | ||
|
||
In this section you prepare the deployment of the Cloud Scheduler, Forwarder | ||
|
@@ -417,18 +388,6 @@ topic and function in the project where the Spanner instances live. | |
[known issue][provider-issue] in the Terraform Google provider, please retry | ||
with -parallelism=1 | ||
If you are using a recently created project, or one that does not have permissions | ||
automatically assigned to default service accounts, you may see an error message | ||
similar to the following: | ||
```sh | ||
Error: Error waiting for Creating CloudFunctions Function: Error code 3, message: Build failed: failed to Fetch: failed to download archive gs://gcf-sources-[PROJECT_NUMBER]-us-central1/tf-poller-function-[UID]/version-1/function-source.zip: | ||
Access to bucket gcf-sources-[PROJECT_NUMBER]-us-central1 denied. You must grant Storage Object Viewer permission to [PROJECT_NUMBER][email protected]. | ||
``` | ||
If you see this issue, please follow the instructions in the section | ||
[Deploying the Autoscaler](#deploying-the-autoscaler) above. | ||
### Authorize the Forwarder function to publish to the Poller topic | ||
1. Switch back to the Autoscaler project and ensure that Terraform variables | ||
|
21 changes: 20 additions & 1 deletion
21
terraform/cloud-functions/distributed/app-project/.terraform.lock.hcl
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 20 additions & 1 deletion
21
terraform/cloud-functions/distributed/autoscaler-project/.terraform.lock.hcl
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -294,35 +294,6 @@ In this section you prepare your project for deployment. | |
[known issue][provider-issue] in the Terraform Google provider, please retry | ||
the command above and include the flag `-parallelism=1`. | ||
If you are using a recently created project, or one that does not have permissions | ||
automatically assigned to default service accounts, you may see an error message | ||
similar to the following: | ||
```sh | ||
Error: Error waiting for Creating CloudFunctions Function: Error code 3, message: Build failed: failed to Fetch: failed to download archive gs://gcf-sources-[PROJECT_NUMBER]-us-central1/tf-poller-function-[UID]/version-1/function-source.zip: | ||
Access to bucket gcf-sources-[PROJECT_NUMBER]-us-central1 denied. You must grant Storage Object Viewer permission to [PROJECT_NUMBER][email protected]. | ||
``` | ||
A workaround for this issue is to run the following commands, which assign additional | ||
permissions to the default compute service account, which is used by Cloud Build: | ||
```sh | ||
PROJECT_ID=$(gcloud config get-value project) | ||
PROJECT_NUMBER=$(gcloud projects list --filter="$(gcloud config get-value project)" --format="value(PROJECT_NUMBER)") | ||
gcloud projects add-iam-policy-binding "${PROJECT_ID}" --member="serviceAccount:${PROJECT_NUMBER}"[email protected] --role='roles/storage.objectViewer' | ||
gcloud projects add-iam-policy-binding "${PROJECT_ID}" --member="serviceAccount:${PROJECT_NUMBER}"[email protected] --role='roles/logging.logWriter' | ||
gcloud projects add-iam-policy-binding "${PROJECT_ID}" --member="serviceAccount:${PROJECT_NUMBER}"[email protected] --role='roles/artifactregistry.writer' | ||
``` | ||
You can then re-run the `terraform apply` command listed above. | ||
Please note that the updates to the service account may take several | ||
minutes to propagate. The requirement for this workaround will be removed | ||
in an upcoming release. | ||
We recommend that you remove any unneeded permissions from the default compute | ||
service account when your use of the Spanner Autoscaler is complete. | ||
## Importing your Spanner instances | ||
If you have existing Spanner instances that you want to | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.