Skip to content

feat(sparkconnect): add a Dependencies field to SparkConnectSpec - #3120

Open
Mr-Neutr0n wants to merge 1 commit into
kubeflow:masterfrom
Mr-Neutr0n:agent/issue-2959-add-a-dependencies-fie
Open

Mr-Neutr0n wants to merge 1 commit into
kubeflow:masterfrom
Mr-Neutr0n:agent/issue-2959-add-a-dependencies-fie

Conversation

@Mr-Neutr0n

Copy link
Copy Markdown

Fixes #2959

Added a Dependencies struct and spec.dependencies field to SparkConnectSpec, and wired the Spark Connect controller to pass dependency flags through to start-connect-server.sh the same way SparkApplication does for spark-submit.

Local tests pass.


This change was prepared with AI assistance under human direction and review.

@github-actions

Copy link
Copy Markdown

🎉 Welcome to the Kubeflow Spark Operator! 🎉

Thanks for opening your first PR! We're happy to have you as part of our community 🚀

Here's what happens next:

Join the community:

Feel free to ask questions in the comments if you need any help or clarification!
Thanks again for contributing to Kubeflow! 🙏

@google-oss-prow
google-oss-prow Bot requested review from ImpSy and tariq-hasan August 26, 2026 05:42
@google-oss-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign mwielgus for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@nabuskey

nabuskey commented Sep 2, 2026 •

Copy link
Copy Markdown
Contributor

You need to run make generate to auto generate the boilerplate code for added fields. Also we should match the field name to deps instead of dependencies.
Also, the passed in bash strings need to be handled like so: #3051

Let's add more tests too.

@google-oss-prow google-oss-prow Bot added size/XL and removed size/L labels Sep 3, 2026
@Mr-Neutr0n

Mr-Neutr0n commented Sep 3, 2026 •

Copy link
Copy Markdown
Author

Addressed the review: aligned Spark Connect with the SparkApplication deps field, shell-quoted all dependency arguments for the bash -c entrypoint, added shell-sensitive dependency coverage, and regenerated Go, CRD, OpenAPI, and Python API artifacts. d024dc8

@tariq-hasan

Copy link
Copy Markdown
Member

/retitle feat(sparkconnect): add a Dependencies field to SparkConnectSpec

@google-oss-prow google-oss-prow Bot changed the title fix: add a Dependencies field to SparkConnectSpec for structu feat(sparkconnect): add a Dependencies field to SparkConnectSpec Sep 3, 2026
@tariq-hasan

Copy link
Copy Markdown
Member

/ok-to-test
/retest

@tariq-hasan tariq-hasan left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @Mr-Neutr0n! I have added some more comments.

Please also update docs/website/user-guide/spark-connect.md, add a new examples/sparkconnect/spark-connect-dependencies.yaml and add/update e2e tests.

Comment thread api/v1alpha1/common_types.go
Comment thread api/v1alpha1/common_types.go
@Mr-Neutr0n

Copy link
Copy Markdown
Author

Addressed the review in 244c6dd:

  • Dependencies now carries only jars, packages, excludePackages, and repositories. files, pyFiles, and archives are gone from the API type, the controller, and the regenerated artifacts (deepcopy, OpenAPI, Swagger, CRDs, Python API). The type and field comments now describe the Spark Connect server instead of a Spark application.
  • .spec.deps is documented in docs/website/user-guide/spark-connect.md.
  • Added examples/sparkconnect/spark-connect-dependencies.yaml.
  • Added test/e2e/sparkconnect_dependencies_test.go, which starts the server from the new example and asserts that the dependency flags reach spark-submit.

Verification: make unit-test (with envtest), make go-vet, make go-lint (0 issues) and a build of the e2e module all pass. I could not execute the e2e suite locally (no container runtime for kind here), so that test compiles but was not run in this environment.

@Mr-Neutr0n
Mr-Neutr0n force-pushed the agent/issue-2959-add-a-dependencies-fie branch from 244c6dd to c9a8561 Compare September 18, 2026 03:20
@Mr-Neutr0n

Copy link
Copy Markdown
Author

Two CI checks needed generated updates rather than code changes: the Python model was missing the generator's trailing blank lines, and docs/api-docs.md had to be regenerated for the new v1alpha1 type. I rebased onto current master, regenerated all artifacts on that base, and re-ran the checks locally (make unit-test, go vet, golangci-lint 0 issues, root and e2e builds). The e2e matrix had been cancelled by fail-fast on the previous run, so it should run fresh on this head.

@Mr-Neutr0n
Mr-Neutr0n force-pushed the agent/issue-2959-add-a-dependencies-fie branch from c9a8561 to 2e5413c Compare September 19, 2026 02:48
@Mr-Neutr0n

Copy link
Copy Markdown
Author

The e2e run was right: the dependencies test timed out waiting for the server pod to become ready, which needs the kind cluster to resolve the Maven artifacts (the rest of the suite only uses artifacts bundled in the Spark image). I narrowed the test to what this change owns: the SparkConnect is reconciled into a server pod whose spark-submit command carries the --jars, --packages, --exclude-packages, and --repositories flags. Happy to extend it to a full startup check if the e2e cluster has Maven egress.

Add spec.deps to Spark Connect with the Maven-related fields from the
review: jars, packages, excludePackages, and repositories. The
controller passes them to spark-submit as --jars, --packages,
--exclude-packages, and --repositories.

- Regenerate the deepcopy, OpenAPI, Swagger, CRD, API docs, and Python
  API artifacts.
- Document .spec.deps in the Spark Connect user guide.
- Add examples/sparkconnect/spark-connect-dependencies.yaml.
- Add an e2e test that starts the server from the new example and
  checks that the dependency flags reach spark-submit.
- Drop two unnecessary string conversions flagged by golangci-lint.

Fixes kubeflow#2959

Signed-off-by: Mr-Neutr0n <64578610+Mr-Neutr0n@users.noreply.github.com>
@cursor
cursor Bot force-pushed the agent/issue-2959-add-a-dependencies-fie branch from 2e5413c to ae912f8 Compare September 30, 2026 14:53
@Mr-Neutr0n

Copy link
Copy Markdown
Author

Rebased onto current master and resolved the conflicts on the same branch (agent/issue-2959-add-a-dependencies-fie, head ae912f8).

Conflicts were with the Spark Connect GPU work and #3188 (per-arg container args). dependenciesOption now emits --jars / --packages / --exclude-packages / --repositories as individual container arguments (no shell quoting), matching the new entrypoint; unit + e2e tests updated for that shape.

Review asks still hold: only jars/packages/excludePackages/repositories; sparkconnect-worded comments; docs/example/e2e coverage; regenerated deepcopy/OpenAPI/CRDs/API docs/Python models clean. go test ./internal/controller/sparkconnect/... passes. PR is MERGEABLE again — remaining BLOCKED is review/CI, not conflicts.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a Dependencies field to SparkConnectSpec for structured JAR/package management

4 participants