Aitozi commented on code in PR #283:
URL: 
https://github.com/apache/flink-kubernetes-operator/pull/283#discussion_r911732089


##########
flink-kubernetes-operator/src/main/java/org/apache/flink/kubernetes/operator/reconciler/deployment/AbstractFlinkResourceReconciler.java:
##########
@@ -99,15 +103,20 @@ public final void reconcile(CR cr, Context ctx) throws 
Exception {
         // No further logic is required at this point.
         if (firstDeployment) {
             LOG.info("Deploying for the first time");
+
+            // Before we try to submit the job we record the current spec in 
the status so we can
+            // handle subsequent deployment and status update errors
+            ReconciliationUtils.updateStatusBeforeDeploymentAttempt(cr, 
deployConfig);
+            statusRecorder.patchAndCacheStatus(cr);
+
             deploy(
                     cr,
                     spec,
                     status,
                     deployConfig,
                     
Optional.ofNullable(spec.getJob()).map(JobSpec::getInitialSavepointPath),
                     false);
-            ReconciliationUtils.updateForSpecReconciliationSuccess(
-                    cr, JobState.RUNNING, deployConfig);
+            ReconciliationUtils.updateStatusForDeployedSpec(cr, deployConfig);

Review Comment:
   I think the problem around the upgrade can be fixed by this PR. The only 
weak part is about the firstDeploy. Because the upgrade failure will be taken 
over by the check during the next reconciler for 
   
   ```
    boolean specChanged =
                   reconciliationStatus.getState() == 
ReconciliationState.UPGRADING
                           || !currentDeploySpec.equals(lastReconciledSpec);
   ```
   
   But the firstDeploy do not have the same thing. What about introduce the 
`INITIALIZING` for the firstDeploy to distinguish between the upgrade ?



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