Skip to content

Commit

Permalink
Fix: isJobUpdate should return false when job cancel was requested (#603
Browse files Browse the repository at this point in the history
)
  • Loading branch information
regadas authored Jan 16, 2023
1 parent 82665d3 commit 894a9c2
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions controllers/flinkcluster/flinkcluster_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -453,16 +453,16 @@ func getUpdateState(observed *ObservedClusterState) UpdateState {
if observed.cluster == nil {
return UpdateStateNoUpdate
}
var recorded = observed.cluster.Status
var job = recorded.Components.Job

if !recorded.Revision.IsUpdateTriggered() {
clusterStatus := observed.cluster.Status
if !clusterStatus.Revision.IsUpdateTriggered() {
return UpdateStateNoUpdate
}

jobStatus := clusterStatus.Components.Job
switch {
case isJobUpdate(observed.revisions, observed.cluster) &&
!job.UpdateReady(observed.cluster.Spec.Job, observed.observeTime):
!jobStatus.UpdateReady(observed.cluster.Spec.Job, observed.observeTime):
return UpdateStatePreparing
case !isClusterUpdateToDate(observed):
return UpdateStateInProgress
Expand All @@ -484,6 +484,10 @@ func revisionDiff(a, b *appsv1.ControllerRevision) map[string]util.DiffValue {
}

func isJobUpdate(revisions []*appsv1.ControllerRevision, cluster *v1beta1.FlinkCluster) bool {
if wasJobCancelRequested(cluster.Status.Control) {
return false
}

if len(revisions) < 2 || (cluster != nil && cluster.Spec.Job == nil) {
return false
}
Expand Down

0 comments on commit 894a9c2

Please sign in to comment.