update the job controller to patch the right field when updating pgtasks
@@ -150,14 +150,6 @@ func (c *JobController) onUpdate(oldObj, newObj interface{}) {
return
}
- /**
- err = util.Patch(c.JobClient, "/spec/backupstatus", status, "pgbackups", backupName, job.ObjectMeta.Namespace)
- if err != nil {
- log.Errorf("error in patching pgbackup %s %s", backupName, err.Error())
- return
- }
- */
-
//update the backup paths if the job completed
if status == crv1.JobCompletedStatus {
path := backupoperator.UpdateBackupPaths(c.JobClientset, job.Name, job.ObjectMeta.Namespace)
@@ -189,7 +181,7 @@ func (c *JobController) onUpdate(oldObj, newObj interface{}) {
if job.Status.Succeeded == 1 {
log.Debugf("set status to restore job completed for %s", labels[config.LABEL_PG_CLUSTER])
log.Debugf("workflow to update is %s", labels[crv1.PgtaskWorkflowID])
- err = util.Patch(c.JobClient, "/spec/backreststatus", crv1.JobCompletedStatus, "pgtasks", job.Name, job.ObjectMeta.Namespace)
+ err = util.Patch(c.JobClient, "/spec/status", crv1.JobCompletedStatus, "pgtasks", job.Name, job.ObjectMeta.Namespace)
if err != nil {
log.Error("error in patching pgtask " + labels[config.LABEL_JOB_NAME] + err.Error())
}
@@ -262,7 +254,7 @@ func (c *JobController) onUpdate(oldObj, newObj interface{}) {
log.Debugf("got a backrest job status=%d", job.Status.Succeeded)
if job.Status.Succeeded == 1 {
log.Debugf("update the status to completed here for backrest %s job %s", labels[config.LABEL_PG_CLUSTER], job.Name)
- err = util.Patch(c.JobClient, "/spec/backreststatus", crv1.JobCompletedStatus, "pgtasks", job.Name, job.ObjectMeta.Namespace)
+ err = util.Patch(c.JobClient, "/spec/status", crv1.JobCompletedStatus, "pgtasks", job.Name, job.ObjectMeta.Namespace)
if err != nil {
log.Error("error in patching pgtask " + job.ObjectMeta.SelfLink + err.Error())
}
