Skip to content

Commit

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

Signed-off-by: Xun Jiang <[email protected]>
  • Loading branch information
Xun Jiang authored and danfengliu committed Sep 13, 2022
1 parent 4ceecde commit 5b63233
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions changelogs/unreleased/5145-jxun
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Delay CA file deletion in PVB controller.
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 5b63233

Please sign in to comment.