gyfora commented on code in PR #1168:
URL:
https://github.com/apache/flink-kubernetes-operator/pull/1168#discussion_r3701722258
##########
flink-kubernetes-operator/src/main/java/org/apache/flink/kubernetes/operator/observer/JobStatusObserver.java:
##########
@@ -373,6 +374,31 @@ private static void markSuspended(AbstractFlinkResource<?,
?> resource) {
});
}
+ /**
+ * When a suspend is executed through an asynchronous cancellation the
reconciler exits early
+ * and leaves the resource in the UPGRADING state until the cancellation
completes. Once the job
+ * has ended there is nothing left to do for a suspend request, so we
complete the upgrade here,
+ * otherwise the resource would report the UPGRADING lifecycle state
indefinitely.
+ *
+ * <p>Must be called right after {@link
#markSuspended(AbstractFlinkResource)}, which records
+ * the suspended job state that this completion makes stable.
+ *
+ * @param resource The Flink resource whose cancellation was just observed.
+ */
+ private static void finalizeSuspendedUpgrade(AbstractFlinkResource<?, ?>
resource) {
+ var reconciliationStatus =
resource.getStatus().getReconciliationStatus();
+ var job = resource.getSpec().getJob();
+ if (reconciliationStatus.getState() != ReconciliationState.UPGRADING
+ || job == null
+ || job.getState() != JobState.SUSPENDED) {
Review Comment:
Can you explain why we have these job conditions here? Are they actually
needed?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]