Skip to content

fix: allow same ServicePort with different hosts in driverIngressOptions#2835

Open
puwun wants to merge 1 commit intokubeflow:masterfrom
puwun:fix/allow-same-port-different-hosts
Open

fix: allow same ServicePort with different hosts in driverIngressOptions#2835
puwun wants to merge 1 commit intokubeflow:masterfrom
puwun:fix/allow-same-port-different-hosts

Conversation

@puwun
Copy link
Copy Markdown
Contributor

@puwun puwun commented Feb 3, 2026

Fixes #2662

Purpose of this PR

Users want to expose the same Spark driver port (e.g 4040 for Spark UI) through multiple ingresses with different hostnames. The current validation incorrectly rejects this configuration as "duplicate ServicePort".

Proposed changes:

  • Modified validation to check (ServicePort, IngressURLFormat) pairs instead of just ServicePort, allowing same port with different hosts
  • Updated service and ingress naming to include index for multiple entries with the same port to ensure unique resource names
  • Added tests for the new behavior

Change Category

  • Bugfix (non-breaking change which fixes an issue)

Checklist

  • I have conducted a self-review of my own code.
  • I have updated documentation accordingly.
  • I have added tests that prove my changes are effective or that my feature works.
  • Existing unit tests pass locally with my changes.

Additional Notes

With this fix, the following configuration is now valid:

driverIngressOptions:
  - servicePort: 4040
    ingressURLFormat: "private.domain.com"
  - servicePort: 4040
    ingressURLFormat: "public.domain.com"

Copilot AI review requested due to automatic review settings February 3, 2026 15:47
@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 yuchaoran2011 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

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes an issue where users could not expose the same Spark driver port (e.g., 4040 for Spark UI) through multiple ingresses with different hostnames. The validation logic has been updated to allow this configuration, and naming has been adjusted to ensure unique resource names.

Changes:

  • Modified validation to check for duplicate (ServicePort, IngressURLFormat) pairs instead of rejecting duplicate ServicePort values
  • Updated service and ingress naming to include an index suffix when multiple entries share the same port
  • Added validation tests for the new behavior

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
internal/webhook/sparkapplication_validator.go Removed duplicate ServicePort check, added check for duplicate IngressURLFormat, and added redundant validation for (port, url) pairs
internal/webhook/sparkapplication_validator_test.go Renamed test to reflect new behavior allowing same port with different hosts, added test for duplicate host validation
internal/controller/sparkapplication/controller.go Added index parameter to driver ingress creation calls in the reconciliation loop
internal/controller/sparkapplication/driveringress.go Added index parameter to naming functions and updated service/ingress name generation to include index suffix for non-zero indices
internal/controller/sparkapplication/driveringress_test.go Updated test calls to include index parameter (0) for existing tests

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread internal/webhook/sparkapplication_validator.go Outdated
Comment thread internal/webhook/sparkapplication_validator.go Outdated
@puwun puwun force-pushed the fix/allow-same-port-different-hosts branch from e3d9edf to afbc0b6 Compare February 3, 2026 15:58
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread internal/controller/sparkapplication/driveringress_test.go
Comment thread internal/controller/sparkapplication/driveringress.go
Allow users to configure multiple driverIngressOptions entries with the
same ServicePort but different IngressURLFormat values.

Fixes kubeflow#2662

Signed-off-by: Pavan More <pavansmore05@gmail.com>
@puwun puwun force-pushed the fix/allow-same-port-different-hosts branch from afbc0b6 to 860c9c4 Compare February 4, 2026 20:23
@google-oss-prow google-oss-prow Bot added size/L and removed size/M labels Feb 4, 2026
@ChenYi015 ChenYi015 changed the title fix: allow same ServicePort with different hosts in driverIngressOptions. Fixes #2662 fix: allow same ServicePort with different hosts in driverIngressOptions Feb 11, 2026
Copy link
Copy Markdown
Contributor

@nabuskey nabuskey left a comment

Choose a reason for hiding this comment

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

Why do you want to use index for ingress name uniqueness?

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Unable to set the same port for different hosts in driverIngressOptions

3 participants