@@ -43,15 +43,17 @@ const (
4343
4444// JobState defines states for a Flink job deployment.
4545const (
46- JobStatePending = "Pending"
47- JobStateRunning = "Running"
48- JobStateUpdating = "Updating"
49- JobStateSucceeded = "Succeeded"
50- JobStateFailed = "Failed"
51- JobStateCancelled = "Cancelled"
52- JobStateSuspended = "Suspended"
53- JobStateUnknown = "Unknown"
54- JobStateLost = "Lost"
46+ JobStatePending = "Pending"
47+ JobStateUpdating = "Updating"
48+ JobStateRestarting = "Restarting"
49+ JobStateDeploying = "Deploying"
50+ JobStateDeployFailed = "DeployFailed"
51+ JobStateRunning = "Running"
52+ JobStateSucceeded = "Succeeded"
53+ JobStateCancelled = "Cancelled"
54+ JobStateFailed = "Failed"
55+ JobStateLost = "Lost"
56+ JobStateUnknown = "Unknown"
5557)
5658
5759// AccessScope defines the access scope of JobManager service.
@@ -85,24 +87,23 @@ const (
8587 ControlNameJobCancel = "job-cancel"
8688
8789 // control state
88- ControlStateProgressing = "Progressing"
89- ControlStateSucceeded = "Succeeded"
90- ControlStateFailed = "Failed"
90+ ControlStateRequested = "Requested"
91+ ControlStateInProgress = "InProgress"
92+ ControlStateSucceeded = "Succeeded"
93+ ControlStateFailed = "Failed"
9194)
9295
9396// Savepoint status
9497const (
95- SavepointStateNotTriggered = "NotTriggered"
9698 SavepointStateInProgress = "InProgress"
9799 SavepointStateTriggerFailed = "TriggerFailed"
98100 SavepointStateFailed = "Failed"
99101 SavepointStateSucceeded = "Succeeded"
100102
101- SavepointTriggerReasonUserRequested = "user requested"
102- SavepointTriggerReasonScheduled = "scheduled"
103- SavepointTriggerReasonScheduledInitial = "scheduled initial" // The first triggered savepoint has slightly different flow
104- SavepointTriggerReasonJobCancel = "job cancel"
105- SavepointTriggerReasonUpdate = "update"
103+ SavepointTriggerReasonUserRequested = "user requested"
104+ SavepointTriggerReasonJobCancel = "job cancel"
105+ SavepointTriggerReasonScheduled = "scheduled"
106+ SavepointTriggerReasonUpdate = "update"
106107)
107108
108109// ImageSpec defines Flink image of JobManager and TaskManager containers.
@@ -348,12 +349,20 @@ type JobSpec struct {
348349 // Allow non-restored state, default: false.
349350 AllowNonRestoredState * bool `json:"allowNonRestoredState,omitempty"`
350351
351- // Should take savepoint before upgrading the job, default: false.
352- TakeSavepointOnUpgrade * bool `json:"takeSavepointOnUpgrade,omitempty"`
353-
354352 // Savepoints dir where to store savepoints of the job.
355353 SavepointsDir * string `json:"savepointsDir,omitempty"`
356354
355+ // Should take savepoint before updating job, default: true.
356+ // If this is set as false, maxStateAgeToRestoreSeconds must be provided to limit the savepoint age to restore.
357+ TakeSavepointOnUpdate * bool `json:"takeSavepointOnUpdate,omitempty"`
358+
359+ // Maximum age of the savepoint that allowed to restore state..
360+ // This is applied to auto restart on failure, update from stopped state and update without taking savepoint.
361+ // If nil, job can be restarted only when the latest savepoint is the final job state (created by "stop with savepoint")
362+ // - that is, only when job can be resumed from the suspended state.
363+ // +kubebuilder:validation:Minimum=0
364+ MaxStateAgeToRestoreSeconds * int32 `json:"maxStateAgeToRestoreSeconds,omitempty"`
365+
357366 // Automatically take a savepoint to the `savepointsDir` every n seconds.
358367 AutoSavepointSeconds * int32 `json:"autoSavepointSeconds,omitempty"`
359368
@@ -555,7 +564,7 @@ type JobStatus struct {
555564 // The ID of the Flink job.
556565 ID string `json:"id,omitempty"`
557566
558- // The state of the Kubernetes job.
567+ // The state of the Flink job deployment .
559568 State string `json:"state"`
560569
561570 // The actual savepoint from which this job started.
@@ -571,21 +580,26 @@ type JobStatus struct {
571580 // Savepoint location.
572581 SavepointLocation string `json:"savepointLocation,omitempty"`
573582
574- // Last savepoint trigger ID .
575- LastSavepointTriggerID string `json:"lastSavepointTriggerID ,omitempty"`
583+ // Last successful savepoint completed timestamp .
584+ SavepointTime string `json:"savepointTime ,omitempty"`
576585
577- // Last savepoint trigger time. This is updated to make sure multiple
578- // savepoints will not be taken simultaneously.
579- LastSavepointTriggerTime string `json:"lastSavepointTriggerTime,omitempty"`
586+ // The savepoint recorded in savepointLocation is the final state of the job.
587+ FinalSavepoint bool `json:"finalSavepoint,omitempty"`
580588
581- // Last successful or failed savepoint operation timestamp.
582- LastSavepointTime string `json:"lastSavepointTime,omitempty"`
589+ // The timestamp of the Flink job deployment that creating job submitter.
590+ DeployTime string `json:"deployTime,omitempty"`
591+
592+ // The Flink job started timestamp.
593+ StartTime string `json:"startTime,omitempty"`
594+
595+ // The Flink job ended timestamp.
596+ EndTime string `json:"endTime,omitempty"`
583597
584598 // The number of restarts.
585599 RestartCount int32 `json:"restartCount,omitempty"`
586600}
587601
588- // SavepointStatus defines the status of savepoint progress
602+ // SavepointStatus is the status of savepoint progress.
589603type SavepointStatus struct {
590604 // The ID of the Flink job.
591605 JobID string `json:"jobID,omitempty"`
@@ -599,8 +613,8 @@ type SavepointStatus struct {
599613 // Savepoint triggered reason.
600614 TriggerReason string `json:"triggerReason,omitempty"`
601615
602- // Savepoint requested time.
603- RequestTime string `json:"requestTime,omitempty"`
616+ // Savepoint status update time.
617+ UpdateTime string `json:"requestTime,omitempty"`
604618
605619 // Savepoint state.
606620 State string `json:"state"`
@@ -609,6 +623,27 @@ type SavepointStatus struct {
609623 Message string `json:"message,omitempty"`
610624}
611625
626+ type RevisionStatus struct {
627+ // When the controller creates new ControllerRevision, it generates hash string from the FlinkCluster spec
628+ // which is to be stored in ControllerRevision and uses it to compose the ControllerRevision name.
629+ // Then the controller updates nextRevision to the ControllerRevision name.
630+ // When update process is completed, the controller updates currentRevision as nextRevision.
631+ // currentRevision and nextRevision is composed like this:
632+ // <FLINK_CLUSTER_NAME>-<FLINK_CLUSTER_SPEC_HASH>-<REVISION_NUMBER_IN_CONTROLLERREVISION>
633+ // e.g., myflinkcluster-c464ff7-5
634+
635+ // CurrentRevision indicates the version of FlinkCluster.
636+ CurrentRevision string `json:"currentRevision,omitempty"`
637+
638+ // NextRevision indicates the version of FlinkCluster updating.
639+ NextRevision string `json:"nextRevision,omitempty"`
640+
641+ // collisionCount is the count of hash collisions for the FlinkCluster. The controller
642+ // uses this field as a collision avoidance mechanism when it needs to create the name for the
643+ // newest ControllerRevision.
644+ CollisionCount * int32 `json:"collisionCount,omitempty"`
645+ }
646+
612647// JobManagerIngressStatus defines the status of a JobManager ingress.
613648type JobManagerIngressStatus struct {
614649 // The name of the Kubernetes ingress resource.
@@ -644,30 +679,14 @@ type FlinkClusterStatus struct {
644679 // The status of the components.
645680 Components FlinkClusterComponentsStatus `json:"components"`
646681
647- // The status of control requested by user
682+ // The status of control requested by user.
648683 Control * FlinkClusterControlStatus `json:"control,omitempty"`
649684
650- // The status of savepoint progress
685+ // The status of savepoint progress.
651686 Savepoint * SavepointStatus `json:"savepoint,omitempty"`
652687
653- // When the controller creates new ControllerRevision, it generates hash string from the FlinkCluster spec
654- // which is to be stored in ControllerRevision and uses it to compose the ControllerRevision name.
655- // Then the controller updates nextRevision to the ControllerRevision name.
656- // When update process is completed, the controller updates currentRevision as nextRevision.
657- // currentRevision and nextRevision is composed like this:
658- // <FLINK_CLUSTER_NAME>-<FLINK_CLUSTER_SPEC_HASH>-<REVISION_NUMBER_IN_CONTROLLERREVISION>
659- // e.g., myflinkcluster-c464ff7-5
660-
661- // CurrentRevision indicates the version of FlinkCluster.
662- CurrentRevision string `json:"currentRevision,omitempty"`
663-
664- // NextRevision indicates the version of FlinkCluster updating.
665- NextRevision string `json:"nextRevision,omitempty"`
666-
667- // collisionCount is the count of hash collisions for the FlinkCluster. The controller
668- // uses this field as a collision avoidance mechanism when it needs to create the name for the
669- // newest ControllerRevision.
670- CollisionCount * int32 `json:"collisionCount,omitempty"`
688+ // The status of revision.
689+ Revision RevisionStatus `json:"revision,omitempty"`
671690
672691 // Last update timestamp for this status.
673692 LastUpdateTime string `json:"lastUpdateTime,omitempty"`
0 commit comments