You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2022/08/14 01:16:51 UTC

[GitHub] [spark] dcoliversun commented on a diff in pull request #35886: [SPARK-38582][K8S] Add `KubernetesUtils.buildEnvVars(WithFieldRef)?` utility functions

dcoliversun commented on code in PR #35886:
URL: https://github.com/apache/spark/pull/35886#discussion_r945214699


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

Review Comment:
   Yes, updated



##########
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:
   updated



-- 
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: reviews-unsubscribe@spark.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org