dongjoon-hyun commented on a change in pull request #29941:
URL: https://github.com/apache/spark/pull/29941#discussion_r499293936



##########
File path: 
resource-managers/kubernetes/core/src/main/scala/org/apache/spark/deploy/k8s/KubernetesVolumeUtils.scala
##########
@@ -67,17 +70,31 @@ private[spark] object KubernetesVolumeUtils {
     volumeType match {
       case KUBERNETES_VOLUMES_HOSTPATH_TYPE =>
         val pathKey = 
s"$volumeType.$volumeName.$KUBERNETES_VOLUMES_OPTIONS_PATH_KEY"
-        KubernetesHostPathVolumeConf(options(pathKey))
+        Try(KubernetesHostPathVolumeConf(options(pathKey)))
+          .fold(
+            _ => throw new NoSuchElementException(s"When using 
$KUBERNETES_VOLUMES_HOSTPATH_TYPE " +
+              "Kubernetes volumes, it is necessary to define " +
+              
s"$KUBERNETES_VOLUMES_HOSTPATH_TYPE.volumeName.$KUBERNETES_VOLUMES_OPTIONS_PATH_KEY"
 +

Review comment:
       Can we use `pathKey` instead of this 
`$KUBERNETES_VOLUMES_HOSTPATH_TYPE.volumeName.$KUBERNETES_VOLUMES_OPTIONS_PATH_KEY`?




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

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