feat(crd): add update custom resource status
This commit is contained in:
@@ -44,6 +44,8 @@ func (job *ManagedJob) cycle() {
|
||||
}
|
||||
return
|
||||
}
|
||||
job.crd.SetJobStatus(job.def.UID, string(job.state.Status))
|
||||
|
||||
// Check for set running or error state
|
||||
if job.state.Status == JobStatusCreating || job.state.Status == JobStatusFailing {
|
||||
err := job.checkStatus()
|
||||
@@ -72,6 +74,6 @@ func (job *ManagedJob) cycle() {
|
||||
job.restore()
|
||||
return
|
||||
}
|
||||
lc.Logger.Warn("[managed-job] [cycle]", zap.String("unhanded job status", string(job.state.Status)))
|
||||
|
||||
lc.Logger.Warn("[managed-job] [cycle]", zap.String("unhanded job status", string(job.state.Status)))
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package managed_job
|
||||
|
||||
import (
|
||||
"flink-kube-operator/internal/crd"
|
||||
"flink-kube-operator/internal/crd/v1alpha1"
|
||||
|
||||
api "github.com/logi-camp/go-flink-client"
|
||||
@@ -13,13 +14,15 @@ type ManagedJob struct {
|
||||
jarId string
|
||||
db *buntdb.DB
|
||||
state *jobState
|
||||
crd *crd.Crd
|
||||
}
|
||||
|
||||
func NewManagedJob(client *api.Client, db *buntdb.DB, def v1alpha1.FlinkJob) *ManagedJob {
|
||||
func NewManagedJob(client *api.Client, db *buntdb.DB, def v1alpha1.FlinkJob, crd *crd.Crd) *ManagedJob {
|
||||
job := &ManagedJob{
|
||||
def: def,
|
||||
client: client,
|
||||
db: db,
|
||||
crd: crd,
|
||||
}
|
||||
job.startCycle()
|
||||
return job
|
||||
|
||||
Reference in New Issue
Block a user