Ensure the new jar is properly uploaded during an upgrade process. Previously, the jar was not replaced as expected.
88 lines
3.6 KiB
Go
88 lines
3.6 KiB
Go
package v1alpha1
|
|
|
|
import (
|
|
"errors"
|
|
"time"
|
|
|
|
metaV1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
|
)
|
|
|
|
//go:generate go run sigs.k8s.io/controller-tools/cmd/controller-gen object paths=$GOFILE
|
|
|
|
type FlinkJobSpec struct {
|
|
Key string `json:"key"`
|
|
Name string `json:"name"`
|
|
Parallelism int `json:"parallelism"`
|
|
JarURI string `json:"jarUri"`
|
|
SavepointInterval metaV1.Duration `json:"savepointInterval"`
|
|
EntryClass string `json:"entryClass"`
|
|
}
|
|
|
|
type FlinkJobStatus struct {
|
|
JobStatus JobStatus `json:"jobStatus,omitempty"`
|
|
LifeCycleStatus LifeCycleStatus `json:"lifeCycleStatus,omitempty"`
|
|
LastSavepointPath *string `json:"lastSavepointPath,omitempty"`
|
|
JarId *string `json:"jarId,omitempty"`
|
|
JobId *string `json:"jobId,omitempty"`
|
|
Error *string `json:"error,omitempty"`
|
|
SavepointTriggerId *string `json:"savepointTriggerId,omitempty"`
|
|
PauseSavepointTriggerId *string `json:"pauseSavepointTriggerId,omitempty"`
|
|
LastSavepointDate *time.Time `json:"lastSavepointDate,omitempty"`
|
|
LastRestoredSavepointDate *time.Time `json:"lastRestoredSavepointDate,omitempty"`
|
|
LastRestoredSavepointRestoredDate *time.Time `json:"lastRestoredSavepointRestoredDate,omitempty"`
|
|
RestoredCount int `json:"restoredCount,omitempty"`
|
|
RunningJarURI *string `json:"runningJarURI"`
|
|
}
|
|
|
|
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
|
type FlinkJob struct {
|
|
metaV1.TypeMeta `json:",inline"`
|
|
metaV1.ObjectMeta `json:"metadata,omitempty"`
|
|
Spec FlinkJobSpec `json:"spec"`
|
|
Status FlinkJobStatus `json:"status"`
|
|
}
|
|
|
|
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
|
type FlinkJobList struct {
|
|
metaV1.TypeMeta `json:",inline"`
|
|
metaV1.ListMeta `json:"metadata,omitempty"`
|
|
Items []FlinkJob `json:"items"`
|
|
}
|
|
|
|
var (
|
|
ErrNoJobId = errors.New("[managed-job] no job id")
|
|
ErrNoJarId = errors.New("[managed-job] no jar 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"
|
|
LifeCycleStatusGracefulStopFailed LifeCycleStatus = "GRACEFUL_STOP_FAILED"
|
|
LifeCycleStatusUpgradeFailed LifeCycleStatus = "UPGRADE_FAILED"
|
|
LifeCycleStatusGracefullyPaused LifeCycleStatus = "GRACEFULLY_PAUSED"
|
|
LifeCycleStatusUnhealthyJobManager LifeCycleStatus = "UNHEALTHY_JOB_MANAGER"
|
|
LifeCycleStatusHealthy LifeCycleStatus = "HEALTHY"
|
|
LifeCycleStatusFailed LifeCycleStatus = "FAILED"
|
|
)
|