gyfora commented on code in PR #195:
URL:
https://github.com/apache/flink-kubernetes-operator/pull/195#discussion_r866937604
##########
flink-kubernetes-operator/src/main/java/org/apache/flink/kubernetes/operator/reconciler/ReconciliationUtils.java:
##########
@@ -255,4 +259,40 @@ public static boolean shouldRollBack(
.minus(readinessTimeout)
.isAfter(Instant.ofEpochMilli(reconciliationStatus.getReconciliationTimestamp()));
}
+
+ public static boolean deploymentRecoveryEnabled(Configuration conf) {
+ return conf.getOptional(
+
KubernetesOperatorConfigOptions.OPERATOR_RECOVER_JM_DEPLOYMENT_ENABLED)
+ .orElse(
+ conf.get(FlinkConfigBuilder.FLINK_VERSION)
+ .isNewerVersionThan(FlinkVersion.v1_14)
+ ? true
+ : false);
+ }
+
+ public static boolean
jobManagerMissingForRunningDeployment(FlinkDeploymentStatus status) {
+ return
status.getReconciliationStatus().deserializeLastReconciledSpec().getJob().getState()
+ == JobState.RUNNING
+ && status.getJobManagerDeploymentStatus() ==
JobManagerDeploymentStatus.MISSING;
+ }
+
+ public static boolean isJobInTerminalState(FlinkDeploymentStatus status) {
+ JobManagerDeploymentStatus deploymentStatus =
status.getJobManagerDeploymentStatus();
+ if (deploymentStatus == JobManagerDeploymentStatus.MISSING) {
+ return true;
+ }
+
+ String jobState = status.getJobStatus().getState();
+
+ return deploymentStatus == JobManagerDeploymentStatus.READY
+ &&
org.apache.flink.api.common.JobStatus.valueOf(jobState).isTerminalState();
Review Comment:
The only LOCALLY terminal state is SUSPENDED. Which we can also use for
updates. So I think `isTerminalState` is correct here.
--
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]