Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add timeoutSeconds to cloud run #3622

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions products/cloudrun/api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -540,6 +540,10 @@ objects:
the default value.
- `1` not-thread-safe. Single concurrency
- `2-N` thread-safe, max concurrency of N
- !ruby/object:Api::Type::Integer
name: timeoutSeconds
description: |-
TimeoutSeconds holds the max duration the instance is allowed for responding to a request.
- !ruby/object:Api::Type::String
name: serviceAccountName
description: |-
Expand Down
2 changes: 2 additions & 0 deletions products/cloudrun/terraform.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,8 @@ overrides: !ruby/object:Overrides::ResourceOverrides
default_from_api: true
spec.template.spec.containerConcurrency: !ruby/object:Overrides::Terraform::PropertyOverride
default_from_api: true
spec.template.spec.timeoutSeconds: !ruby/object:Overrides::Terraform::PropertyOverride
default_from_api: true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the default a known value, or might it change depending on how a user configures their service? If we know what it's going to be, it makes more sense to hardcode the default (https://github.com/terraform-providers/terraform-provider-google/wiki/Developer-Best-Practices#default-values)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's depends for fully managed or Cloud Run for Anthos.
From documentations https://cloud.google.com/run/docs/configuring/request-timeout#command-line it's 5 minutes for fully managed(but I think it's 15 minutes from my last test).
I think better use default from API, because it's related to user billing because fully managed cloud run users pay for time of request.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense, thanks for the explanation!

spec.template.spec.containers: !ruby/object:Overrides::Terraform::PropertyOverride
default_from_api: true
spec.template.spec.containers.resources: !ruby/object:Overrides::Terraform::PropertyOverride
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func TestAccCloudRunService_cloudRunServiceUpdate(t *testing.T) {
Providers: testAccProviders,
Steps: []resource.TestStep{
{
Config: testAccCloudRunService_cloudRunServiceUpdate(name, project, "10"),
Config: testAccCloudRunService_cloudRunServiceUpdate(name, project, "10", "600"),
},
{
ResourceName: "google_cloud_run_service.default",
Expand All @@ -27,7 +27,7 @@ func TestAccCloudRunService_cloudRunServiceUpdate(t *testing.T) {
ImportStateVerifyIgnore: []string{"metadata.0.resource_version", "status.0.conditions"},
},
{
Config: testAccCloudRunService_cloudRunServiceUpdate(name, project, "50"),
Config: testAccCloudRunService_cloudRunServiceUpdate(name, project, "50", "300"),
},
{
ResourceName: "google_cloud_run_service.default",
Expand All @@ -39,7 +39,7 @@ func TestAccCloudRunService_cloudRunServiceUpdate(t *testing.T) {
})
}

func testAccCloudRunService_cloudRunServiceUpdate(name, project, concurrency string) string {
func testAccCloudRunService_cloudRunServiceUpdate(name, project, concurrency, timeoutSeconds string) string {
return fmt.Sprintf(`
resource "google_cloud_run_service" "default" {
name = "%s"
Expand All @@ -56,6 +56,7 @@ resource "google_cloud_run_service" "default" {
args = ["arrgs"]
}
container_concurrency = %s
timeout_seconds = %s
}
}

Expand All @@ -64,5 +65,5 @@ resource "google_cloud_run_service" "default" {
latest_revision = true
}
}
`, name, project, concurrency)
`, name, project, concurrency, timeoutSeconds)
}