googleapis / gapic-generator-ruby

Generate Ruby gRPC client libraries from Protocol Buffer definitions.
Apache License 2.0
45 stars 32 forks source link

feat: Disable universe domain check if credentials include an explicit request to do so #1119

Closed dazuma closed 4 weeks ago

dazuma commented 1 month ago

This is Ruby's response to internal issue b/349488459. In a separate PR for the auth library (https://github.com/googleapis/google-auth-library-ruby/pull/493), we add a (temporary, optional) attribute (disable_universe_domain_check) to credential objects that signals the credential may incorrectly claim googleapis as its universe domain. This will be used for GCECredentials temporarily; when set (which for now it will be), GCECredentials will not query the metadata server for universe domain but will instead hard-code googleapis.com. Then, this PR for gapic-common will check for the disable_universe_domain_check attribute, and if present and set, will not perform the universe domain consistency check. This will effectively stop universe domain MDS calls and checks for GCE credentials while leaving them active for all other credential types. It will also not break existing normal (googleapis) users because those credential objects will continue to report googleapis.com as the universe. Early testers of non-googleapis universes will simply have to update both the googleauth and gapic-common gems.