Skip to content

feat(lakehouse): support bearer token authentication and TLS for Spark Connect - #20959

Draft
cshuo wants to merge 1 commit into
apache:masterfrom
cshuo:research/spark-connect-auth
Draft

cshuo wants to merge 1 commit into
apache:masterfrom
cshuo:research/spark-connect-auth

Conversation

@cshuo

@cshuo cshuo commented Nov 26, 2026

Copy link
Copy Markdown
Collaborator

Describe the issue this Pull Request addresses

Closes #20605.

The Helm-deployed Spark Connect endpoint accepts anonymous, plaintext connections by default. This PR lets operators require a shared bearer token and use TLS without changing the local quickstart.

Summary and Changelog

  • Set auth.existingSecret to supply the token to Spark 4.1.3. Spark's built-in authentication interceptor validates it on each RPC; no custom interceptor or proxy-side token check is needed.
  • Set tls.existingSecret to terminate TLS in an HAProxy sidecar. The Service routes clients to HAProxy, and Spark listens only on Pod loopback. Operators with an existing gRPC gateway can omit the sidecar, forward the bearer header, and protect the gateway-to-Spark connection separately.
  • Allow Superset to pass the token to Foundry ADBC through the SQLAlchemy password field. Token mode requires TLS with certificate verification. The Agent Gateway also redacts its environment-supplied token from Spark query errors.

Impact

Both features are opt-in. With neither Secret configured, the anonymous quickstart behaves as before. The token controls access to the Spark Connect endpoint; it does not provide per-user authorization or tenant isolation. Authenticated clients still use the driver's storage credentials. Spark UI and History Server access are unchanged.

Risk Level

Medium. A misconfigured Service route, certificate, or credential could either block legitimate clients or leave an unintended plaintext path.

  • GitHub Actions E2E acceptance passed: the anonymous SQL and restart-persistence tests passed, and PySpark and Foundry ADBC both executed SELECT 1 through the TLS sidecar. PySpark rejected an untrusted certificate, plaintext gRPC was rejected, and missing or incorrect tokens returned UNAUTHENTICATED.
  • In a separate local Superset 6.1.0 check, SQL Lab returned 1 over verified TLS using a saved database connection. The database API did not expose the token when the connection was read back.

Documentation Update

Updated the Spark Connect chart README with both TLS deployment options, Secret configuration, and verification steps. The Agent Gateway, Superset, and Zeppelin guides explain how each client supplies the token and trusts the endpoint certificate.

Contributor's checklist

  • Read through contributor's guide
  • Enough context is provided in the sections above
  • Adequate tests were added if applicable

@github-actions github-actions Bot added the size:L PR with lines of changes in (300, 1000] label Nov 26, 2026
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 76.56%. Comparing base (b9426d7) to head (d24e9a9).
⚠️ Report is 45 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff              @@
##             master   #20959      +/-   ##
============================================
- Coverage     80.86%   76.56%   -4.30%     
+ Complexity    36130    34311    -1819     
============================================
  Files          2590     2590              
  Lines        147743   147743              
  Branches      18253    18253              
============================================
- Hits         119473   113125    -6348     
- Misses        19993    26820    +6827     
+ Partials       8277     7798     -479     
Components Coverage Δ
hudi-common 83.57% <ø> (-0.57%) ⬇️
hudi-client 82.94% <ø> (-1.14%) ⬇️
hudi-flink 86.27% <ø> (ø)
hudi-spark-datasource 48.72% <ø> (-25.65%) ⬇️
hudi-utilities 79.25% <ø> (ø)
hudi-cli 70.92% <ø> (ø)
hudi-hadoop 70.97% <ø> (-0.21%) ⬇️
hudi-sync 77.32% <ø> (-0.03%) ⬇️
hudi-io 81.66% <ø> (ø)
hudi-timeline-service 83.49% <ø> (ø)
hudi-cloud 81.01% <ø> (ø)
hudi-kafka-connect 57.90% <ø> (ø)
Flag Coverage Δ
integration-tests 14.71% <ø> (-0.01%) ⬇️
spark-scala-tests 36.27% <ø> (-17.73%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.
see 258 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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

Labels

size:L PR with lines of changes in (300, 1000]

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Spark Connect] Add authentication and TLS to the hudi-spark-connect endpoint

2 participants