morhidi commented on code in PR #213:
URL: 
https://github.com/apache/flink-kubernetes-operator/pull/213#discussion_r873626664


##########
flink-kubernetes-operator/src/main/java/org/apache/flink/kubernetes/operator/reconciler/deployment/SessionReconciler.java:
##########
@@ -157,8 +159,23 @@ public DeleteControl cleanup(FlinkDeployment flinkApp, 
Context context) {
                             sessionJobs.stream()
                                     .map(job -> job.getMetadata().getName())
                                     .collect(Collectors.toList()));
-            // TODO generate error events for this
-            LOG.warn(error);
+            var events =
+                    EventUtils.getEvents(flinkApp, 
kubernetesClient).getItems().stream()
+                            .filter(event -> event.getMessage().equals(error))
+                            .collect(Collectors.toList());
+            Event lastEvent = null;
+            if (events.isEmpty()) {
+                LOG.warn(error);
+            } else {
+                lastEvent = events.get(0);
+            }

Review Comment:
   Can we move this logic into the `EventUtils`? 



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