Skip to content

Commit

Permalink
Delay CA file deletion in PVB controller
Browse files Browse the repository at this point in the history
Fix #5140.

Signed-off-by: Xun Jiang <[email protected]>
  • Loading branch information
Xun Jiang committed Jul 22, 2022
1 parent abe6010 commit 21f50ce
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions pkg/controller/pod_volume_backup_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,11 @@ func (r *PodVolumeBackupReconciler) Reconcile(ctx context.Context, req ctrl.Requ
if err != nil {
return r.updateStatusToFailed(ctx, &pvb, err, "building Restic command", log)
}
defer os.Remove(resticDetails.credsFile)

defer func() {
os.Remove(resticDetails.credsFile)
os.Remove(resticDetails.caCertFile)
}()

backupLocation := &velerov1api.BackupStorageLocation{}
if err := r.Client.Get(context.Background(), client.ObjectKey{
Expand Down Expand Up @@ -344,8 +348,6 @@ func (r *PodVolumeBackupReconciler) buildResticCommand(ctx context.Context, log
if err != nil {
log.WithError(err).Error("creating temporary caCert file")
}
defer os.Remove(details.caCertFile)

}
cmd.CACertFile = details.caCertFile

Expand Down

0 comments on commit 21f50ce

Please sign in to comment.