Skip to content

Commit db8644c

Browse files
authored
fix: Set the universe domain when using an impersonation chain. (#2547)
This change ensures that the universe domain configuration is correctly passed when setting up an impersonation chain for credentials. It also introduces internal test infrastructure to mock `impersonate.CredentialsTokenSource` and adds a unit test `TestCredentialsOpt` to verify this behavior.
1 parent 5b14b6a commit db8644c

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

internal/proxy/proxy.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,9 @@ func credentialsOpt(c Config, l cloudsql.Logger) (cloudsqlconn.Option, error) {
342342
// credentials token source.
343343
if c.ImpersonationChain != "" {
344344
var iopts []option.ClientOption
345+
if c.UniverseDomain != "" {
346+
iopts = append(iopts, option.WithUniverseDomain(c.UniverseDomain))
347+
}
345348
switch {
346349
case c.Token != "":
347350
l.Infof("Impersonating service account with OAuth2 token")

0 commit comments

Comments
 (0)