empty CBT secret ns when secret is not set

Signed-off-by: Lyndon-Li <lyonghui@vmware.com>
This commit is contained in:
Lyndon-Li
2026-08-03 13:52:20 +08:00
parent 8fe02224b9
commit 036e9944e4
+7 -1
View File
@@ -86,6 +86,12 @@ func (s *ServiceImpl) GetAllocatedBlocks(ctx context.Context, snapshot string, r
return err
}
saNamespace := ""
if s.SAName != "" {
// The SA is created in the same namespace as Velero server. vsNamespace is the namespace of Velero server.
saNamespace = s.vsNamespace
}
args := iterator.Args{
SnapshotName: snapshot,
Emitter: &emitterImpl{
@@ -95,7 +101,7 @@ func (s *ServiceImpl) GetAllocatedBlocks(ctx context.Context, snapshot string, r
Clients: clients,
Namespace: s.vsNamespace, // DataUpload is created in the same namespace as Velero server. vsNamespace is the namespace of the Velero server.
SANamespace: s.vsNamespace, // The SA is created in the same namespace as Velero server. vsNamespace is the namespace of Velero server.
SANamespace: saNamespace,
SAName: s.SAName,
TokenExpirySecs: iterator.DefaultTokenExpirySeconds,
MaxResults: 0, // If 0 then the CSI driver decides the value.