Skip to content

Commit 89eeff5

Browse files
authored
[MISC] Fix tag version for GPU image (#102)
1 parent d55d07c commit 89eeff5

File tree

7 files changed

+38
-21
lines changed

7 files changed

+38
-21
lines changed

.github/workflows/build_gpu.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,12 @@ jobs:
3737
sudo snap install rockcraft --classic --edge
3838
3939
- name: Build image (GPU)
40-
run: sudo make build FLAVOUR=spark-gpu
40+
run: sudo make build FLAVOUR=gpu
4141

4242
- name: Get Artifact Name
4343
id: artifact
4444
run: |
45-
GPU_ARTIFACT=$(make help FLAVOUR=spark-gpu | grep 'Artifact: ')
45+
GPU_ARTIFACT=$(make help FLAVOUR=gpu | grep 'Artifact: ')
4646
echo "gpu_artifact_name=${GPU_ARTIFACT#'Artifact: '}" >> $GITHUB_OUTPUT
4747
4848
- name: Change artifact permissions

.github/workflows/integration-gpu.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ jobs:
6969
- name: Get Artifact Name
7070
id: artifact
7171
run: |
72-
GPU_ARTIFACT=$(make help FLAVOUR=spark-gpu | grep 'Artifact: ')
72+
GPU_ARTIFACT=$(make help FLAVOUR=gpu | grep 'Artifact: ')
7373
echo "gpu_artifact_name=${GPU_ARTIFACT#'Artifact: '}" >> $GITHUB_OUTPUT
7474
7575
- name: Download artifact
@@ -84,7 +84,7 @@ jobs:
8484
mv charmed-spark/${{ steps.artifact.outputs.gpu_artifact_name }} .
8585
touch .make_cache/k8s.tag
8686
# Import artifact into microk8s to be used in integration tests
87-
sudo make microk8s-import FLAVOUR=spark-gpu PREFIX=test- REPOSITORY=ghcr.io/canonical/ \
87+
sudo make microk8s-import FLAVOUR=gpu PREFIX=test- REPOSITORY=ghcr.io/canonical/ \
8888
-o ${{ steps.artifact.outputs.gpu_artifact_name }}
8989
9090
- name: Run integration tests on GPU

.github/workflows/integration.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
echo "jupyter_artifact_name=${JUPYTER_ARTIFACT#'Artifact: '}" >> $GITHUB_OUTPUT
3737
KYUUBI_ARTIFACT=$(make help FLAVOUR=kyuubi | grep 'Artifact: ')
3838
echo "kyuubi_artifact_name=${KYUUBI_ARTIFACT#'Artifact: '}" >> $GITHUB_OUTPUT
39-
GPU_ARTIFACT=$(make help FLAVOUR=spark-gpu | grep 'Artifact: ')
39+
GPU_ARTIFACT=$(make help FLAVOUR=gpu | grep 'Artifact: ')
4040
echo "gpu_artifact_name=${GPU_ARTIFACT#'Artifact: '}" >> $GITHUB_OUTPUT
4141
4242
- name: Install and configure microk8s

.github/workflows/publish.yaml

+4-4
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ jobs:
7878
echo "jupyter_artifact_name=${JUPYTER_ARTIFACT#'Artifact: '}" >> $GITHUB_OUTPUT
7979
KYUUBI_ARTIFACT=$(make help FLAVOUR=kyuubi | grep 'Artifact: ')
8080
echo "kyuubi_artifact_name=${KYUUBI_ARTIFACT#'Artifact: '}" >> $GITHUB_OUTPUT
81-
GPU_ARTIFACT=$(make help FLAVOUR=spark-gpu | grep 'Artifact: ')
81+
GPU_ARTIFACT=$(make help FLAVOUR=gpu | grep 'Artifact: ')
8282
echo "gpu_artifact_name=${GPU_ARTIFACT#'Artifact: '}" >> $GITHUB_OUTPUT
8383
8484
- name: Download artifact
@@ -213,11 +213,11 @@ jobs:
213213
TRACK=${{ needs.release_checks.outputs.track }}
214214
if [ ! -z "$RISK" ] && [ "${RISK}" != "no-risk" ]; then TAG=${TRACK}_${RISK}; else TAG=${TRACK}; fi
215215
216-
IMAGE_NAME=$(make help REPOSITORY=${REPOSITORY} TAG=${TAG} FLAVOUR=spark-gpu help | grep "Image\:" | cut -d ":" -f2 | xargs)
216+
IMAGE_NAME=$(make help REPOSITORY=${REPOSITORY} TAG=${TAG} FLAVOUR=gpu help | grep "Image\:" | cut -d ":" -f2 | xargs)
217217

218218
# Import artifact into docker with new tag
219219
sudo make docker-import \
220-
FLAVOUR=spark-gpu \
220+
FLAVOUR=gpu \
221221
REPOSITORY=${REPOSITORY} \
222222
TAG=${TAG} \
223223
-o ${{ steps.artifact.outputs.gpu_artifact_name }}
@@ -232,7 +232,7 @@ jobs:
232232
docker push ${IMAGE_NAME}:${TAG}
233233

234234
if [[ "$RISK" == "edge" ]]; then
235-
VERSION_LONG=$(make help FLAVOUR=spark-gpu | grep "Tag\:" | cut -d ":" -f2 | xargs)
235+
VERSION_LONG=$(make help FLAVOUR=gpu | grep "Tag\:" | cut -d ":" -f2 | xargs)
236236
VERSION_TAG="${VERSION_LONG}-${{ needs.release_checks.outputs.base }}_edge"
237237

238238
docker tag ${IMAGE_NAME}:${TAG} ${IMAGE_NAME}:${VERSION_TAG}

Makefile

+10-9
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ JUPYTER_VERSION=$(shell cat images/metadata.yaml | yq .flavours.jupyter.version)
5454

5555
# eg, charmed-spark-gpu
5656
ROCK_NAME_GPU := $(shell cat images/charmed-spark-gpu/rockcraft.yaml | yq .name)
57+
GPU_VERSION=$(shell cat images/metadata.yaml | yq .flavours.gpu.version)
5758

5859
# The filename of the Rock file built during the build process.
5960
# eg, charmed-spark_3.5.1_amd64.rock
@@ -93,7 +94,7 @@ SPARK_GPU_ARTIFACT=$(ROCK_NAME_GPU)_$(SPARK_VERSION)_$(PLATFORM).tar
9394
# or,
9495
# ARTIFACT = "charmed-spark-kyuubi_3.5.1_amd64.tar" TAG = "3.5.1-1.9.0" DISPLAY_NAME = "ghcr.io/canonical/charmed-spark-kyuubi"
9596
# or,
96-
# ARTIFACT = "charmed-spark_gpu_3.5.1_amd64.tar" TAG = "3.5.1" DISPLAY_NAME = "ghcr.io/canonical/charmed-spark-gpu"
97+
# ARTIFACT = "charmed-spark_gpu_3.5.1_amd64.tar" TAG = "3.5.1-24.04.1" DISPLAY_NAME = "ghcr.io/canonical/charmed-spark-gpu"
9798

9899
ifeq ($(FLAVOUR), jupyter)
99100
DISPLAY_NAME=$(REPOSITORY)$(PREFIX)$(ROCK_NAME)-jupyterlab
@@ -103,9 +104,9 @@ else ifeq ($(FLAVOUR), kyuubi)
103104
DISPLAY_NAME=$(REPOSITORY)$(PREFIX)$(ROCK_NAME)-kyuubi
104105
TAG=$(SPARK_VERSION)-$(KYUUBI_VERSION)
105106
ARTIFACT=$(KYUUBI_ARTIFACT)
106-
else ifeq ($(FLAVOUR), spark-gpu)
107+
else ifeq ($(FLAVOUR), gpu)
107108
DISPLAY_NAME=$(REPOSITORY)$(PREFIX)$(ROCK_NAME)-gpu
108-
TAG=$(SPARK_VERSION)
109+
TAG=$(SPARK_VERSION)-$(GPU_VERSION)
109110
ARTIFACT=$(SPARK_GPU_ARTIFACT)
110111
else
111112
DISPLAY_NAME=$(REPOSITORY)$(PREFIX)$(ROCK_NAME)
@@ -122,7 +123,7 @@ endif
122123
# K8S_MARKER: The MicroK8s cluster has been installed and configured successfully
123124
# AWS_MARKER: The AWS CLI has been installed and configured with valid S3 credentials from MinIO
124125
SPARK_MARKER=$(_MAKE_DIR)/spark-$(SPARK_VERSION).tag
125-
SPARK_GPU_MARKER=$(_MAKE_DIR)/spark-gpu-$(SPARK_VERSION).tag
126+
SPARK_GPU_MARKER=$(_MAKE_DIR)/gpu-$(SPARK_VERSION).tag
126127
JUPYTER_MARKER=$(_MAKE_DIR)/jupyter-$(JUPYTER_VERSION).tag
127128
KYUUBI_MARKER=$(_MAKE_DIR)/kyuubi-$(KYUUBI_VERSION).tag
128129
K8S_MARKER=$(_MAKE_DIR)/k8s.tag
@@ -174,7 +175,7 @@ help:
174175

175176
# Recipe for creating a rock image from the current repository.
176177
#
177-
# ROCK_FILE => charmed-spark_3.5.1_amd64.rock
178+
# ROCK_FILE => charmed-spark_3.5.1_amd64.rock
178179
#
179180
$(ROCK_FILE): images/charmed-spark/rockcraft.yaml $(wildcard images/charmed-spark/*/*)
180181
@echo "=== Building Charmed Image ==="
@@ -259,15 +260,15 @@ $(SPARK_GPU_MARKER): $(ROCK_FILE_GPU) images/charmed-spark-gpu/Dockerfile
259260
touch $(SPARK_GPU_MARKER)
260261

261262
# Shorthand recipe for building Spark-gpu image
262-
spark-gpu: $(SPARK_GPU_MARKER)
263+
gpu: $(SPARK_GPU_MARKER)
263264

264265
$(ARTIFACT):
265266
ifeq ($(FLAVOUR), jupyter)
266267
make jupyter
267268
else ifeq ($(FLAVOUR), kyuubi)
268269
make kyuubi
269-
else ifeq ($(FLAVOUR), spark-gpu)
270-
make spark-gpu
270+
else ifeq ($(FLAVOUR), gpu)
271+
make gpu
271272
else
272273
make spark
273274
endif
@@ -305,7 +306,7 @@ tests: $(K8S_MARKER) $(AWS_MARKER) $(AZURE_MARKER)
305306
@echo "=== Running Integration Tests ==="
306307
ifeq ($(FLAVOUR), jupyter)
307308
/bin/bash ./tests/integration/integration-tests-jupyter.sh
308-
else ifeq ($(FLAVOUR), spark-gpu)
309+
else ifeq ($(FLAVOUR), gpu)
309310
/bin/bash ./tests/integration/integration-tests-gpu.sh
310311
else ifeq ($(FLAVOUR), kyuubi)
311312
@export AZURE_STORAGE_ACCOUNT=$(AZURE_STORAGE_ACCOUNT) \

images/metadata.yaml

+11-1
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,14 @@ flavours:
1111
version: 1.9.0
1212
image_description: |
1313
This is an OCI image that contains Kyuubi, fully integrated with Charmed
14-
Spark ecosystem and utilities.
14+
Spark ecosystem and utilities.
15+
gpu:
16+
version: 24.04.1
17+
image_description: |
18+
This is an OCI image that bundles Apache Spark binaries together with other
19+
tools of its ecosystem in order to be used in Charmed Operators, providing
20+
an automated and seamless experience to deploy, operate, manage and monitor
21+
SparkJob on K8s cluster.
22+
This image includes support for Nvidia Spark Rapids.
23+
It is an open source, end-to-end, production ready data platform on top of
24+
cloud native technologies.

tests/integration/integration-tests-gpu.sh

+8-2
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,11 @@ S3_BUCKET=spark-$(uuidgen)
2525

2626
get_spark_version(){
2727
# Fetch Spark version from rockcraft.yaml
28-
cat images/charmed-spark-gpu/rockcraft.yaml | yq '(.version)'
28+
SPARK_VERSION=$(cat images/charmed-spark/rockcraft.yaml | yq '(.version)')
29+
30+
GPU_VERSION=$(cat images/metadata.yaml | yq .flavours.gpu.version)
31+
32+
echo "${SPARK_VERSION}-${GPU_VERSION}"
2933
}
3034

3135

@@ -43,8 +47,10 @@ setup_user() {
4347

4448
create_serviceaccount_using_pod $USERNAME $NAMESPACE $ADMIN_POD_NAME
4549

50+
IMAGE=$(spark_image)
51+
4652
# Create the pod with the Spark service account
47-
cat ./tests/integration/resources/testpod.yaml | yq ea '.spec.serviceAccountName = '\"${USERNAME}\"' | .spec.containers[0].image="ghcr.io/welpaolo/charmed-spark@sha256:d8273bd904bb5f74234bc0756d520115b5668e2ac4f2b65a677bfb1c27e882da"' | \
53+
cat ./tests/integration/resources/testpod.yaml | yq ea '.spec.serviceAccountName = '\"${USERNAME}\"' | .spec.containers[0].image='\"${IMAGE}\" | \
4854
kubectl -n tests apply -f -
4955

5056
wait_for_pod testpod $NAMESPACE

0 commit comments

Comments
 (0)