@@ -281,19 +281,11 @@ func (r *ReconcileRedisClusterBackup) getBackupJob(reqLogger logr.Logger, backup
281281 },
282282 }
283283 if backup .Spec .Backend .Local != nil {
284- job .Spec .Template .Spec .Containers [0 ].VolumeMounts = append (job .Spec .Template .Spec .Containers [0 ].VolumeMounts , corev1.VolumeMount {
285- Name : "local" ,
286- MountPath : backup .Spec .Backend .Local .MountPath ,
287- SubPath : backup .Spec .Backend .Local .SubPath ,
288- })
289284 job .Spec .Template .Spec .Volumes = append (job .Spec .Template .Spec .Volumes , corev1.Volume {
290285 Name : "local" ,
291286 VolumeSource : backup .Spec .Backend .Local .VolumeSource ,
292287 })
293288 }
294- if cluster .Spec .PasswordSecret != nil {
295- job .Spec .Template .Spec .Containers [0 ].Env = append (job .Spec .Template .Spec .Containers [0 ].Env , redisPassword (cluster ))
296- }
297289
298290 return job , nil
299291}
@@ -352,6 +344,16 @@ func (r *ReconcileRedisClusterBackup) backupContainers(backup *redisv1alpha1.Red
352344 },
353345 },
354346 }
347+ if cluster .Spec .PasswordSecret != nil {
348+ container .Env = append (container .Env , redisPassword (cluster ))
349+ }
350+ if backup .Spec .Backend .Local != nil {
351+ container .VolumeMounts = append (container .VolumeMounts , corev1.VolumeMount {
352+ Name : "local" ,
353+ MountPath : backup .Spec .Backend .Local .MountPath ,
354+ SubPath : backup .Spec .Backend .Local .SubPath ,
355+ })
356+ }
355357 containers [i ] = container
356358 i ++
357359 }
@@ -452,7 +454,7 @@ func (r *ReconcileRedisClusterBackup) handleBackupJob(reqLogger logr.Logger, bac
452454 }
453455 return err
454456 }
455- if job .Status .Succeeded == 0 && job .Status .Failed <= utils .Int32 (job .Spec .BackoffLimit ) {
457+ if job .Status .Succeeded == 0 && job .Status .Failed < utils .Int32 (job .Spec .BackoffLimit ) {
456458 return fmt .Errorf ("wait for job Succeeded or Failed" )
457459 }
458460
0 commit comments