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


##########
flink-kubernetes-operator/src/main/java/org/apache/flink/kubernetes/operator/reconciler/deployment/ApplicationReconciler.java:
##########
@@ -111,12 +114,34 @@ public void reconcile(FlinkDeployment flinkApp, Context 
context, Configuration e
             }
             IngressUtils.updateIngressRules(flinkApp, effectiveConfig, 
kubernetesClient);
             ReconciliationUtils.updateForSpecReconciliationSuccess(flinkApp, 
stateAfterReconcile);
+        } else if (ReconciliationUtils.shouldRollBack(flinkApp)) {
+            rollbackApplication(flinkApp);
         } else if (SavepointUtils.shouldTriggerSavepoint(flinkApp) && 
isJobRunning(flinkApp)) {
             triggerSavepoint(flinkApp, effectiveConfig);
             ReconciliationUtils.updateSavepointReconciliationSuccess(flinkApp);
         }
     }
 
+    private void rollbackApplication(FlinkDeployment flinkApp) throws 
Exception {
+        LOG.warn("Rolling back deployment to last stable spec");
+        Configuration rollbackConfig =
+                FlinkUtils.getEffectiveConfig(
+                        flinkApp.getMetadata(),
+                        
flinkApp.getStatus().getReconciliationStatus().deserializeLastStableSpec(),
+                        defaultConfig.getFlinkConfig());
+        suspendJob(flinkApp, UpgradeMode.LAST_STATE, rollbackConfig);
+        deployFlinkJob(

Review Comment:
   I have thought about that but I decided against it for 2 main reasons:
    1. It is pretty difficult to track the rollback process in 2 steps as we do 
not want to touch the lastReconciledSpec etc at this point which we use to 
perform the 2 step upgrade.
    2. We don't need to persist savepoint information in status
    
   It would be good to catch rollback errors and put the job in SUSPENDED state 
when the rollback deployment fails though.



-- 
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: issues-unsubscr...@flink.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to