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

Resource Limits Configuration Errors After Upgrading google-cloud-run from v0.10.3 to v0.10.9 #13196

Open
JuanManuelReyes opened this issue Oct 23, 2024 · 0 comments

Comments

@JuanManuelReyes
Copy link

I'm experiencing issues when upgrading the google-cloud-run library from version 0.10.3 to 0.10.9 while developing an API using FastAPI. The API is responsible for creating Cloud Run jobs and requires mounting a volume based on a Google Cloud Storage (GCS) bucket. To achieve this, I needed to update the google-cloud-run version since version 0.10.3 does not support mounting a GCS bucket as a volume.

After upgrading to version 0.10.9, I encountered errors related to configuring resource limits for the Cloud Run jobs. Notably, the documentation does not clarify the need to specify CPU in millicpus (m) format. All the documentation references suggest passing CPU as simple string values like "1", "2", "4", "8", but after running tests, I discovered that the newer version requires the use of millicpu (e.g., "1000m", "2000m", "4000m", "8000m"). This difference was not mentioned, causing confusion during the upgrade process.

Steps to Reproduce

  1. Initial Setup with google-cloud-run==0.10.3:

    • Set resource limits as follows:
      container.resources.limits = {"cpu": "8", "memory": "16G"}
      
    • This configuration works without any issues.
  2. Upgrade to google-cloud-run==0.10.9:

    • Upgrade the library to enable mounting a GCS bucket as a volume.
  3. Update Resource Limits to New Format:

    • Modify the resource limits to adhere to the new version's requirements:

      container.resources.limits = {"cpu": "8000m", "memory": "16Gi"}
      
    • Error Encountered:

      Invalid value specified for cpu. Total millicpu may not exceed 8000.
      For more troubleshooting guidance, see https://cloud.google.com/run/docs/configuring/cpu
      
  4. Attempt to Reduce CPU Allocation:

    • Adjust CPU to "6000m" while keeping memory the same:

      container.resources.limits = {"cpu": "6000m", "memory": "16Gi"}
      
    • Same Error Occurs:

      Invalid value specified for cpu. Total millicpu may not exceed 8000.
      For more troubleshooting guidance, see https://cloud.google.com/run/docs/configuring/cpu
      
  5. Test Minimum CPU and Increased Memory:

    • Set CPU to "1000m" and memory to "4Gi":

      container.resources.limits = {"cpu": "1000m", "memory": "4Gi"}
      
    • Error Encountered:

      Invalid value specified for container memory. For 1.0 CPU, memory must be between 128Mi and 4Gi inclusive.
      For more troubleshooting guidance, see https://cloud.google.com/run/docs/configuring/memory-limits
      
  6. Attempt Configuration via Cloud Console:

    • Created a job with 8 CPUs and 16Gi RAM using the following YAML:

      resources:
        limits:
          cpu: 8000m
          memory: 16Gi
      
    • Replicated the configuration in the API:

      container.resources.limits = {"cpu": "8000m", "memory": "16Gi"}
    • Same CPU Error Returned:

      Invalid value specified for cpu. Total millicpu may not exceed 8000.
      For more troubleshooting guidance, see https://cloud.google.com/run/docs/configuring/cpu
      

Expected Behavior

After upgrading to google-cloud-run==0.10.9, it should be possible to configure higher CPU and memory limits to support mounting a GCS bucket as a volume without encountering validation errors.

Actual Behavior

  • CPU Configuration Errors:

    • "Invalid value specified for cpu. Total millicpu may not exceed 8000."
  • Memory Configuration Errors:

    • "Invalid value specified for container memory. For 1.0 CPU, memory must be between 128Mi and 4Gi inclusive."

These errors prevent the successful deployment of Cloud Run jobs with the desired resource allocations.

Environment

  • Library Version:

    • Working: google-cloud-run==0.10.3
    • Problematic: google-cloud-run==0.10.9
  • Python Version: 3.11.6

  • Framework: FastAPI

  • Deployment Method: Via API and Cloud Console

Additional Information

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant