diff --git a/spark_on_k8s/client.py b/spark_on_k8s/client.py index 68b163b..8dd4848 100644 --- a/spark_on_k8s/client.py +++ b/spark_on_k8s/client.py @@ -371,6 +371,7 @@ def submit_app( image=image, image_pull_policy=image_pull_policy, namespace=namespace, + service_account=service_account, args=driver_command_args, extra_labels={**extra_labels, **driver_labels}, annotations=driver_annotations, diff --git a/tests/test_spark_client.py b/tests/test_spark_client.py index 3506ebe..75f75c2 100644 --- a/tests/test_spark_client.py +++ b/tests/test_spark_client.py @@ -198,6 +198,7 @@ def test_submit_app(self, mock_create_namespaced_service, mock_create_namespaced assert created_pod.metadata.labels["spark-app-id"] == expected_app_id assert created_pod.metadata.labels["spark-role"] == "driver" assert created_pod.spec.containers[0].image == "pyspark-job" + assert created_pod.spec.service_account_name == "spark" assert created_pod.spec.containers[0].args == [ "driver", "--master", @@ -296,6 +297,7 @@ def test_submit_app_with_env_configurations( created_pod = mock_create_namespaced_pod.call_args[1]["body"] assert created_pod.spec.containers[0].image == "test-spark-on-k8s-docker-image" + assert created_pod.spec.service_account_name == "test-service-account" assert created_pod.spec.containers[0].args == [ "driver", "--master",