Skip to content

feat(common): add Gateway API Gateway resource with automatic route linking#45010

Merged
Crow-Control merged 2 commits intocommon2026from
copilot/sub-pr-41017-yet-again
Feb 15, 2026
Merged

feat(common): add Gateway API Gateway resource with automatic route linking#45010
Crow-Control merged 2 commits intocommon2026from
copilot/sub-pr-41017-yet-again

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Feb 15, 2026

Adds support for creating Kubernetes Gateway API Gateway objects from values.yaml, with optional name-based dynamic linking between routes and gateways via targetSelector.

Gateway Resource Support

  • Full Gateway API v1 object creation with gatewayClassName, listeners, TLS, and allowedRoutes
  • Multi-protocol listeners (HTTP, HTTPS, TCP, TLS, UDP) with per-listener hostname filtering
  • TLS termination/passthrough with certificate references

Dynamic Route Linking

  • Routes can use targetSelector to automatically generate parentRefs pointing to a named gateway
  • Manual parentRefs still supported when targetSelector is omitted
  • Backward compatible with existing route configurations

Example Usage

gateway:
  main:
    enabled: true
    gatewayClassName: traefik
    listeners:
      - name: https
        hostname: "*.example.com"
        port: 443
        protocol: HTTPS
        tls:
          mode: Terminate
          certificateRefs:
            - kind: Secret
              name: tls-cert

route:
  main:
    enabled: true
    targetSelector: main  # Auto-links to gateway.main
    hostnames:
      - app.example.com

Implementation

  • Gateway class template (templates/class/_gateway.tpl)
  • Gateway spawner (templates/spawner/_gateway.tpl)
  • Route template updated for targetSelector parentRef generation
  • Primary gateway helper for selection logic
  • Fixed route primary helper to handle missing values
  • JSON schemas and documentation for both resources

Version bumped to 29.1.0.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: PrivatePuffin <7613738+PrivatePuffin@users.noreply.github.com>
Copilot AI changed the title [WIP] Remove env-list support and enhance network policy feat(common): add Gateway API Gateway resource with automatic route linking Feb 15, 2026
Copilot AI requested a review from Crow-Control February 15, 2026 14:35
@Crow-Control Crow-Control marked this pull request as ready for review February 15, 2026 14:36
Copilot AI review requested due to automatic review settings February 15, 2026 14:36
@Crow-Control Crow-Control merged commit 9b9000f into common2026 Feb 15, 2026
7 checks passed
@Crow-Control Crow-Control deleted the copilot/sub-pr-41017-yet-again branch February 15, 2026 14:37
Copy link
Copy Markdown
Contributor

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 adds support for Kubernetes Gateway API Gateway resources with automatic route linking capabilities, enabling users to create Gateway objects from values.yaml and dynamically link routes to gateways using a targetSelector field.

Changes:

  • Added Gateway API Gateway resource template and spawner for creating Gateway objects
  • Implemented targetSelector field in routes for automatic gateway linking via parentRef generation
  • Fixed route primary helper to handle missing values gracefully

Reviewed changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
charts/library/common/values.yaml Added gateway configuration section with listeners, TLS, and allowedRoutes; documented targetSelector field for routes
charts/library/common/templates/spawner/_gateway.tpl Created gateway spawner template for rendering Gateway objects
charts/library/common/templates/loader/_apply.tpl Integrated gateway spawner into template rendering pipeline
charts/library/common/templates/lib/util/_primary_route.tpl Fixed to handle missing route values with default dict
charts/library/common/templates/lib/util/_primary_gateway.tpl Created helper to identify primary gateway for selection logic
charts/library/common/templates/class/_route.tpl Added targetSelector logic to auto-generate parentRefs from gateway name
charts/library/common/templates/class/_gateway.tpl Created Gateway resource template with full Gateway API v1 spec support
charts/library/common/schemas/route.json Added targetSelector field schema definition
charts/library/common/schemas/gateway.json Created comprehensive JSON schema for gateway configuration
charts/library/common/docs/route.md Added targetSelector documentation and examples with automatic gateway linking
charts/library/common/docs/gateway.md Created complete gateway documentation with multiple usage examples
charts/library/common/Chart.yaml Bumped chart version to 29.1.0
charts/library/common-test/tests/gateway/integration_test.yaml Added integration tests for gateway-route linking scenarios
charts/library/common-test/tests/gateway/basic_test.yaml Added basic gateway creation and enablement tests
charts/library/common-test/ci/gateway-values.yaml Added CI configuration for gateway feature testing

Comment on lines +234 to +251
kind: HTTPRoute
parentRefs:
- group: gateway.networking.k8s.io
kind: Gateway
name: main
namespace: default
hostnames:
- app.example.com
rules:
- backendRefs:
- kind: Service
name: main
port: 80
matches:
- path:
type: PathPrefix
value: /
```
Copy link

Copilot AI Feb 15, 2026

Choose a reason for hiding this comment

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

The example from line 234 to 251 appears to be duplicate or misplaced content, as it shows manual parentRefs configuration after the targetSelector example. This duplicated block should be removed or clarified if it serves a different purpose.

Suggested change
kind: HTTPRoute
parentRefs:
- group: gateway.networking.k8s.io
kind: Gateway
name: main
namespace: default
hostnames:
- app.example.com
rules:
- backendRefs:
- kind: Service
name: main
port: 80
matches:
- path:
type: PathPrefix
value: /
```

Copilot uses AI. Check for mistakes.
@truecharts-admin
Copy link
Copy Markdown
Contributor

This PR is locked to prevent necro-posting on closed PRs. Please create a issue or contact staff on discord if you want to further discuss this

@trueforge-org trueforge-org locked as resolved and limited conversation to collaborators Feb 23, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants