Skip to content

feat: Add Python Virtual Environment Support: Add k8s Gateway Configuration#5138

Open
SarahAsad23 wants to merge 12 commits into
apache:mainfrom
SarahAsad23:pve-deployment
Open

feat: Add Python Virtual Environment Support: Add k8s Gateway Configuration#5138
SarahAsad23 wants to merge 12 commits into
apache:mainfrom
SarahAsad23:pve-deployment

Conversation

@SarahAsad23
Copy link
Copy Markdown
Contributor

What changes were proposed in this PR?

This PR is an extension of PR #4484, #4902, #5035, and #5069. It adds Kubernetes gateway routing and access control configurations.

Any related issues, documentation, discussions?

This change is part of ongoing efforts to support environment isolation and reproducibility within Texera. Related issue includes #4296. This PR closes sub-issue #5137.

How was this PR tested?

Tested manually.

Was this PR authored or co-authored using generative AI tooling?

Co-authored using: Claude Code (claude-opus-4-7)

@SarahAsad23 SarahAsad23 marked this pull request as draft May 20, 2026 16:58
@github-actions github-actions Bot added engine frontend Changes related to the frontend GUI dev platform Non-amber Scala service paths labels May 20, 2026
@SarahAsad23 SarahAsad23 changed the title feat: Add Python Virtual Environment Support: Add K8s Gateway Configuration feat: Add Python Virtual Environment Support: Add k8s Gateway Configuration May 20, 2026
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented May 20, 2026

Codecov Report

❌ Patch coverage is 55.55556% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 48.76%. Comparing base (d8c254c) to head (e86829d).

Files with missing lines Patch % Lines
...exera/service/resource/AccessControlResource.scala 62.50% 2 Missing and 1 partial ⚠️
...virtual-environment/virtual-environment.service.ts 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main    #5138      +/-   ##
============================================
- Coverage     48.95%   48.76%   -0.20%     
+ Complexity     2377     2370       -7     
============================================
  Files          1048     1046       -2     
  Lines         40270    40148     -122     
  Branches       4272     4273       +1     
============================================
- Hits          19714    19577     -137     
- Misses        19402    19412      +10     
- Partials       1154     1159       +5     
Flag Coverage Δ *Carryforward flag
access-control-service 40.44% <62.50%> (+0.91%) ⬆️
agent-service 33.76% <ø> (ø) Carriedforward from 2153c17
amber 51.49% <ø> (-0.09%) ⬇️
computing-unit-managing-service 0.00% <ø> (ø)
config-service 0.00% <ø> (ø)
file-service 37.99% <ø> (ø)
frontend 40.64% <0.00%> (ø)
python 90.50% <ø> (-0.30%) ⬇️ Carriedforward from 2153c17
workflow-compiling-service 56.81% <ø> (ø)

*This pull request uses carry forward flags. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@SarahAsad23 SarahAsad23 marked this pull request as ready for review May 22, 2026 07:57
@kunwp1 kunwp1 self-requested a review May 24, 2026 02:50
@kunwp1 kunwp1 linked an issue May 24, 2026 that may be closed by this pull request
6 tasks
Copy link
Copy Markdown
Contributor

@kunwp1 kunwp1 left a comment

Choose a reason for hiding this comment

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

Looks good in general. Left some comments.

@Produces(Array(MediaType.APPLICATION_JSON))
def getSystemPackages: util.Map[String, util.List[String]] = {
def getSystemPackages(
@QueryParam("isLocal") isLocal: Boolean
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

isLocal describes where the backend is running. I can see that there is a security issue where a malicious user can flip isLocal. I suggest to derive isLocal from KubernetesConfig (there's already a config flag for this) and drop the param.

private val wsapiWorkflowWebsocket: Regex = """.*/wsapi/workflow-websocket.*""".r
private val apiExecutionsStats: Regex = """.*/api/executions/[0-9]+/stats/[0-9]+.*""".r
private val apiExecutionsResultExport: Regex = """.*/api/executions/result/export.*""".r
private val pveRoute: Regex = """.*/(?:api/|wsapi/)?pve(?:/.*)?""".r
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested by Claude:

.*/(?:api/|wsapi/)?pve(?:/.*)? is overly permissive — the leading .*/ will match any path ending in …/pve or …/pve/anything, not just the expected /api/pve / /wsapi/pve / /pve shapes. Consistent with how wsapiWorkflowWebsocket / apiExecutionsStats are written above, so not out of line for this file, but the PVE routes here are well-defined enough to anchor more tightly, e.g.:

private val pveRoute: Regex = """^/?(?:auth/)?(?:api/|wsapi/)?pve(?:/.*)?$""".r

Also applies to pvePvesCuidPath and pvePackagesCuidPath below. Worth double-checking whether uriInfo.getPath here includes the auth/ prefix from the enclosing @Path("/auth") resource — your manual test probably already covered this, but the regex shape depends on it.

path match {
case wsapiWorkflowWebsocket() | apiExecutionsStats() | apiExecutionsResultExport() =>
case wsapiWorkflowWebsocket() | apiExecutionsStats() | apiExecutionsResultExport() |
pveRoute() =>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

PR description says "Tested manually." Worth adding a small unit test on AccessControlResource.authorize that covers such as:

  • /pve/system?cuid=N → 200 (query-string cuid)
  • /pve/pves/N → 200 (path-segment cuid via the DELETE route)
  • /pve/N/myenv/packages/numpy → 200 (path-segment cuid via the packages route)
  • /pve/no-cuid-anywhere → 403 (cuid extraction falls through to empty → NumberFormatException → FORBIDDEN)
  • a non-PVE garbage path → 403

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

Labels

dev engine frontend Changes related to the frontend GUI platform Non-amber Scala service paths

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Python Virtual Environment K8s Gateway Configuration

3 participants