Fixed TTL error
This commit is contained in:
parent
809fdc659f
commit
145209b051
@ -40,7 +40,7 @@ import (
|
|||||||
const (
|
const (
|
||||||
sessionState string = ".metadata.state"
|
sessionState string = ".metadata.state"
|
||||||
finalizerName string = "finalizer.backupsession.formol.desmojim.fr"
|
finalizerName string = "finalizer.backupsession.formol.desmojim.fr"
|
||||||
JOBTTL int32 = 7200
|
JOBTTL int32 = 7200
|
||||||
)
|
)
|
||||||
|
|
||||||
// BackupSessionReconciler reconciles a BackupSession object
|
// BackupSessionReconciler reconciles a BackupSession object
|
||||||
@ -361,13 +361,14 @@ func (r *BackupSessionReconciler) CreateBackupJob(target formolv1alpha1.Target)
|
|||||||
}
|
}
|
||||||
// S3 backing storage
|
// S3 backing storage
|
||||||
restic.Env = append(restic.Env, formolutils.ConfigureResticEnvVar(r.BackupConf, repo)...)
|
restic.Env = append(restic.Env, formolutils.ConfigureResticEnvVar(r.BackupConf, repo)...)
|
||||||
|
jobTtl := JOBTTL
|
||||||
job := &batchv1.Job{
|
job := &batchv1.Job{
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
GenerateName: fmt.Sprintf("%s-%s-", r.BackupSession.Name, target.Name),
|
GenerateName: fmt.Sprintf("%s-%s-", r.BackupSession.Name, target.Name),
|
||||||
Namespace: r.BackupConf.Namespace,
|
Namespace: r.BackupConf.Namespace,
|
||||||
},
|
},
|
||||||
Spec: batchv1.JobSpec{
|
Spec: batchv1.JobSpec{
|
||||||
TTLSecondsAfterFinished: &JOBTTL,
|
TTLSecondsAfterFinished: &jobTtl,
|
||||||
Template: corev1.PodTemplateSpec{
|
Template: corev1.PodTemplateSpec{
|
||||||
Spec: corev1.PodSpec{
|
Spec: corev1.PodSpec{
|
||||||
InitContainers: []corev1.Container{},
|
InitContainers: []corev1.Container{},
|
||||||
@ -431,13 +432,14 @@ func (r *BackupSessionReconciler) deleteExternalResources() error {
|
|||||||
}
|
}
|
||||||
// create a job to delete the restic snapshot(s) with the backupsession name tag
|
// create a job to delete the restic snapshot(s) with the backupsession name tag
|
||||||
if len(deleteSnapshots) > 0 {
|
if len(deleteSnapshots) > 0 {
|
||||||
|
jobTtl := JOBTTL
|
||||||
job := &batchv1.Job{
|
job := &batchv1.Job{
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
GenerateName: fmt.Sprintf("delete-%s-", r.BackupSession.Name),
|
GenerateName: fmt.Sprintf("delete-%s-", r.BackupSession.Name),
|
||||||
Namespace: r.BackupSession.Namespace,
|
Namespace: r.BackupSession.Namespace,
|
||||||
},
|
},
|
||||||
Spec: batchv1.JobSpec{
|
Spec: batchv1.JobSpec{
|
||||||
TTLSecondsAfterFinished: &JOBTTL,
|
TTLSecondsAfterFinished: &jobTtl,
|
||||||
Template: corev1.PodTemplateSpec{
|
Template: corev1.PodTemplateSpec{
|
||||||
Spec: corev1.PodSpec{
|
Spec: corev1.PodSpec{
|
||||||
InitContainers: []corev1.Container{},
|
InitContainers: []corev1.Container{},
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user