gyfora commented on code in PR #489:
URL: 
https://github.com/apache/flink-kubernetes-operator/pull/489#discussion_r1058387166


##########
flink-kubernetes-operator/src/main/java/org/apache/flink/kubernetes/operator/reconciler/deployment/ApplicationReconciler.java:
##########
@@ -112,18 +116,23 @@ protected Optional<UpgradeMode> getAvailableUpgradeMode(
                 && !flinkVersionChanged(
                         ReconciliationUtils.getDeployedSpec(deployment), 
deployment.getSpec())) {
 
-            if (!flinkService.isHaMetadataAvailable(deployConfig)) {
-                if 
(deployment.getStatus().getReconciliationStatus().getLastStableSpec() == null) {
-                    // initial deployment failure, reset to allow for spec 
change to proceed
-                    return resetOnMissingStableSpec(deployment, deployConfig);
-                }
-            } else {
+            if (flinkService.isHaMetadataAvailable(deployConfig)) {
                 LOG.info(
                         "Job is not running but HA metadata is available for 
last state restore, ready for upgrade");
                 return Optional.of(UpgradeMode.LAST_STATE);
             }
         }
 
+        if (status.getReconciliationStatus()
+                                .deserializeLastReconciledSpec()
+                                .getJob()
+                                .getUpgradeMode()
+                        != UpgradeMode.LAST_STATE
+                && FlinkUtils.jmPodNeverStarted(ctx)) {
+            deleteJmThatNeverStarted(deployment, deployConfig);
+            return getAvailableUpgradeMode(deployment, ctx, deployConfig, 
observeConfig);

Review Comment:
   I imporved the check to make this more clear, but essentially after we 
delete the JobManager deployment, the job will be put in a terminal state and 
the JmDeployment in the MISSING state. Therefore this branch would not be hit 
again.



-- 
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]

Reply via email to