feat: add restore statuses to kubernetes crd
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package managed_job
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"flink-kube-operator/internal/crd/v1alpha1"
|
||||
"flink-kube-operator/internal/jar"
|
||||
|
||||
@@ -24,14 +25,24 @@ func (job *ManagedJob) upload() error {
|
||||
}
|
||||
lc.Logger.Debug("[main] after upload jar", zap.Any("upload-jar-resp", fileName))
|
||||
|
||||
job.jarId = fileName
|
||||
job.def.Status.JarId = &fileName
|
||||
job.crd.Patch(job.def.UID, map[string]interface{}{
|
||||
"status": map[string]interface{}{
|
||||
"jarId": job.def.Status.JarId,
|
||||
},
|
||||
})
|
||||
return nil
|
||||
}
|
||||
|
||||
// run the job from saved jarId in managedJob
|
||||
func (job *ManagedJob) run() error {
|
||||
if job.def.Status.JarId == nil {
|
||||
err := errors.New("missing jar id")
|
||||
lc.Logger.Error("[managed-job] [run]", zap.Error(err))
|
||||
return err
|
||||
}
|
||||
runJarResp, err := job.client.RunJar(api.RunOpts{
|
||||
JarID: job.jarId,
|
||||
JarID: *job.def.Status.JarId,
|
||||
AllowNonRestoredState: true,
|
||||
EntryClass: job.def.Spec.EntryClass,
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user