Skip to content

feat: add Gateway API support in hydra - #889

Open
PatTheSilent wants to merge 6 commits into
ory:masterfrom
PatTheSilent:master
Open

PatTheSilent wants to merge 6 commits into
ory:masterfrom
PatTheSilent:master

Conversation

@PatTheSilent

@PatTheSilent PatTheSilent commented Jul 3, 2026

Copy link
Copy Markdown

Related Issue or Design Document

partially implements #845

Checklist

  • I have read the contributing guidelines and signed the CLA.
  • I have referenced an issue containing the design document if my change introduces a new feature.
  • I have read the security policy.
  • I confirm that this pull request does not address a security vulnerability.
    If this pull request addresses a security vulnerability,
    I confirm that I got approval (please contact security@ory.com) from the maintainers to push the changes.
  • I have added tests that prove my fix is effective or that my feature works.
  • I have added the necessary documentation within the code base (if appropriate).

Further comments

This PR adds Gateway API HTTPRoutes in hydra for the API and proxy.
The objective was to provide a drop-in replacement for Ingress resources.
One discepancy is in _helpers.tpl and the hydra.config.urls.issuer helper. HTTPRoutes don't contain information about TLS in their spec so it's impossible to determine the protocol just from it. Since you can work around this by using .Values.hydra.config.urls.self.issuer I did not consider it a problem but I'm happy to get feedback.

This PR is a bit selfish. I just need to get this done one way or another and thought that contributing back was the best way to get it done.

Summary by CodeRabbit

  • New Features

    • Added optional HTTPRoute support for public and admin endpoints.
    • Added configuration options for route hostnames, parent references, annotations, matches, filters, timeouts, and backend service ports.
    • HTTPRoutes are disabled by default and can be enabled independently.
    • Updated issuer URL selection to recognize public HTTP routing and use the configured public hostname.
  • Documentation

    • Added default example settings and placeholder hostnames for the new routing options in chart values.

@CLAassistant

CLAassistant commented Jul 3, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@coderabbitai

coderabbitai Bot commented Jul 3, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 99fab7b7-cff8-4fd6-99e0-70dc2e3e4776

📥 Commits

Reviewing files that changed from the base of the PR and between e300d2b and ad26a3e.

📒 Files selected for processing (3)
  • helm/charts/hydra/templates/httproute-admin.yaml
  • helm/charts/hydra/templates/httproute-public.yaml
  • helm/charts/hydra/values.yaml
💤 Files with no reviewable changes (1)
  • helm/charts/hydra/values.yaml
🚧 Files skipped from review as they are similar to previous changes (1)
  • helm/charts/hydra/templates/httproute-public.yaml

Included review availability: Your plan provides up to 2 included reviews per hour; 1 remains after this review.


📝 Walkthrough

Walkthrough

This PR adds Gateway API HTTPRoute support to the Hydra Helm chart. It adds public and admin route templates, disabled defaults with hostnames, and issuer URL selection from the public HTTPRoute hostname.

Changes

HTTPRoute feature

Layer / File(s) Summary
Values and issuer URL derivation
helm/charts/hydra/values.yaml, helm/charts/hydra/templates/_helpers.tpl
Adds public and admin HTTPRoute values. Both routes are disabled by default. The issuer helper uses the first public HTTPRoute hostname when that route is enabled.
HTTPRoute templates for public and admin services
helm/charts/hydra/templates/httproute-public.yaml, helm/charts/hydra/templates/httproute-admin.yaml
Adds conditional HTTPRoute resources with metadata, optional routing fields, service backends, and optional rule filters, matches, and timeouts.

Priority: ➖ Normal — Schedule the Gateway API support because it adds public and admin HTTPRoute resources across Hydra’s Helm chart, but no urgent external impact is indicated.

Estimated code review effort: 2 (Simple) | ~12 minutes

Merge Risk: 🟡 Moderate · up to ad26a

Enabling the new public HTTPRoute can configure Hydra with an HTTP issuer even when users expose it over HTTPS through a Gateway. This can produce an incorrect issuer URL for clients and should be addressed or explicitly accepted before merge.

Sequence Diagram(s)

sequenceDiagram
  participant Values as HTTPRoute values
  participant Helm as Helm templates
  participant Gateway as Kubernetes Gateway API
  participant Issuer as hydra.config.urls.issuer

  Values->>Helm: Enable public or admin HTTPRoute
  Helm->>Gateway: Render HTTPRoute with service backend
  Values->>Issuer: Provide public hostname
  Issuer->>Issuer: Build http://<host> issuer URL
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the main change: adding Gateway API support to Hydra.
Description check ✅ Passed The description explains the Gateway API HTTPRoute changes, links the related issue, records the protocol limitation, and completes the relevant checklist items. It also clearly states that tests and …
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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 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

♻️ Duplicate comments (3)
helm/charts/hydra/templates/httproute-admin.yaml (2)

17-20: 🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win

Default empty parentRefs produces an invalid HTTPRoute.

Same concern as flagged for httproute-public.yaml and values.yaml.

Also applies to: 27-32

🤖 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 `@helm/charts/hydra/templates/httproute-admin.yaml` around lines 17 - 20, The
httproute-admin template currently renders an empty parentRefs block when
.Values.httproute.admin.parentRefs is unset, which makes the HTTPRoute invalid.
Update the template around parentRefs in the httproute-admin YAML to only emit
that section when there is at least one entry, using the same conditional
pattern used for httproute-public.yaml, and ensure the related defaults in
values.yaml do not leave parentRefs empty by default.

5-15: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Same labels/annotations nesting bug as httproute-public.yaml.

Identical control-flow issue: the if .Release.Namespace (line 7) is only closed at line 15, so labels: (9-10) and annotations: (11-14) are nested inside it, unlike service-admin.yaml's pattern where the namespace conditional closes immediately after the namespace: line.

🐛 Proposed fix
 metadata:
   name: {{ $fullName }}-admin
   {{- if .Release.Namespace }}
   namespace: {{ .Release.Namespace }}
+  {{- end }}
   labels:
     {{- include "hydra.labels" . | nindent 4 }}
   {{- with .Values.httproute.admin.annotations }}
   annotations:
     {{- tpl (toYaml .) $ | nindent 4 }}
   {{- end }}
-  {{- end }}
 spec:
🤖 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 `@helm/charts/hydra/templates/httproute-admin.yaml` around lines 5 - 15, The
metadata block in httproute-admin has the same nesting mistake as
httproute-public: the .Release.Namespace conditional in the template keeps
labels and annotations inside it instead of matching the service-admin pattern.
Update the httproute-admin template so the namespace guard only wraps the
namespace field, then render labels and annotations unconditionally afterward,
using the existing metadata structure and symbols like .Release.Namespace,
.Values.httproute.admin.annotations, and include "hydra.labels".
helm/charts/hydra/templates/httproute-public.yaml (1)

17-20: 🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win

Default empty parentRefs produces an invalid HTTPRoute.

See corresponding comment on values.yaml — with the default parentRefs: [], this with block renders no content, leaving parentRefs: with a null value, which is invalid since Gateway API HTTPRoutes require at least one parentRef to attach to a Gateway.

Also applies to: 27-32

🤖 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 `@helm/charts/hydra/templates/httproute-public.yaml` around lines 17 - 20, The
HTTPRoute templates are rendering an empty parentRefs field when
.Values.httproute.public.parentRefs (and the same pattern in the other affected
template block) is left at its default empty list, which produces an invalid
route. Update the templating around the parentRefs section in the HTTPRoute
manifest so it either always renders at least one valid parentRef or
conditionally omits the entire HTTPRoute when no parentRefs are configured,
using the existing .Values.httproute.public.parentRefs lookup to locate the fix.
🤖 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 `@helm/charts/hydra/templates/httproute-public.yaml`:
- Around line 5-15: The `httproute-public.yaml` template has `labels` and
`annotations` incorrectly nested under the `.Release.Namespace` conditional.
Update the `metadata` block so the `if .Release.Namespace` in the
`httproute-public` template only wraps the `namespace:` line, then close it
before `labels:` and the `with .Values.httproute.public.annotations` block,
matching the pattern used in `service-public.yaml`.

---

Duplicate comments:
In `@helm/charts/hydra/templates/httproute-admin.yaml`:
- Around line 17-20: The httproute-admin template currently renders an empty
parentRefs block when .Values.httproute.admin.parentRefs is unset, which makes
the HTTPRoute invalid. Update the template around parentRefs in the
httproute-admin YAML to only emit that section when there is at least one entry,
using the same conditional pattern used for httproute-public.yaml, and ensure
the related defaults in values.yaml do not leave parentRefs empty by default.
- Around line 5-15: The metadata block in httproute-admin has the same nesting
mistake as httproute-public: the .Release.Namespace conditional in the template
keeps labels and annotations inside it instead of matching the service-admin
pattern. Update the httproute-admin template so the namespace guard only wraps
the namespace field, then render labels and annotations unconditionally
afterward, using the existing metadata structure and symbols like
.Release.Namespace, .Values.httproute.admin.annotations, and include
"hydra.labels".

In `@helm/charts/hydra/templates/httproute-public.yaml`:
- Around line 17-20: The HTTPRoute templates are rendering an empty parentRefs
field when .Values.httproute.public.parentRefs (and the same pattern in the
other affected template block) is left at its default empty list, which produces
an invalid route. Update the templating around the parentRefs section in the
HTTPRoute manifest so it either always renders at least one valid parentRef or
conditionally omits the entire HTTPRoute when no parentRefs are configured,
using the existing .Values.httproute.public.parentRefs lookup to locate the fix.
🪄 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: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 0a0eed4a-142e-40ee-9910-937260d7825b

📥 Commits

Reviewing files that changed from the base of the PR and between 4de8d62 and e300d2b.

📒 Files selected for processing (4)
  • helm/charts/hydra/templates/_helpers.tpl
  • helm/charts/hydra/templates/httproute-admin.yaml
  • helm/charts/hydra/templates/httproute-public.yaml
  • helm/charts/hydra/values.yaml

Comment thread helm/charts/hydra/templates/httproute-public.yaml Outdated
@PatTheSilent

Copy link
Copy Markdown
Author

@Demonsthere @piotrmsc any chance I could get your attention?

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants