Skip to content

Commit 13092d7

Browse files
rimoliveerikerlandson
authored andcommitted
[SPARK-24534][K8S] Bypass non spark-on-k8s commands
## What changes were proposed in this pull request? This PR changes the entrypoint.sh to provide an option to run non spark-on-k8s commands (init, driver, executor) in order to let the user keep with the normal workflow without hacking the image to bypass the entrypoint ## How was this patch tested? This patch was built manually in my local machine and I ran some tests with a combination of ```docker run``` commands. Author: rimolive <[email protected]> Closes apache#21572 from rimolive/rimolive-spark-24534.
1 parent 9dbe53e commit 13092d7

File tree

1 file changed

+11
-6
lines changed
  • resource-managers/kubernetes/docker/src/main/dockerfiles/spark

1 file changed

+11
-6
lines changed

resource-managers/kubernetes/docker/src/main/dockerfiles/spark/entrypoint.sh

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,17 @@ if [ -z "$uidentry" ] ; then
3737
fi
3838

3939
SPARK_K8S_CMD="$1"
40-
if [ -z "$SPARK_K8S_CMD" ]; then
41-
echo "No command to execute has been provided." 1>&2
42-
exit 1
43-
fi
44-
shift 1
40+
case "$SPARK_K8S_CMD" in
41+
driver | driver-py | executor)
42+
shift 1
43+
;;
44+
"")
45+
;;
46+
*)
47+
echo "Non-spark-on-k8s command provided, proceeding in pass-through mode..."
48+
exec /sbin/tini -s -- "$@"
49+
;;
50+
esac
4551

4652
SPARK_CLASSPATH="$SPARK_CLASSPATH:${SPARK_HOME}/jars/*"
4753
env | grep SPARK_JAVA_OPT_ | sort -t_ -k4 -n | sed 's/[^=]*=\(.*\)/\1/g' > /tmp/java_opts.txt
@@ -92,7 +98,6 @@ case "$SPARK_K8S_CMD" in
9298
"$@" $PYSPARK_PRIMARY $PYSPARK_ARGS
9399
)
94100
;;
95-
96101
executor)
97102
CMD=(
98103
${JAVA_HOME}/bin/java

0 commit comments

Comments
 (0)