@@ -40,11 +40,12 @@ import (
4040)
4141
4242const (
43- zoneSeparator = "__"
44- projectKey = "project"
45- snapshotLocationKey = "snapshotLocation"
46- snapshotTypeKey = "snapshotType"
47- volumeProjectKey = "volumeProject"
43+ zoneSeparator = "__"
44+ projectKey = "project"
45+ snapshotLocationKey = "snapshotLocation"
46+ snapshotTypeKey = "snapshotType"
47+ volumeProjectKey = "volumeProject"
48+ snapshotUniverseDomainKey = "universeDomain"
4849)
4950
5051var pdCSIDriver = map [string ]bool {
@@ -75,6 +76,7 @@ func (b *VolumeSnapshotter) Init(config map[string]string) error {
7576 projectKey ,
7677 credentialsFileConfigKey ,
7778 volumeProjectKey ,
79+ snapshotUniverseDomainKey ,
7880 ); err != nil {
7981 return err
8082 }
@@ -136,6 +138,11 @@ func (b *VolumeSnapshotter) Init(config map[string]string) error {
136138 return errors .Errorf ("unsupported snapshot type: %q" , snapshotType )
137139 }
138140
141+ // if universeDomain is provided, we need to pass it when creating new compute service client.
142+ if snapshotUniverseDomain , ok := config [snapshotUniverseDomainKey ]; ok {
143+ clientOptions = append (clientOptions , option .WithUniverseDomain (snapshotUniverseDomain ))
144+ }
145+
139146 gce , err := compute .NewService (context .TODO (), clientOptions ... )
140147 if err != nil {
141148 return errors .WithStack (err )
0 commit comments