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



##########
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"
 +
+              s" property"),
+            kubernetesHostPathVolumeConf => kubernetesHostPathVolumeConf
+          )
 
       case KUBERNETES_VOLUMES_PVC_TYPE =>
         val claimNameKey = 
s"$volumeType.$volumeName.$KUBERNETES_VOLUMES_OPTIONS_CLAIM_NAME_KEY"
         val storageClassKey =
           
s"$volumeType.$volumeName.$KUBERNETES_VOLUMES_OPTIONS_CLAIM_STORAGE_CLASS_KEY"
         val sizeLimitKey = 
s"$volumeType.$volumeName.$KUBERNETES_VOLUMES_OPTIONS_SIZE_LIMIT_KEY"
-        KubernetesPVCVolumeConf(
+        Try(KubernetesPVCVolumeConf(
           options(claimNameKey),
           options.get(storageClassKey),
-          options.get(sizeLimitKey))
+          options.get(sizeLimitKey)))
+          .fold(
+            _ => throw new NoSuchElementException(s"When using 
$KUBERNETES_VOLUMES_PVC_TYPE " +
+              "Kubernetes volumes, it is necessary to define " +
+              
s"$KUBERNETES_VOLUMES_PVC_TYPE.volumeName.$KUBERNETES_VOLUMES_OPTIONS_CLAIM_NAME_KEY"
+              + s" property"),

Review comment:
       ditto. `s"` -> `"`.

##########
File path: 
resource-managers/kubernetes/core/src/main/scala/org/apache/spark/deploy/k8s/KubernetesVolumeUtils.scala
##########
@@ -87,9 +104,17 @@ private[spark] object KubernetesVolumeUtils {
       case KUBERNETES_VOLUMES_NFS_TYPE =>
         val pathKey = 
s"$volumeType.$volumeName.$KUBERNETES_VOLUMES_OPTIONS_PATH_KEY"
         val serverKey = 
s"$volumeType.$volumeName.$KUBERNETES_VOLUMES_OPTIONS_SERVER_KEY"
-        KubernetesNFSVolumeConf(
+        Try(KubernetesNFSVolumeConf(
           options(pathKey),
-          options(serverKey))
+          options(serverKey)))
+          .fold(
+            _ => throw new NoSuchElementException(s"When using 
$KUBERNETES_VOLUMES_NFS_TYPE " +
+              "Kubernetes volumes, it is necessary to define " +
+              
s"$KUBERNETES_VOLUMES_NFS_TYPE.volumeName.$KUBERNETES_VOLUMES_OPTIONS_PATH_KEY 
and " +
+              
s"$KUBERNETES_VOLUMES_NFS_TYPE.volumeName.$KUBERNETES_VOLUMES_OPTIONS_SERVER_KEY"
 +
+              s" properties"),

Review comment:
       ditto `s"` -> `"`.




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