Compare commits
No commits in common. "145209b051bc1e60b4b219fd73a47cad404f2c92" and "4c0a7205aa5e61213d87deab5d378efc858cc0ff" have entirely different histories.
145209b051
...
4c0a7205aa
@ -40,7 +40,7 @@ import (
|
||||
const (
|
||||
sessionState string = ".metadata.state"
|
||||
finalizerName string = "finalizer.backupsession.formol.desmojim.fr"
|
||||
JOBTTL int32 = 7200
|
||||
JOBTTL int32 = 7200
|
||||
)
|
||||
|
||||
// BackupSessionReconciler reconciles a BackupSession object
|
||||
@ -102,11 +102,6 @@ func (r *BackupSessionReconciler) StatusUpdate() error {
|
||||
// The last task failed. We mark the backupsession as failed and we stop here.
|
||||
log.V(0).Info("last backup task failed. Stop here", "targetStatus", currentTargetStatus)
|
||||
r.BackupSession.Status.SessionState = formolv1alpha1.Failure
|
||||
log.V(1).Info("New BackupSession status", "status", r.BackupSession.Status.SessionState)
|
||||
if err := r.Status().Update(ctx, r.BackupSession); err != nil {
|
||||
log.Error(err, "unable to update BackupSession status")
|
||||
return err
|
||||
}
|
||||
case formolv1alpha1.Running:
|
||||
// The current task is still running. Nothing to do
|
||||
log.V(0).Info("task is still running", "targetStatus", currentTargetStatus)
|
||||
@ -209,11 +204,11 @@ func (r *BackupSessionReconciler) StatusUpdate() error {
|
||||
}
|
||||
}
|
||||
}
|
||||
log.V(1).Info("New BackupSession status", "status", r.BackupSession.Status.SessionState)
|
||||
if err := r.Status().Update(ctx, r.BackupSession); err != nil {
|
||||
log.Error(err, "unable to update BackupSession status")
|
||||
return err
|
||||
}
|
||||
}
|
||||
log.V(1).Info("New BackupSession status", "status", r.BackupSession.Status.SessionState)
|
||||
if err := r.Status().Update(ctx, r.BackupSession); err != nil {
|
||||
log.Error(err, "unable to update BackupSession status")
|
||||
return err
|
||||
}
|
||||
case formolv1alpha1.Deleted:
|
||||
for _, target := range r.BackupSession.Status.Targets {
|
||||
@ -258,7 +253,6 @@ func (r *BackupSessionReconciler) Reconcile(req ctrl.Request) (ctrl.Result, erro
|
||||
ctx := context.Background()
|
||||
|
||||
// your logic here
|
||||
time.Sleep(300 * time.Millisecond)
|
||||
r.BackupSession = &formolv1alpha1.BackupSession{}
|
||||
if err := r.Get(ctx, req.NamespacedName, r.BackupSession); err != nil {
|
||||
log.Error(err, "unable to get backupsession")
|
||||
@ -361,14 +355,13 @@ func (r *BackupSessionReconciler) CreateBackupJob(target formolv1alpha1.Target)
|
||||
}
|
||||
// S3 backing storage
|
||||
restic.Env = append(restic.Env, formolutils.ConfigureResticEnvVar(r.BackupConf, repo)...)
|
||||
jobTtl := JOBTTL
|
||||
job := &batchv1.Job{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
GenerateName: fmt.Sprintf("%s-%s-", r.BackupSession.Name, target.Name),
|
||||
Namespace: r.BackupConf.Namespace,
|
||||
},
|
||||
Spec: batchv1.JobSpec{
|
||||
TTLSecondsAfterFinished: &jobTtl,
|
||||
TTLSecondsAfterFinished: &JOBTTL,
|
||||
Template: corev1.PodTemplateSpec{
|
||||
Spec: corev1.PodSpec{
|
||||
InitContainers: []corev1.Container{},
|
||||
@ -432,14 +425,13 @@ func (r *BackupSessionReconciler) deleteExternalResources() error {
|
||||
}
|
||||
// create a job to delete the restic snapshot(s) with the backupsession name tag
|
||||
if len(deleteSnapshots) > 0 {
|
||||
jobTtl := JOBTTL
|
||||
job := &batchv1.Job{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
GenerateName: fmt.Sprintf("delete-%s-", r.BackupSession.Name),
|
||||
Namespace: r.BackupSession.Namespace,
|
||||
},
|
||||
Spec: batchv1.JobSpec{
|
||||
TTLSecondsAfterFinished: &jobTtl,
|
||||
TTLSecondsAfterFinished: &JOBTTL,
|
||||
Template: corev1.PodTemplateSpec{
|
||||
Spec: corev1.PodSpec{
|
||||
InitContainers: []corev1.Container{},
|
||||
|
||||
Loading…
Reference in New Issue
Block a user