Skip to content

Default function regions are decided much later in prepare#10293

Open
inlined wants to merge 7 commits intomainfrom
inlined.dynamic-default-regions
Open

Default function regions are decided much later in prepare#10293
inlined wants to merge 7 commits intomainfrom
inlined.dynamic-default-regions

Conversation

@inlined
Copy link
Copy Markdown
Member

@inlined inlined commented Apr 8, 2026

This doesn't yet actually change the default from us-central1, but gives us a nice place to make all those changes.

us-central1 is GCP's oldest region and is oversubscribed. People use it because it's the default but it ends up having slower cold-starts and might even see more service disruptions. This is a place where we can examine new functions and decide whether there's a better place to put them. E.g.:

  1. As a legacy feature, us-central1 functions are allow to listen to a backend from any region (e.g. an asia-east1 storage bucket with a us-central1 function). We can make the default match the event source and dramatically improve performance
  2. For resources in the NAM5 multi-region, it may be better to use us-east1 for faster coldstarts
  3. For functions on global resources, we might choose to look at the location defined in the user's admin config or just us-east1 again to move to a less subscribed region.

Nothing in here is intended to prevent a customer from deploying in us-central1 if they know they want to. This just helps us modify defaults for customers who have shown no preference.

@inlined inlined requested a review from Berlioz April 8, 2026 22:33
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request implements deferred region resolution for Cloud Functions by introducing a REGION_TBD placeholder, which is later resolved by matching against existing functions or defaulting to us-central1. A review comment suggests reordering the preparation logic to call resolveDefaultRegions before inferDetailsFromExisting, ensuring that existing function metadata is correctly merged.

inlined and others added 2 commits April 8, 2026 15:44
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>

/**
* Verifies that we don't have a peculiar edge case where we cannot know what region a default endpoint was in.
* This is only possible in insaine edge cases (esp since you can only have multi-region functions for HTTPS and
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

insaine -> insane

* Verifies that we don't have a peculiar edge case where we cannot know what region a default endpoint was in.
* This is only possible in insaine edge cases (esp since you can only have multi-region functions for HTTPS and
* regional AI Logic functions) where a customer HAD specified multiple regions in a function and then deleted
* the regions annotation entirely and we don't know which to delete an which to keep.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

an -> and

@@ -1,4 +1,5 @@
- Fixed an issue where functions deployments would silently fail (#6989)
- Add foundation for being smarter about where to place functions when the region is not specified (#10293)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is this a user facing change? A bit hard to tell from the code without diving into the broader codebase

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

It will eventually but isn't yet.

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

Successfully merging this pull request may close these issues.

4 participants