Aitozi commented on code in PR #196: URL: https://github.com/apache/flink-kubernetes-operator/pull/196#discussion_r867444180
########## flink-kubernetes-operator/src/main/java/org/apache/flink/kubernetes/operator/reconciler/ReconciliationUtils.java: ########## @@ -255,4 +257,34 @@ public static boolean shouldRollBack( .minus(readinessTimeout) .isAfter(Instant.ofEpochMilli(reconciliationStatus.getReconciliationTimestamp())); } + + public static < + SPEC extends AbstractFlinkSpec, + STATUS extends CommonStatus<SPEC>, + CR extends CustomResource<SPEC, STATUS>> + boolean applyValidationErrorAndResetSpec( + CR deployment, CommonStatus<?> prevStatus, String newErr) { + + if (!newErr.equals(prevStatus.getError())) { + LOG.error("Validation failed: " + newErr); + } + + ReconciliationUtils.updateForReconciliationError(deployment, newErr); + + var lastReconciledSpec = + deployment.getStatus().getReconciliationStatus().deserializeLastReconciledSpec(); + if (lastReconciledSpec == null) { + // Validation failed before anything was deployed, nothing to do + return false; + } else { + // We need to observe/reconcile using the last version of the deployment spec + deployment.setSpec(lastReconciledSpec); Review Comment: Get it -- 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