Skip to content

Commit a9bc7bb

Browse files
authored
Merge pull request #228 from 7sinStone/feature/add-support-for-non-default-google-cloud-universe-domain
feat: Add support for non-default google cloud universe domain
2 parents 0bc8ff1 + 63b7dba commit a9bc7bb

File tree

3 files changed

+28
-2
lines changed

3 files changed

+28
-2
lines changed

backupstoragelocation.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,9 @@ spec:
4848
#
4949
# Optional.
5050
storeEndpoint: storage-example.p.googleapis.com
51+
52+
# Configuration of the universe domain
53+
#
54+
# Optional.
55+
universeDomain: googleapis.com
5156
```
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Add universeDomain parameter for GCS client
2+
3+
**Type:** Feature
4+
5+
**Description:**
6+
Introduce a new `universeDomain` key in the BackupStorageLocation `spec.config` map,
7+
allowing users to override the default Google Storage domain (defaults to `"googleapis.com"`).
8+
9+
**Motivation:**
10+
- Support custom or private GCS-compatible endpoints (e.g. testing, on‑prem).
11+
- Align with Helm chart support for `universeDomain`.
12+
13+
**Changes:**
14+
- Updated `object_storage.go` to inject `option.WithUniverseDomain(...)`.

velero-plugin-for-gcp/object_store.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,10 @@ import (
3737

3838
const (
3939
kmsKeyNameConfigKey = "kmsKeyName"
40-
serviceAccountConfig = "serviceAccount"
40+
serviceAccountConfigKey = "serviceAccount"
4141
credentialsFileConfigKey = "credentialsFile"
4242
storeEndpointConfigKey = "storeEndpoint"
43+
universeDomainKey = "universeDomain"
4344
)
4445

4546
// bucketWriter wraps the GCP SDK functions for accessing object store so they can be faked for testing.
@@ -100,9 +101,10 @@ func (o *ObjectStore) Init(config map[string]string) error {
100101
if err := veleroplugin.ValidateObjectStoreConfigKeys(
101102
config,
102103
kmsKeyNameConfigKey,
103-
serviceAccountConfig,
104+
serviceAccountConfigKey,
104105
credentialsFileConfigKey,
105106
storeEndpointConfigKey,
107+
universeDomainKey,
106108
); err != nil {
107109
return err
108110
}
@@ -146,6 +148,11 @@ func (o *ObjectStore) Init(config map[string]string) error {
146148
clientOptions = append(clientOptions, option.WithEndpoint(endpoint))
147149
}
148150

151+
// if using a universeDomain, we need to pass it when creating the object store client
152+
if universeDomain, ok := config[universeDomainKey]; ok {
153+
clientOptions = append(clientOptions, option.WithUniverseDomain(universeDomain))
154+
}
155+
149156
if creds.JSON != nil {
150157
o.fileCredType, err = getSecretAccountTypeKey(creds.JSON)
151158
if err != nil {

0 commit comments

Comments
 (0)