From db401c549ff5a6808829664c75e0657d8c33e1e5 Mon Sep 17 00:00:00 2001 From: Prasad Joshi Date: Thu, 20 Aug 2026 20:48:59 +0530 Subject: [PATCH 1/3] fix: only set region in BSL config for AWS CloudStorage Limit region propagation from CloudStorage to BackupStorageLocation config to AWS provider only, since region in BSL config is not supported for GCP/Azure in this path. Signed-off-by: Prasad Joshi --- internal/controller/bsl.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/internal/controller/bsl.go b/internal/controller/bsl.go index 0841dc5b578..49dfca605c1 100644 --- a/internal/controller/bsl.go +++ b/internal/controller/bsl.go @@ -258,11 +258,12 @@ func (r *DataProtectionApplicationReconciler) ReconcileBackupStorageLocations(lo } } - // Add region from CloudStorage CR if specified - if bucket.Spec.Region != "" && bsl.Spec.Config == nil { - bsl.Spec.Config = make(map[string]string) - } - if bucket.Spec.Region != "" { + // Add region from CloudStorage CR only for AWS provider. + // Currently only AWS supports region in BSL config. + if bucket.Spec.Provider == oadpv1alpha1.AWSBucketProvider && bucket.Spec.Region != "" { + if bsl.Spec.Config == nil { + bsl.Spec.Config = make(map[string]string) + } bsl.Spec.Config["region"] = bucket.Spec.Region } From 42c39fa53516271bb96557fb03ae5ae273fe41a0 Mon Sep 17 00:00:00 2001 From: Prasad Joshi Date: Thu, 20 Aug 2026 22:22:57 +0530 Subject: [PATCH 2/3] Fix unit tests Signed-off-by: Prasad Joshi --- internal/controller/bsl_test.go | 1 - internal/controller/cloudstorage_providers_integration_test.go | 2 -- 2 files changed, 3 deletions(-) diff --git a/internal/controller/bsl_test.go b/internal/controller/bsl_test.go index 15dc685ad2e..ae82609f0ec 100644 --- a/internal/controller/bsl_test.go +++ b/internal/controller/bsl_test.go @@ -3336,7 +3336,6 @@ func TestDPAReconciler_ReconcileBackupStorageLocations(t *testing.T) { Config: map[string]string{ "storageAccount": "mystorageaccount", "resourceGroup": "myresourcegroup", - "region": "eastus", }, StorageType: velerov1.StorageType{ ObjectStorage: &velerov1.ObjectStorageLocation{ diff --git a/internal/controller/cloudstorage_providers_integration_test.go b/internal/controller/cloudstorage_providers_integration_test.go index 45b29333f9b..8cb2c07f0da 100644 --- a/internal/controller/cloudstorage_providers_integration_test.go +++ b/internal/controller/cloudstorage_providers_integration_test.go @@ -351,7 +351,6 @@ func TestCloudStorageRefIntegrationGCP(t *testing.T) { expectedBucket: "my-gcp-backup-bucket", expectedConfig: map[string]string{ "project": "my-gcp-project", - "region": "us-central1", }, }, { @@ -427,7 +426,6 @@ func TestCloudStorageRefIntegrationGCP(t *testing.T) { expectedBucket: "legacy-backup-bucket", expectedConfig: map[string]string{ "project": "legacy-project", - "region": "us-west1", "snapshotLocation": "us-west1", }, }, From a79ee960ef0fae7b80474a5454cd65df21bf5b04 Mon Sep 17 00:00:00 2001 From: Prasad Joshi Date: Fri, 21 Aug 2026 12:12:45 +0530 Subject: [PATCH 3/3] add defensive cleanup to remove region from non-aws BSLs Signed-off-by: Prasad Joshi --- internal/controller/bsl.go | 8 +++++++- internal/controller/bsl_test.go | 1 - 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/internal/controller/bsl.go b/internal/controller/bsl.go index 49dfca605c1..c09054bd472 100644 --- a/internal/controller/bsl.go +++ b/internal/controller/bsl.go @@ -275,6 +275,12 @@ func (r *DataProtectionApplicationReconciler) ReconcileBackupStorageLocations(lo bsl.Spec.Config[k] = v } + // Defensive cleanup: region is only supported in BSL config for AWS. + // Remove stale region values that might remain from prior reconciliations + if bucket.Spec.Provider != oadpv1alpha1.AWSBucketProvider { + delete(bsl.Spec.Config, "region") + } + // Handle enableSharedConfig from CloudStorage CR if bucket.Spec.EnableSharedConfig != nil && *bucket.Spec.EnableSharedConfig { if bsl.Spec.Config == nil { @@ -479,7 +485,7 @@ func (r *DataProtectionApplicationReconciler) populateBSLFromCloudStorage(bslSpe } // Add region if specified in CloudStorage - if cloudStorage.Spec.Region != "" { + if cloudStorage.Spec.Provider == oadpv1alpha1.AWSBucketProvider && cloudStorage.Spec.Region != "" { bslSpec.Velero.Config["region"] = cloudStorage.Spec.Region } diff --git a/internal/controller/bsl_test.go b/internal/controller/bsl_test.go index ae82609f0ec..92e441553f8 100644 --- a/internal/controller/bsl_test.go +++ b/internal/controller/bsl_test.go @@ -4674,7 +4674,6 @@ func TestDPAReconciler_populateBSLFromCloudStorage(t *testing.T) { }, }, Config: map[string]string{ - "region": "eastus", "storageAccount": "mystorageaccount", }, Credential: &corev1.SecretKeySelector{