Skip to content

Commit 15747cf

Browse files
Ray BurgemeestreAnirudh Ramanathan
authored andcommitted
[SPARK-24547][K8S] Allow for building spark on k8s docker images without cache and don't forget to push spark-py container.
## What changes were proposed in this pull request? https://issues.apache.org/jira/browse/SPARK-24547 TL;DR from JIRA issue: - First time I generated images for 2.4.0 Docker was using it's cache, so actually when running jobs, old jars where still in the Docker image. This produces errors like this in the executors: `java.io.InvalidClassException: org.apache.spark.storage.BlockManagerId; local class incompatible: stream classdesc serialVersionUID = 6155820641931972169, local class serialVersionUID = -3720498261147521051` - The second problem was that the spark container is pushed, but the spark-py container wasn't yet. This was just forgotten in the initial PR. - A third problem I also ran into because I had an older docker was apache#21551 so I have not included a fix for that in this ticket. ## How was this patch tested? I've tested it on my own Spark on k8s deployment. Author: Ray Burgemeestre <[email protected]> Closes apache#21555 from rayburgemeestre/SPARK-24547.
1 parent 3f4bda7 commit 15747cf

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

bin/docker-image-tool.sh

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,17 +70,18 @@ function build {
7070
local BASEDOCKERFILE=${BASEDOCKERFILE:-"$IMG_PATH/spark/Dockerfile"}
7171
local PYDOCKERFILE=${PYDOCKERFILE:-"$IMG_PATH/spark/bindings/python/Dockerfile"}
7272

73-
docker build "${BUILD_ARGS[@]}" \
73+
docker build $NOCACHEARG "${BUILD_ARGS[@]}" \
7474
-t $(image_ref spark) \
7575
-f "$BASEDOCKERFILE" .
7676

77-
docker build "${BINDING_BUILD_ARGS[@]}" \
77+
docker build $NOCACHEARG "${BINDING_BUILD_ARGS[@]}" \
7878
-t $(image_ref spark-py) \
7979
-f "$PYDOCKERFILE" .
8080
}
8181

8282
function push {
8383
docker push "$(image_ref spark)"
84+
docker push "$(image_ref spark-py)"
8485
}
8586

8687
function usage {
@@ -99,6 +100,7 @@ Options:
99100
-r repo Repository address.
100101
-t tag Tag to apply to the built image, or to identify the image to be pushed.
101102
-m Use minikube's Docker daemon.
103+
-n Build docker image with --no-cache
102104
103105
Using minikube when building images will do so directly into minikube's Docker daemon.
104106
There is no need to push the images into minikube in that case, they'll be automatically
@@ -127,14 +129,16 @@ REPO=
127129
TAG=
128130
BASEDOCKERFILE=
129131
PYDOCKERFILE=
130-
while getopts f:mr:t: option
132+
NOCACHEARG=
133+
while getopts f:mr:t:n option
131134
do
132135
case "${option}"
133136
in
134137
f) BASEDOCKERFILE=${OPTARG};;
135138
p) PYDOCKERFILE=${OPTARG};;
136139
r) REPO=${OPTARG};;
137140
t) TAG=${OPTARG};;
141+
n) NOCACHEARG="--no-cache";;
138142
m)
139143
if ! which minikube 1>/dev/null; then
140144
error "Cannot find minikube."

0 commit comments

Comments
 (0)