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

startup_cpu_boost not works in google_cloud_run_v2_service #20784

Open
leowang-vsgames opened this issue Dec 25, 2024 · 6 comments
Open

startup_cpu_boost not works in google_cloud_run_v2_service #20784

leowang-vsgames opened this issue Dec 25, 2024 · 6 comments
Labels
bug forward/review In review; remove label to forward service/run

Comments

@leowang-vsgames
Copy link

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request.
  • Please do not leave +1 or me too comments, they generate extra noise for issue followers and do not help prioritize the request.
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment.
  • If an issue is assigned to a user, that user is claiming responsibility for the issue.
  • Customers working with a Google Technical Account Manager or Customer Engineer can ask them to reach out internally to expedite investigation and resolution of this issue.

Terraform Version & Provider Version(s)

$ terraform version
Terraform v1.10.3
on darwin_arm64

Affected Resource(s)

google_cloud_run_v2_service

Terraform Configuration

        dynamic "resources" {
          for_each = containers.value.resources == null ? [] : [""]
          content {
            limits            = containers.value.resources.limits
            cpu_idle          = containers.value.resources.cpu_idle
            startup_cpu_boost = containers.value.resources.startup_cpu_boost
          }
        }

Debug Output

2024-12-26T00:17:14.136+0900 [DEBUG] provider.terraform-provider-google-beta_v6.11.0_x5:         "resources": {
2024-12-26T00:17:14.136+0900 [DEBUG] provider.terraform-provider-google-beta_v6.11.0_x5:           "limits": {
2024-12-26T00:17:14.136+0900 [DEBUG] provider.terraform-provider-google-beta_v6.11.0_x5:             "cpu": "1",
2024-12-26T00:17:14.136+0900 [DEBUG] provider.terraform-provider-google-beta_v6.11.0_x5:             "memory": "512Mi"
2024-12-26T00:17:14.136+0900 [DEBUG] provider.terraform-provider-google-beta_v6.11.0_x5:           },
2024-12-26T00:17:14.136+0900 [DEBUG] provider.terraform-provider-google-beta_v6.11.0_x5:           "cpuIdle": true,
2024-12-26T00:17:14.136+0900 [DEBUG] provider.terraform-provider-google-beta_v6.11.0_x5:           "startupCpuBoost": true
2024-12-26T00:17:14.136+0900 [DEBUG] provider.terraform-provider-google-beta_v6.11.0_x5:         },

Expected Behavior

According to the document, startup-cpu-boost should be configured as follows, rather than within the container specification.

apiVersion: serving.knative.dev/v1
kind: Service
metadata:
  name: SERVICE
spec:
  template:
    metadata:
      annotations:
        run.googleapis.com/startup-cpu-boost: 'true'

Actual Behavior

No response

Steps to reproduce

  1. terraform apply

Important Factoids

No response

References

No response

@github-actions github-actions bot added forward/review In review; remove label to forward service/run labels Dec 25, 2024
@roaks3
Copy link
Collaborator

roaks3 commented Dec 27, 2024

According to https://cloud.google.com/run/docs/reference/rest/v2/Container#ResourceRequirements, it seems like the ...resources.startupCpuBoost: true spec would be correct. Could you clarify what issue you are having, and where you found the documentation that references the annotation instead?

@leowang-vsgames
Copy link
Author

leowang-vsgames commented Dec 28, 2024

Hi, here is the document that explains how to enable the startup CPU boost feature(the yaml tab): https://cloud.google.com/run/docs/configuring/services/cpu#startup-boost

The full spec is here: https://cloud.google.com/run/docs/reference/yaml/v1

@leowang-vsgames
Copy link
Author

The problem is that after applying Terraform, the startup CPU boost feature always appears as disabled in the GCP console.

If the Cloud Run service is updated using the gcloud run command, the terraform plan output shows differences, such as:

  ~ resource "google_cloud_run_v2_service" "default" {
        id                      = "xxx"
        name                    = "bbb"
        # (32 unchanged attributes hidden)

      ~ template {
            # (9 unchanged attributes hidden)

          ~ containers {
                name        = "aaa"
                # (5 unchanged attributes hidden)

              ~ resources {
                  ~ startup_cpu_boost = false -> true
                    # (2 unchanged attributes hidden)
                }

                # (42 unchanged blocks hidden)
            }

            # (3 unchanged blocks hidden)
        }

        # (1 unchanged block hidden)
    }

@zli82016
Copy link
Collaborator

zli82016 commented Dec 30, 2024

The problem is that after applying Terraform, the startup CPU boost feature always appears as disabled in the GCP console.

@leowang-vsgames, can you provide a screenshot for this? Thanks.

But I don't think it is the problem in Terraform provider.
It looks like startup_cpu_boost is true after terraform apply and startup_cpu_boost works in google_cloud_run_v2_service.

@zli82016
Copy link
Collaborator

If the Cloud Run service is updated using the gcloud run command, the terraform plan output shows differences, such as:

  ~ resource "google_cloud_run_v2_service" "default" {
        id                      = "xxx"
        name                    = "bbb"
        # (32 unchanged attributes hidden)

      ~ template {
            # (9 unchanged attributes hidden)

          ~ containers {
                name        = "aaa"
                # (5 unchanged attributes hidden)

              ~ resources {
                  ~ startup_cpu_boost = false -> true
                    # (2 unchanged attributes hidden)
                }

                # (42 unchanged blocks hidden)
            }

            # (3 unchanged blocks hidden)
        }

        # (1 unchanged block hidden)
    }

That is expected, because startup_cpu_boost is true in Terraform configuration. You need to change it to false in the configuration to stop the diffs.

@leowang-vsgames
Copy link
Author

leowang-vsgames commented Dec 31, 2024

Not sure why it happens, as shown in the screenshot, the startup CPU boost is displayed as disabled.
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug forward/review In review; remove label to forward service/run
Projects
None yet
Development

No branches or pull requests

3 participants