Move secret/configmap copy from controller to CSI snapshot exposer

Move the secret and configmap copy logic from the DataUpload controller
into the CSI snapshot exposer's Expose() method. This keeps all
CSI-specific logic in the exposer and maintains symmetry with CleanUp()
which already handles the cleanup of copied resources.

Signed-off-by: Shubham Pampattiwar <spampatt@redhat.com>
This commit is contained in:
Shubham Pampattiwar
2026-08-18 10:28:27 -07:00
parent c15cf084e3
commit 986350a6e5
2 changed files with 22 additions and 20 deletions
-20
View File
@@ -284,26 +284,6 @@ func (r *DataUploadReconciler) Reconcile(ctx context.Context, req ctrl.Request)
log.Info("Data upload is accepted")
// Copy secrets and configmaps required for backup PVC provisioning
// (e.g., encrypted volumes with KMS). Done after accept so only the
// accepting node handles it, avoiding multi-node contest.
if du.Spec.CSISnapshot != nil {
if bpvcConfig, exists := r.backupPVCConfig[du.Spec.CSISnapshot.StorageClass]; exists {
for _, secretName := range bpvcConfig.SecretNames {
if copyErr := kube.CopySecret(ctx, r.kubeClient.CoreV1(), secretName,
du.Spec.SourceNamespace, du.Namespace, du.Name, log); copyErr != nil {
return r.errorOut(ctx, du, copyErr, "error copying secret for backup PVC", log)
}
}
for _, cmName := range bpvcConfig.ConfigMapNames {
if copyErr := kube.CopyConfigMap(ctx, r.kubeClient.CoreV1(), cmName,
du.Spec.SourceNamespace, du.Namespace, du.Name, log); copyErr != nil {
return r.errorOut(ctx, du, copyErr, "error copying configmap for backup PVC", log)
}
}
}
}
exposeParam, err := r.setupExposeParam(du)
if err != nil {
return r.errorOut(ctx, du, err, "failed to set exposer parameters", log)