mirror of
https://github.com/vmware-tanzu/velero.git
synced 2026-09-13 11:34:54 +00:00
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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user