Skip to content

add gateway HTTPRoute support #829#831

Closed
DanielRaapDev wants to merge 5 commits into
apache:mainfrom
DanielRaapDev:issue_829_gateway_support
Closed

add gateway HTTPRoute support #829#831
DanielRaapDev wants to merge 5 commits into
apache:mainfrom
DanielRaapDev:issue_829_gateway_support

Conversation

@DanielRaapDev
Copy link
Copy Markdown
Contributor

@DanielRaapDev DanielRaapDev commented Jun 1, 2026

resolves #829

disclaimer: I am not a Go developer (but Java). I used Copilot (model Claude Sonnet 4.6) to generate this changes based on my specifications.

  • Added httpRouteOptions to CRD of SolrCloud
  • extended controller code to generate Kubernetes resources of type HTTPRoute as specified.

TODO

  • unit tests
  • helm chart extension

== Prompt for Copilot with Claude Sonnet 4.6:
This Kubernetes CustomResourceDefinition for a SolrCloud resource should be extended. Like the support for `Ingress` it should be possible to specify `HTTPRoute` settings of the Gateway API. The CRD should support a list of HTTPRoutes to optionally generate multiple kubernetes resources.

A simple example of a HTTPRoute resource looks like the following:
```
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
  name: example-route
spec:
  parentRefs:
  - name: example-gateway
  hostnames:
  - "example.com"
  rules:
  - backendRefs:
    - name: example-svc
      port: 80
```

Some information about the gateway API about routing rules:
- The path-based routing rules of the Ingress resource map directly to the routing rules of the HTTPRoute.
- In Gateway API, TLS termination is a property of the Gateway listener, and similarly to the Ingress, a TLS certificate and key are also stored in a Secret.
- Because the listener is part of the Gateway resource, the cluster operator and application admin own TLS termination.
- HTTPRoutes are owned by the application developer.
- The Ingress default backend configures a backend that will respond to all unmatched HTTP requests related to that Ingress resource. Gateway API does not have a direct equivalent: it is necessary to define such a routing rule explicitly.

We just want support for HTTPRoutes as application developer. The Gateway specification is out of scope for this change.

Here is an example how to convert a Ingress to HTTPRoute:
The Ingress below will be converted as an example:
```
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: example-ingress
  annotations:
    example-ingress-controller.example.org/tls-redirect: "True"
spec:
  ingressClassName: prod
  tls:
  - hosts:
    - foo.example.com
    - bar.example.com
    secretName: example-com
  rules:
  - host: foo.example.com
    http:
      paths:
      - path: /
        pathType: Prefix
        backend:
          service:
            name: foo-app
            port:
              number: 80
      - path: /orders
        pathType: Prefix
        backend:
          service:
            name: foo-orders-app
            port:
              number: 80
  - host: bar.example.com
    http:
      paths:
      - path: /
        pathType: Prefix
        backend:
          service:
            name: bar-app
            port:
              number: 80
```
The Ingress is split into two HTTPRoutes – one for foo.example.com and one for bar.example.com hostnames.
```
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
  name: foo
spec:
  parentRefs:
  - name: example-gateway
    sectionName: https
  hostnames:
  - foo.example.com
  rules:
  - matches:
    - path:
        type: PathPrefix
        value: /
    backendRefs:
    - name: foo-app
      port: 80
  - matches:
    - path:
        type: PathPrefix
        value: /orders
    backendRefs:
    - name: foo-orders-app
      port: 80
```

== Summary of Copilot changes

Changes Made

1. `api/v1beta1/common_types.go` — Two new types added:

	•  `HTTPRouteOptions`: Defines the options for a single HTTPRoute resource to be generated. Fields:
	•  name (required) — the name of the Kubernetes HTTPRoute resource
	•  annotations — metadata annotations
	•  labels — metadata labels
	•  parentRefs — list of parent Gateway references to attach the route to
	•  hostnames — hostnames this route should match
	•  `HTTPRouteParentReference`: Defines a reference to a parent Gateway resource. Fields:
	•  name (required) — Gateway name
	•  group — API group (defaults to gateway.networking.k8s.io)
	•  kind — resource kind (defaults to Gateway)
	•  namespace — Gateway namespace
	•  sectionName — specific listener name on the Gateway
	•  port — target port on the Gateway

2. `api/v1beta1/solrcloud_types.go` — Added to CustomSolrKubeOptions:
```
HTTPRouteOptions []HTTPRouteOptions `json:"httpRouteOptions,omitempty"`
```
A separate HTTPRoute Kubernetes resource will be generated for each entry in this list.

3. `api/v1beta1/zz_generated.deepcopy.go` — Added proper DeepCopyInto/DeepCopy implementations for both HTTPRouteOptions and HTTPRouteParentReference, and extended CustomSolrKubeOptions.DeepCopyInto to handle the new slice field.

4. `config/crd/bases/solr.apache.org_solrclouds.yaml` — Added the full OpenAPI v3 schema for httpRouteOptions (as an array) within the customSolrKubeOptions properties section.
@janhoy
Copy link
Copy Markdown
Contributor

janhoy commented Jun 1, 2026

How is this related to #815 ?

@DanielRaapDev
Copy link
Copy Markdown
Contributor Author

Oh I missed that PR. Seems this is a duplicate that is not as fully featured as that one.

@janhoy
Copy link
Copy Markdown
Contributor

janhoy commented Jun 1, 2026

I'll close this one then. Perhaps you want to lend a hand to get #815 over the finish line by reviewing and testing that solution?

@janhoy janhoy closed this Jun 1, 2026
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.

Helmchart should support HTTPRoute of Gateway API

2 participants