fix: wong update status in some situations

This commit is contained in:
Mohamad Khani 2025-03-05 11:40:22 +03:30
parent 346f69100c
commit 556d9ff6af
3 changed files with 10 additions and 9 deletions

View File

@ -1,4 +1,4 @@
FROM public.ecr.aws/docker/library/golang:1.23.4-bookworm AS build FROM public.ecr.aws/docker/library/golang:1.24.1-bookworm AS build
ARG upx_version=4.2.4 ARG upx_version=4.2.4

View File

@ -13,7 +13,7 @@ func (job *ManagedJob) Cycle() {
// pkg.Logger.Debug("[managed-job] [new] check cycle", zap.String("jobName", job.def.GetName())) // pkg.Logger.Debug("[managed-job] [new] check cycle", zap.String("jobName", job.def.GetName()))
// Init job // Init job
if job.def.Status.LifeCycleStatus == "" && job.def.Status.JobStatus == "" { if job.def.Status.LifeCycleStatus == "" && (job.def.Status.JobStatus == "" || job.def.Status.JobStatus == v1alpha1.JobStatusFinished) {
job.Run(false) job.Run(false)
return return
} }

View File

@ -119,14 +119,15 @@ func (mgr *Manager) cycle(client *api.Client, crdInstance *crd.Crd) {
"status": patchStatusObj, "status": patchStatusObj,
}) })
} else { } else {
patchStatusObj := map[string]interface{}{ // TODO handle job not found status
"jobStatus": "", // patchStatusObj := map[string]interface{}{
"lifeCycleStatus": string(v1alpha1.LifeCycleStatusFailed), // "jobStatus": "",
} // "lifeCycleStatus": string(v1alpha1.LifeCycleStatusFailed),
// }
crdInstance.Patch(uid, map[string]interface{}{ // crdInstance.Patch(uid, map[string]interface{}{
"status": patchStatusObj, // "status": patchStatusObj,
}) // })
} }
managedJob.Cycle() managedJob.Cycle()