Skip to content

fix: derive internal hostname from gatewayClassName instead of hardcoding istio#1241

Merged
Patryk-Stefanski merged 1 commit into
mainfrom
fix/1240-internal-host-gateway-class
Jul 3, 2026
Merged

fix: derive internal hostname from gatewayClassName instead of hardcoding istio#1241
Patryk-Stefanski merged 1 commit into
mainfrom
fix/1240-internal-host-gateway-class

Conversation

@Patryk-Stefanski

@Patryk-Stefanski Patryk-Stefanski commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Summary

  • InternalHost hardcoded -istio when computing the hairpin hostname, causing DNS lookup failures when gatewayClassName is not istio (e.g. openshift-default)
  • Pass gatewayClassName through derivePrivateHost and reconcileBrokerRouter so the correct Service name is derived
  • Add openshift-default test cases to cover the broken scenario

Fixes #1240

Test plan

  • make test-unit passes
  • Deploy with gatewayClassName: openshift-default and verify broker hairpin resolves the correct hostname without setting privateHost

Summary by CodeRabbit

  • New Features

    • Added optional network policy support for gateway and controller components.
    • Added a controller mode that can run without the extension reconciler.
  • Bug Fixes

    • Updated internal host generation to better match gateway class and namespace context.
    • Preserved custom private host settings while improving fallback behavior.
  • Chores

    • Updated chart version to 0.7.1.
    • Refreshed startup and deployment settings to support the new controller behavior.

@coderabbitai

coderabbitai Bot commented Jul 2, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@Patryk-Stefanski, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 33 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 5869e1d0-aa43-4647-b95d-9edb06b7e034

📥 Commits

Reviewing files that changed from the base of the PR and between 408c9ea and dbe8df6.

⛔ Files ignored due to path filters (2)
  • charts/mcp-gateway/crds/mcp.kuadrant.io_mcpgatewayextensions.yaml is excluded by !charts/mcp-gateway/crds/**
  • config/crd/mcp.kuadrant.io_mcpgatewayextensions.yaml is excluded by !config/crd/mcp.kuadrant.io_*.yaml
📒 Files selected for processing (8)
  • api/v1alpha1/mcpgatewayextension_types.go
  • api/v1alpha1/mcpgatewayextension_types_test.go
  • bundle/manifests/mcp-gateway.clusterserviceversion.yaml
  • bundle/manifests/mcp.kuadrant.io_mcpgatewayextensions.yaml
  • docs/reference/mcpgatewayextension.md
  • internal/controller/broker_router.go
  • internal/controller/deployment_test.go
  • internal/controller/mcpgatewayextension_controller.go
📝 Walkthrough

Walkthrough

MCPGatewayExtension.InternalHost now takes a gatewayClassName parameter to compute internal hostnames instead of hardcoding -istio. Broker-router wiring and controller reconciliation propagate this. Adds headless controller mode (DISABLE_EXTENSION_RECONCILER), exported SetupRequiredIndexes, Helm NetworkPolicy templates/values, a chart version bump, OLM dependency removal, and a design doc.

Changes

Gateway-class-aware host + headless controller

Layer / File(s) Summary
InternalHost gatewayClassName parameter and tests
api/v1alpha1/mcpgatewayextension_types.go, api/v1alpha1/mcpgatewayextension_types_test.go
InternalHost(port, gatewayClassName) replaces hardcoded -istio service naming with <name>-<gatewayClassName> convention; tests updated with new gatewayClassName field and openshift-default coverage.
Broker-router wiring and deployment tests
internal/controller/broker_router.go, internal/controller/mcpgatewayextension_controller.go, internal/controller/deployment_test.go
derivePrivateHost/reconcileBrokerRouter accept gatewayClassName; controller passes targetGateway.Spec.GatewayClassName; broker-router deployment tests updated across many cases.
Headless controller mode and index setup
internal/controller/mcpgatewayextension_controller.go, internal/controller/setup_indexes_test.go, cmd/main.go
Adds exported SetupRequiredIndexes, simplifies SetupWithManager, and gates MCPGatewayExtensionReconciler setup behind DISABLE_EXTENSION_RECONCILER.
Helm chart updates
charts/mcp-gateway/templates/deployment-controller.yaml, charts/mcp-gateway/templates/networkpolicy-*.yaml, charts/mcp-gateway/values.yaml, charts/mcp-gateway/Chart.yaml
Adds conditional env var, broker-router/controller NetworkPolicy templates, disableExtensionReconciler/networkPolicy.enabled values, and bumps chart to 0.7.1.
OLM dependency removal and design doc
bundle/metadata/dependencies.yaml, docs/design/umbrella-operator-integration/umbrella-operator-integration-design.md
Removes kuadrant-operator OLM dependency; adds design doc describing kuadrant-operator integration architecture, migration, and rollout plan.

Estimated code review effort: 4 (Complex) | ~60 minutes

Possibly related issues

Possibly related PRs

Suggested labels: review-effort/large

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning The PR also adds Helm chart, NetworkPolicy, headless-mode, and design-doc changes that are unrelated to issue #1240. Move the mcp-gateway integration, chart, and design-doc work into a separate PR or trim them to the hostname fix only.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: deriving the internal hostname from gatewayClassName instead of hardcoding istio.
Linked Issues check ✅ Passed The hostname fix and added openshift-default coverage satisfy issue #1240’s requirement to use the Gateway class name in InternalHost.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/1240-internal-host-gateway-class

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot added the review-effort/large High review effort (4-5): many files, complex, cross-cutting label Jul 2, 2026
@Patryk-Stefanski Patryk-Stefanski force-pushed the fix/1240-internal-host-gateway-class branch from 408c9ea to f3abb57 Compare July 2, 2026 17:13

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
docs/design/umbrella-operator-integration/umbrella-operator-integration-design.md (1)

56-280: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Rework the Design section into the required doc structure.

This reads like implementation notes in places (Helm function names, chart-rendering mechanics, etc.), but docs/design/**/*.md needs explicit Prerequisites, Flow, Component Responsibilities, API Changes, and Data storage subsections. Move the function-level detail out of the main narrative and keep the design focused on behavior and boundaries. As per path instructions, docs/design/**/*.md must include sections: Problem, Summary, Goals/Non-Goals, Job Stories, Design (with Prerequisites, Flow, Component Responsibilities, API Changes, Data storage subsections), Security Considerations, Relationship to Existing Approaches, Future Considerations, and Execution.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@docs/design/umbrella-operator-integration/umbrella-operator-integration-design.md`
around lines 56 - 280, The Design section needs to be restructured to match the
required docs template instead of mixing implementation notes into the
narrative. Update the document around the “Design” content to include the
missing top-level sections and ensure “Design” has explicit “Prerequisites”,
“Flow”, “Component Responsibilities”, “API Changes”, and “Data storage”
subsections. Move function-level details like renderChart, buildValues,
applyManifest, and migration helpers into the appropriate subsection or out of
the main flow, and keep the focus on behavior, boundaries, and responsibilities.

Source: Path instructions

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@api/v1alpha1/mcpgatewayextension_types.go`:
- Around line 294-306: Update the stale CRD doc comment for
MCPGatewayExtensionSpec.PrivateHost, which still hardcodes the old “-istio”
default. Keep the existing InternalHost behavior as-is, but revise the
PrivateHost field description in MCPGatewayExtensionSpec so it matches the
gatewayClassName-based host convention used by InternalHost and no longer
implies Istio-only naming.

---

Nitpick comments:
In
`@docs/design/umbrella-operator-integration/umbrella-operator-integration-design.md`:
- Around line 56-280: The Design section needs to be restructured to match the
required docs template instead of mixing implementation notes into the
narrative. Update the document around the “Design” content to include the
missing top-level sections and ensure “Design” has explicit “Prerequisites”,
“Flow”, “Component Responsibilities”, “API Changes”, and “Data storage”
subsections. Move function-level details like renderChart, buildValues,
applyManifest, and migration helpers into the appropriate subsection or out of
the main flow, and keep the focus on behavior, boundaries, and responsibilities.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 36ffd569-8b07-4760-924f-9ad390401455

📥 Commits

Reviewing files that changed from the base of the PR and between 4b62869 and 408c9ea.

📒 Files selected for processing (14)
  • api/v1alpha1/mcpgatewayextension_types.go
  • api/v1alpha1/mcpgatewayextension_types_test.go
  • bundle/metadata/dependencies.yaml
  • charts/mcp-gateway/Chart.yaml
  • charts/mcp-gateway/templates/deployment-controller.yaml
  • charts/mcp-gateway/templates/networkpolicy-broker-router.yaml
  • charts/mcp-gateway/templates/networkpolicy-controller.yaml
  • charts/mcp-gateway/values.yaml
  • cmd/main.go
  • docs/design/umbrella-operator-integration/umbrella-operator-integration-design.md
  • internal/controller/broker_router.go
  • internal/controller/deployment_test.go
  • internal/controller/mcpgatewayextension_controller.go
  • internal/controller/setup_indexes_test.go
💤 Files with no reviewable changes (1)
  • bundle/metadata/dependencies.yaml

Comment thread api/v1alpha1/mcpgatewayextension_types.go
@Patryk-Stefanski Patryk-Stefanski force-pushed the fix/1240-internal-host-gateway-class branch 2 times, most recently from 7928cfc to e374d4d Compare July 2, 2026 17:29
…ding istio

InternalHost computed <gateway>-istio.<ns>.svc.cluster.local regardless of
gatewayClassName. With openshift-default the Gateway controller names the
Service <gateway>-openshift-default, so the computed hostname did not exist
and broker session hairpin failed with a DNS lookup error.

Pass gatewayClassName through derivePrivateHost and reconcileBrokerRouter
so InternalHost uses the actual class name. privateHost override is
unaffected.

Update stale privateHost field comments and API reference doc to reflect
the gatewayClassName-based convention. Regenerate CRDs and bundle manifests.

Fixes #1240.

Signed-off-by: Patryk Stefanski <pstefans@redhat.com>
@Patryk-Stefanski Patryk-Stefanski force-pushed the fix/1240-internal-host-gateway-class branch from e374d4d to dbe8df6 Compare July 2, 2026 17:32
@Patryk-Stefanski Patryk-Stefanski merged commit b56a459 into main Jul 3, 2026
19 checks passed
@jasonmadigan jasonmadigan deleted the fix/1240-internal-host-gateway-class branch July 8, 2026 09:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

review-effort/large High review effort (4-5): many files, complex, cross-cutting

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MCPGatewayExtension derives wrong internal hostname for non-istio gateway classes

2 participants