Added error checking to the pgbackrest backup scheduler so that it doesn't fail when job isn't found while the pgtask object exists
@@ -92,8 +92,9 @@ func (b BackRestBackupJob) Run() {
return
}
- job, _ := kubeapi.GetJob(kubeClient, taskName, b.namespace)
+ job, found := kubeapi.GetJob(kubeClient, taskName, b.namespace)
+ if found {
err = kubeapi.DeleteJob(kubeClient, taskName, b.namespace)
if err != nil {
contextLogger.WithFields(log.Fields{
@@ -112,6 +113,7 @@ func (b BackRestBackupJob) Run() {
}).Error("error waiting for job to delete")
return
}
+ }
} else if err != nil && !kerrors.IsNotFound(err) {
contextLogger.WithFields(log.Fields{
"task": taskName,
