Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions pkg/apis/psmdb/v1/psmdb_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -1284,11 +1284,19 @@ type GCSRetryer struct {
}

type BackupStorageGCSSpec struct {
Bucket string `json:"bucket"`
Prefix string `json:"prefix,omitempty"`
CredentialsSecret string `json:"credentialsSecret"`
ChunkSize int `json:"chunkSize,omitempty"`
Retryer *GCSRetryer `json:"retryer,omitempty"`
Bucket string `json:"bucket"`
Prefix string `json:"prefix,omitempty"`
CredentialsSecret string `json:"credentialsSecret,omitempty"`
Credentials *GCSCredentials `json:"credentials,omitempty"`
ChunkSize int `json:"chunkSize,omitempty"`
Retryer *GCSRetryer `json:"retryer,omitempty"`
}

// GCSCredentials configures how PBM authenticates with GCS.
// When WorkloadIdentity is true, PBM uses Application Default Credentials (ADC)
// provided by GKE Workload Identity instead of a credentialsSecret.
type GCSCredentials struct {
WorkloadIdentity bool `json:"workloadIdentity,omitempty"`
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.

Why does it need to be embedded inside GCSCredentials object?

}

type BackupStorageAzureSpec struct {
Expand Down
20 changes: 20 additions & 0 deletions pkg/apis/psmdb/v1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion pkg/psmdb/backup/pbm.go
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,11 @@ func GetPBMStorageGCSConfig(
},
}

if stg.GCS.CredentialsSecret != "" {
// When WorkloadIdentity is enabled, skip credential secret loading entirely.
// PBM will use Application Default Credentials (ADC) provided by GKE Workload Identity.
useWorkloadIdentity := stg.GCS.Credentials != nil && stg.GCS.Credentials.WorkloadIdentity

if !useWorkloadIdentity && stg.GCS.CredentialsSecret != "" {
Comment on lines +505 to +509
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.

Please add coverage for this in pbm_test.go

gcsSecret, err := getSecret(ctx, k8sclient, cluster.Namespace, stg.GCS.CredentialsSecret)
if err != nil {
return config.StorageConf{}, errors.Wrap(err, "get GCS credentials secret")
Expand Down