Skip to content

Conversation

@wilmardo
Copy link
Contributor

Adds support for the HTTPRoute resource.

I adapted the default template/values that came with helm create chart to have it uniform with other helm charts. I kept it as close to the current ingress setup as possible by splitting console and allowing templating on the path.

The templating on the path meant however that (for now) only the path matcher is supported since I needed to traverse the dict to be able to run tpl. This is represented in the schema, it won't allow other matchers then path.

I think this is the best solution to keep backwards compatible and adding other matcher is still possible, you will just need to add another clause to the if. Kept it simple for now.

@wilmardo wilmardo requested a review from a team as a code owner November 21, 2025 08:01
@wilmardo
Copy link
Contributor Author

wilmardo commented Nov 21, 2025

Output with both routes enabled:

---
# Source: keycloakx/templates/httproute.yaml
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
  name: release-name-keycloakx
  labels:
    helm.sh/chart: keycloakx-7.1.5
    app.kubernetes.io/name: keycloakx
    app.kubernetes.io/instance: release-name
    app.kubernetes.io/version: "26.4.5"
    app.kubernetes.io/managed-by: Helm
spec:
  parentRefs:
    - name: gateway
      sectionName: http
  hostnames:
    - chart-example.local
  rules:
    - matches:
        - path:
            type: PathPrefix
            value: /auth/
      backendRefs:
        - name: release-name-keycloakx-http
          port:
            name: http
---
# Source: keycloakx/templates/httproute.yaml
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
  name: release-name-keycloakx
  labels:
    helm.sh/chart: keycloakx-7.1.5
    app.kubernetes.io/name: keycloakx
    app.kubernetes.io/instance: release-name
    app.kubernetes.io/version: "26.4.5"
    app.kubernetes.io/managed-by: Helm
spec:
  parentRefs:
    - name: gateway
      sectionName: http
  hostnames:
    - chart-example.local
  rules:
    - matches:
        - path:
            type: PathPrefix
            value: /auth/admin
      backendRefs:
        - name: release-name-keycloakx-http
          port:
            name: http

Signed-off-by: wilmarguida <w.denouden@guida.nl>
@wilmardo wilmardo force-pushed the add-gateway-api-support branch from c3385e5 to a8b9a47 Compare November 21, 2025 08:04
@Eifoen
Copy link

Eifoen commented Dec 9, 2025

Is this ready to be merged? Looks pretty solid to me! Would be great to have this soon, as a lot of people are currently switching from nginx-ingress and are looking into switching ingress->gateway-api. 😊

@stefangries
Copy link
Collaborator

@Eifoen Due to the holidays, I regret to say that a review and merge can probably not be expected until the first half of January.

@jenslehnhoff
Copy link

Hey, thanks for adding Gateway API HTTPRoute support!

I noticed an issue with the servicePort field in httproute.yaml:

port:
  name: {{ $httpRoute.servicePort }}

Gateway API defines BackendObjectReference.port as PortNumber (int32), not as an object with a name field. Unlike Kubernetes Ingress, which accepts port names like "http" or "https", Gateway API strictly requires numeric port values (1-65535).

Reference: https://gateway-api.sigs.k8s.io/reference/spec/#gateway.networking.k8s.io/v1.BackendObjectReference

This causes the following error when deploying:

.spec.rules[0].backendRefs[0].port: expected numeric (int or float), got map[string]interface {}

Suggested fix:

Change the template to:

port: {{ $httpRoute.servicePort }}

And update values.yaml + values.schema.json to use an integer:

servicePort: 80

This aligns with the Gateway API spec and allows users to configure any port (80, 8080, 8443, etc.).

@wilmardo
Copy link
Contributor Author

@jenslehnhoff Thank you for the feedback and testing! I will update the PR later this week to addresses this.

Will also take the moment to test this locally, it has been on my todo list for a while haha

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants