dongjoon-hyun commented on code in PR #35886:
URL: https://github.com/apache/spark/pull/35886#discussion_r949719576


##########
resource-managers/kubernetes/core/src/main/scala/org/apache/spark/deploy/k8s/KubernetesUtils.scala:
##########
@@ -381,4 +381,34 @@ object KubernetesUtils extends Logging {
       }
     }
   }
+
+  /**
+   * This function builds the EnvVar objects for each key-value env.
+   */
+  @Since("3.4.0")
+  def buildEnvVars(env: Map[String, String]): Seq[EnvVar] = {
+    env.filter(env => env._2 != null)
+      .map { env =>
+        new EnvVarBuilder()
+          .withName(env._1)
+          .withValue(env._2)
+          .build()
+      }.toSeq
+  }
+
+  /**
+   * This function builds the EnvVar objects for each field ref env.
+   */
+  @Since("3.4.0")
+  def buildEnvVarsWithFieldRef(env: Seq[(String, String, String)]): 
Seq[EnvVar] = {
+    env.filter(env => env._2 != null && env._3 != null)

Review Comment:
   Let's avoid to use the same name, `env` for item with the above collection, 
`env`.



##########
resource-managers/kubernetes/core/src/main/scala/org/apache/spark/deploy/k8s/KubernetesUtils.scala:
##########
@@ -381,4 +381,34 @@ object KubernetesUtils extends Logging {
       }
     }
   }
+
+  /**
+   * This function builds the EnvVar objects for each key-value env.
+   */
+  @Since("3.4.0")
+  def buildEnvVars(env: Map[String, String]): Seq[EnvVar] = {
+    env.filter(env => env._2 != null)
+      .map { env =>
+        new EnvVarBuilder()
+          .withName(env._1)
+          .withValue(env._2)
+          .build()
+      }.toSeq
+  }
+
+  /**
+   * This function builds the EnvVar objects for each field ref env.
+   */
+  @Since("3.4.0")
+  def buildEnvVarsWithFieldRef(env: Seq[(String, String, String)]): 
Seq[EnvVar] = {
+    env.filter(env => env._2 != null && env._3 != null)
+      .map { env =>

Review Comment:
   ditto.



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to