This is an automated email from the ASF dual-hosted git repository.

benjobs pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/incubator-streampark.git


The following commit(s) were added to refs/heads/dev by this push:
     new 87234e58c FlinkK8sEventWatcher remove useless code (#2938)
87234e58c is described below

commit 87234e58cd862550c1e7edde6082d74785ffe94e
Author: ChengJie1053 <[email protected]>
AuthorDate: Tue Aug 15 14:25:30 2023 +0800

    FlinkK8sEventWatcher remove useless code (#2938)
    
    * FlinkK8sEventWatcher remove useless code
    
    * PodTemplateParser code optimization
---
 .../apache/streampark/flink/kubernetes/PodTemplateParser.scala    | 8 ++++----
 .../flink/kubernetes/watcher/FlinkK8sEventWatcher.scala           | 2 --
 2 files changed, 4 insertions(+), 6 deletions(-)

diff --git 
a/streampark-flink/streampark-flink-kubernetes/src/main/scala/org/apache/streampark/flink/kubernetes/PodTemplateParser.scala
 
b/streampark-flink/streampark-flink-kubernetes/src/main/scala/org/apache/streampark/flink/kubernetes/PodTemplateParser.scala
index 44d40cd6a..e66e7fe75 100644
--- 
a/streampark-flink/streampark-flink-kubernetes/src/main/scala/org/apache/streampark/flink/kubernetes/PodTemplateParser.scala
+++ 
b/streampark-flink/streampark-flink-kubernetes/src/main/scala/org/apache/streampark/flink/kubernetes/PodTemplateParser.scala
@@ -17,7 +17,7 @@
 
 package org.apache.streampark.flink.kubernetes
 
-import org.apache.commons.collections.CollectionUtils
+import org.apache.commons.collections.{CollectionUtils, MapUtils}
 import org.apache.commons.lang3.StringUtils
 import org.yaml.snakeyaml.Yaml
 
@@ -51,7 +51,7 @@ object PodTemplateParser {
    *   complemented pod template
    */
   def completeInitPodTemplate(podTemplateContent: String): String = {
-    if (podTemplateContent == null || podTemplateContent.trim.isEmpty) {
+    if (StringUtils.isBlank(podTemplateContent)) {
       return POD_TEMPLATE_INIT_CONTENT
     }
     val yaml = new Yaml
@@ -91,7 +91,7 @@ object PodTemplateParser {
    *   pod template content
    */
   def completeHostAliasSpec(hosts: JMap[String, String], podTemplateContent: 
String): String = {
-    if (hosts.isEmpty) return podTemplateContent
+    if (MapUtils.isEmpty(hosts)) return podTemplateContent
     try {
       val content = completeInitPodTemplate(podTemplateContent)
       // convert hosts map to host alias
@@ -144,7 +144,7 @@ object PodTemplateParser {
    */
   def extractHostAliasMap(podTemplateContent: String): JMap[String, String] = {
     val hosts = new util.LinkedHashMap[String, String](0)
-    if (podTemplateContent == null || podTemplateContent.isEmpty) {
+    if (StringUtils.isBlank(podTemplateContent)) {
       return hosts
     }
     try {
diff --git 
a/streampark-flink/streampark-flink-kubernetes/src/main/scala/org/apache/streampark/flink/kubernetes/watcher/FlinkK8sEventWatcher.scala
 
b/streampark-flink/streampark-flink-kubernetes/src/main/scala/org/apache/streampark/flink/kubernetes/watcher/FlinkK8sEventWatcher.scala
index 07cb87f68..f49bf4406 100644
--- 
a/streampark-flink/streampark-flink-kubernetes/src/main/scala/org/apache/streampark/flink/kubernetes/watcher/FlinkK8sEventWatcher.scala
+++ 
b/streampark-flink/streampark-flink-kubernetes/src/main/scala/org/apache/streampark/flink/kubernetes/watcher/FlinkK8sEventWatcher.scala
@@ -78,8 +78,6 @@ class FlinkK8sEventWatcher(implicit watchController: 
FlinkK8sWatchController)
   private def handleDeploymentEvent(action: Watcher.Action, event: 
Deployment): Unit = {
     val clusterId = event.getMetadata.getName
     val namespace = event.getMetadata.getNamespace
-    // if (!cachePool.isInTracking(TrackId.onApplication(namespace, 
clusterId)))
-    //  return
     // just tracking every flink-k8s-native event :)
     watchController.k8sDeploymentEvents.put(
       K8sEventKey(namespace, clusterId),

Reply via email to