gyfora commented on code in PR #165:
URL:
https://github.com/apache/flink-kubernetes-operator/pull/165#discussion_r848012465
##########
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(
+ flinkApp,
+ rollbackConfig,
+ Optional.ofNullable(
+ flinkApp.getStatus()
+ .getJobStatus()
+ .getSavepointInfo()
+ .getLastSavepoint())
+ .map(Savepoint::getLocation));
+ flinkApp.getStatus().getReconciliationStatus().setRolledBack(true);
Review Comment:
No, otherwise you would end up in an upgrade -> rollback loop.
--
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]