You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2022/04/24 11:09:52 UTC

[GitHub] [flink-kubernetes-operator] Aitozi commented on a diff in pull request #181: [FLINK-27358] Fix NPE and avoid unnecessary configmap update

Aitozi commented on code in PR #181:
URL: https://github.com/apache/flink-kubernetes-operator/pull/181#discussion_r857102946


##########
flink-kubernetes-operator/src/main/java/org/apache/flink/kubernetes/operator/utils/FlinkUtils.java:
##########
@@ -243,22 +244,21 @@ public static void deleteJobGraphInKubernetesHA(
                         .withLabels(haConfigMapLabels)
                         .list();
 
-        configMaps
-                .getItems()
-                .forEach(
-                        configMap -> {
-                            final boolean isDeleted =
-                                    configMap
-                                            .getData()
-                                            .entrySet()
-                                            .removeIf(FlinkUtils::isJobGraphKey);
-                            if (isDeleted) {
-                                LOG.info(
-                                        "Job graph in ConfigMap {} is deleted",
-                                        configMap.getMetadata().getName());
-                            }
-                        });
-        kubernetesClient.resourceList(configMaps).inNamespace(namespace).createOrReplace();
+        boolean shouldUpdate = false;
+        for (ConfigMap configMap : configMaps.getItems()) {
+            if (configMap.getData() == null || configMap.getData().isEmpty()) {
+                continue;
+            }
+            final boolean isDeleted =

Review Comment:
   nit: It seems we can directly use `shouldUpdate` here ? 



-- 
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-unsubscribe@flink.apache.org

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