feat: remove buntdb dep
This commit is contained in:
@@ -3,7 +3,6 @@ package crd
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"flink-kube-operator/internal/crd/v1alpha1"
|
||||
"fmt"
|
||||
|
||||
"gitea.com/logicamp/lc"
|
||||
@@ -12,12 +11,9 @@ import (
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
)
|
||||
|
||||
func (crd Crd) SetJobStatus(jobUid types.UID, status string) error {
|
||||
func (crd Crd) Patch(jobUid types.UID, patchData map[string]interface{}) error {
|
||||
job := GetJob(jobUid)
|
||||
// Define the patch data (JSON Merge Patch format)
|
||||
patchData := map[string]interface{}{
|
||||
"status": v1alpha1.FlinkJobStatus{},
|
||||
}
|
||||
|
||||
patchBytes, err := json.Marshal(patchData)
|
||||
if err != nil {
|
||||
return fmt.Errorf("error marshaling patch data: %w", err)
|
||||
15
internal/crd/status.go
Normal file
15
internal/crd/status.go
Normal file
@@ -0,0 +1,15 @@
|
||||
package crd
|
||||
|
||||
import (
|
||||
"flink-kube-operator/internal/crd/v1alpha1"
|
||||
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
)
|
||||
|
||||
func (crd Crd) SetJobStatus(jobUid types.UID, status v1alpha1.FlinkJobStatus) error {
|
||||
// Define the patch data (JSON Merge Patch format)
|
||||
patchData := map[string]interface{}{
|
||||
"status": status,
|
||||
}
|
||||
return crd.Patch(jobUid, patchData)
|
||||
}
|
||||
@@ -1,6 +1,9 @@
|
||||
package v1alpha1
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"time"
|
||||
|
||||
metaV1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
)
|
||||
|
||||
@@ -16,8 +19,13 @@ type FlinkJobSpec struct {
|
||||
}
|
||||
|
||||
type FlinkJobStatus struct {
|
||||
JobStatus *string `json:"jobStatus,omitempty"`
|
||||
LifeCycleStatus *string `json:"lifeCycleStatus,omitempty"`
|
||||
JobStatus JobStatus `json:"jobStatus,omitempty"`
|
||||
LifeCycleStatus *string `json:"lifeCycleStatus,omitempty"`
|
||||
LastSavepointPath *string `json:"lastSavepointPath,omitempty"`
|
||||
JobId *string `json:"jobId,omitempty"`
|
||||
Error *string `json:"error,omitempty"`
|
||||
SavepointTriggerId *string `json:"savepointTriggerId,omitempty"`
|
||||
LastSavepointDate *time.Time `json:"lastSavepointDate,omitempty"`
|
||||
}
|
||||
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
@@ -34,3 +42,35 @@ type FlinkJobList struct {
|
||||
metaV1.ListMeta `json:"metadata,omitempty"`
|
||||
Items []FlinkJob `json:"items"`
|
||||
}
|
||||
|
||||
var (
|
||||
ErrNoJobId = errors.New("[managed-job] no job id")
|
||||
ErrNoSavepointTriggerId = errors.New("[managed-job] no savepoint trigger id")
|
||||
ErrNoSavepointPath = errors.New("[managed-job] no savepoint path")
|
||||
)
|
||||
|
||||
type JobStatus string
|
||||
|
||||
var (
|
||||
JobStatusInitializing JobStatus = "INITIALIZING"
|
||||
JobStatusRunning JobStatus = "RUNNING"
|
||||
JobStatusCreating JobStatus = "CREATING"
|
||||
JobStatusError JobStatus = "ERROR"
|
||||
JobStatusReconciling JobStatus = "RECONCILING"
|
||||
JobStatusFailed JobStatus = "FAILED"
|
||||
JobStatusFailing JobStatus = "FAILING"
|
||||
JobStatusRestarting JobStatus = "RESTARTING"
|
||||
JobStatusFinished JobStatus = "FINISHED"
|
||||
JobStatusCanceled JobStatus = "CANCELED"
|
||||
JobStatusCancelling JobStatus = "CANCELLING"
|
||||
JobStatusSuspended JobStatus = "SUSPENDED"
|
||||
)
|
||||
|
||||
type LifeCycleStatus string
|
||||
|
||||
const (
|
||||
LifeCycleStatusInitializing LifeCycleStatus = "INITIALIZING"
|
||||
LifeCycleStatusRestoring LifeCycleStatus = "RESTORING"
|
||||
LifeCycleStatusHealthy LifeCycleStatus = "HEALTHY"
|
||||
LifeCycleStatusFailed LifeCycleStatus = "FAILED"
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user