gyfora commented on PR #252:
URL: 
https://github.com/apache/flink-kubernetes-operator/pull/252#issuecomment-1146109215

   @Miuler I looked into this a little and this is the only thing we need to 
change for this to work (and make your test to pass):
   
   ```
   diff --git 
a/flink-kubernetes-operator/src/main/java/org/apache/flink/kubernetes/operator/reconciler/deployment/ApplicationReconciler.java
 
b/flink-kubernetes-operator/src/main/java/org/apache/flink/kubernetes/operator/reconciler/deployment/ApplicationReconciler.java
   index 442206f9..f5beddbb 100644
   --- 
a/flink-kubernetes-operator/src/main/java/org/apache/flink/kubernetes/operator/reconciler/deployment/ApplicationReconciler.java
   +++ 
b/flink-kubernetes-operator/src/main/java/org/apache/flink/kubernetes/operator/reconciler/deployment/ApplicationReconciler.java
   @@ -324,7 +324,12 @@ public class ApplicationReconciler extends 
AbstractDeploymentReconciler {
        @Override
        @SneakyThrows
        protected void shutdown(FlinkDeployment flinkApp) {
   -        flinkService.cancelJob(flinkApp, UpgradeMode.STATELESS);
   +        var status = flinkApp.getStatus();
   +        if (status.getReconciliationStatus().getLastReconciledSpec() == 
null) {
   +            flinkService.deleteClusterDeployment(flinkApp.getMetadata(), 
status, true);
   +        } else {
   +            flinkService.cancelJob(flinkApp, UpgradeMode.STATELESS);
   +        }
        }
   
        private void triggerSavepoint(FlinkDeployment deployment) throws 
Exception {
   ```
   
   This is also a more straightforward fix because the main problem is calling 
cancel job on something that was never deployed (it doesn't really make sense 
in the first place so no wonder it was broken)


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