Skip to content

[platform, system, apps] Add Gateway API HTTPRoute/TLSRoute support for all components#2213

Draft
sircthulhu wants to merge 19 commits intomainfrom
feat/gateway-api-httproutes
Draft

[platform, system, apps] Add Gateway API HTTPRoute/TLSRoute support for all components#2213
sircthulhu wants to merge 19 commits intomainfrom
feat/gateway-api-httproutes

Conversation

@sircthulhu
Copy link
Contributor

@sircthulhu sircthulhu commented Mar 13, 2026

What this PR does

Adds Gateway API (HTTPRoute/TLSRoute) support alongside existing Ingress resources for all system and tenant-level components, enabling a migration path from ingress-nginx to Cilium Gateway API.

Architecture

System services use a central Gateway (cozystack-gateway package in cozy-gateway namespace) with per-hostname HTTPS listeners and TLS passthrough listeners. Components create HTTPRoute/TLSRoute resources that attach to this central Gateway via parentRefs.

Tenant services (monitoring, bucket, harbor, bootbox, seaweedfs) create per-component Gateways with infrastructure.labels to share a single LoadBalancer IP per tenant. The label cozystack.io/gateway: <tenant-name> is the Gateway API equivalent of the IngressClass-per-tenant pattern.

Tenant gateway model

A new gateway field is added to tenant values (default: false). When set, the tenant namespace gets namespace.cozystack.io/gateway label and _namespace.gateway config propagated to child packages. This follows the same inheritance model as the existing ingress field — child tenants inherit the parent's gateway name, or can set gateway: true to get their own dedicated LoadBalancer.

ExternalIPs handling

publishing.externalIPs are shared between ingress and gateway with ingress taking priority:

  • When ingress is enabled — ingress-nginx Service gets externalIPs (existing behavior), gateway uses standard Cilium LB
  • When ingress is disabled — a CiliumLoadBalancerIPPool is created with the externalIPs, matched to the Gateway's LoadBalancer Service via cozystack.io/gateway label
  • When both are enabled — ingress wins, no IP pool is created for gateway

Keycloak changes

Keycloak sticky session route encoding is disabled (KC_SPI_STICKY_SESSION_ENCODER_INFINISPAN_SHOULD_ATTACH_ROUTE=false). Cilium Gateway API does not support cookie-based session affinity. Keycloak with Infinispan distributed cache works without sticky sessions — sessions are replicated across nodes, adding at most one extra network hop to the session owner.

Cilium configuration

  • gatewayAPI.enabled: true when gateway.gatewayAPI is set
  • envoy.streamIdleTimeoutDurationSeconds: 86400 — increased from default 300s to support long-lived connections (WebSocket/noVNC, large uploads)
  • gatewayAPI.enableAlpn: true — required for gRPC backend protocol support (seaweedfs)

Components covered

  • System: dashboard, keycloak (HTTPRoute), kubernetes-api, vm-exportproxy, cdi-uploadproxy (TLSRoute)
  • Tenant: grafana, alerta, bucket, harbor, bootbox (HTTPRoute), seaweedfs (TLSRoute)

All Gateway API resources are conditional on gateway.gatewayAPI: true. Existing Ingress templates are untouched — both can coexist simultaneously.

Release note

[platform] Add Gateway API support as an alternative to ingress-nginx. Enable with `gateway.gatewayAPI: true` in platform config. All system and tenant components support HTTPRoute/TLSRoute via Cilium Gateway API. New `gateway` field in tenant config controls per-tenant LoadBalancer allocation. ExternalIPs are automatically assigned to Gateway when ingress is disabled via CiliumLoadBalancerIPPool. Keycloak sticky sessions disabled in favor of Infinispan distributed cache for Gateway API compatibility.

Summary by CodeRabbit

  • New Features

    • Added Gateway API support as an alternative routing option for system services including Dashboard, Keycloak, Harbor, Grafana, and others
    • Tenants can now optionally deploy dedicated Gateway API gateways for service access
    • Support for TLS passthrough and automatic HTTP-to-HTTPS redirects via Gateway API
  • Tests

    • Added comprehensive end-to-end tests for Gateway API enablement and integration across platform components

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 13, 2026

📝 Walkthrough

Walkthrough

This pull request introduces comprehensive Gateway API integration across the platform. It adds Gateway API Custom Resource Definitions (CRDs) to the platform, enables conditional Gateway API support in the tenant application, introduces a new cozystack-gateway system component, and adds HTTPRoute and TLSRoute resources for multiple system components and applications to expose services via Gateway API instead of or alongside traditional Ingress.

Changes

Cohort / File(s) Summary
Gateway API Platform Infrastructure
packages/core/platform/sources/cozystack-gateway.yaml, packages/core/platform/sources/networking.yaml
Introduces cozystack-gateway as a new PackageSource and adds gateway-api-crds component across multiple networking variants with dependencies.
Tenant Gateway Configuration
packages/apps/tenant/values.yaml, packages/apps/tenant/values.schema.json, packages/apps/tenant/templates/namespace.yaml, packages/apps/tenant/README.md
Adds gateway parameter to tenant configuration, schema, and namespace templates to enable per-tenant Gateway API deployment.
Core Platform Templates
packages/core/platform/templates/apps.yaml, packages/core/platform/templates/bundles/system.yaml, packages/core/platform/values.yaml
Configures platform-level gateway settings, conditionally enables gateway-api and external-dns integration, and adds hostname overrides for system services.
Cozystack Gateway Component
packages/system/cozystack-gateway/Chart.yaml, packages/system/cozystack-gateway/templates/gateway.yaml, packages/system/cozystack-gateway/values.yaml
Introduces new Helm chart for the central Gateway resource with HTTPS listeners, TLS termination, and optional redirect HTTPRoute.
System Component Gateway Routes
packages/system/dashboard/templates/httproute.yaml, packages/system/keycloak/templates/httproute.yaml, packages/system/cozystack-api/templates/api-tlsroute.yaml, packages/system/kubevirt/templates/vm-exportproxy-tlsroute.yaml, packages/system/kubevirt-cdi/templates/cdi-uploadproxy-tlsroute.yaml
Adds HTTPRoute and TLSRoute resources for dashboard, Keycloak, Kubernetes API, and KubeVirt services when gateway-api is enabled.
Application Gateway Routes
packages/apps/harbor/templates/httproute.yaml, packages/extra/bootbox/templates/matchbox/httproute.yaml, packages/extra/seaweedfs/templates/tlsroute.yaml, packages/system/bucket/templates/httproute.yaml
Introduces HTTPRoute and TLSRoute templates for Harbor, bootbox, SeaweedFS, and bucket UI services with conditional rendering.
Monitoring Gateway Routes
packages/system/monitoring/templates/alerta/httproute.yaml, packages/system/monitoring/templates/grafana/httproute.yaml
Adds Gateway and HTTPRoute resources for Alerta and Grafana when gateway-api is enabled and gateway is specified.
Configuration & Miscellaneous
packages/system/cert-manager/values.yaml, packages/system/keycloak/templates/sts.yaml, packages/system/cozystack-basics/templates/cozystack-values-secret.yaml, packages/system/tenant-rd/cozyrds/tenant.yaml
Adds cert-manager values placeholder, Keycloak sticky session encoder configuration, gateway tenant metadata, and tenant schema property.
E2E Tests
hack/e2e-install-cozystack.bats
Comprehensive test suite validating Gateway API enablement, routing, acceptance, and accessibility across dashboard, Keycloak, Kubernetes API, and tenant-scoped Grafana.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~50 minutes

Poem

🐰 A gateway of routes now stands so tall,
Through platform and tenant, it routes them all,
HTTPRoute, TLSRoute, with flair and grace,
APIs and dashboards find their place!
Hopping with glee at this feature so keen, 🚀

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: adding Gateway API HTTPRoute/TLSRoute support across platform, system, and apps components.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/gateway-api-httproutes
📝 Coding Plan
  • Generate coding plan for human review comments

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 and usage tips.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the platform's networking capabilities by integrating the Kubernetes Gateway API. It provides a modern and flexible alternative to traditional Ingress resources, facilitating a smoother migration path to Cilium Gateway API. The changes introduce a structured approach for both system-wide and tenant-specific traffic management, allowing for fine-grained control over routing and load balancing while ensuring backward compatibility with existing Ingress configurations.

Highlights

  • Gateway API Integration: Added comprehensive support for Kubernetes Gateway API (HTTPRoute/TLSRoute) across all system and tenant-level components.
  • Centralized System Gateway: System services now utilize a single cozystack-gateway with dedicated HTTPS and TLS passthrough listeners, mirroring the existing IngressClass pattern.
  • Tenant-Specific Gateways: Tenant services can provision their own Gateways, leveraging infrastructure.labels to share a LoadBalancer per tenant, similar to the IngressClass-per-tenant model.
  • Tenant Configuration Update: Introduced a new gateway field in tenant values, enabling propagation of Gateway API configuration and namespace labeling.
  • Coexistence and Conditional Deployment: Gateway API resources are activated via gateway.gatewayAPI: true in platform config and are designed to coexist with existing Ingress resources without conflict.
  • Expanded Component Support: Extended Gateway API support to a wide range of components, including system services like dashboard, Keycloak, Kubernetes API, VM Export Proxy, CDI Upload Proxy, and tenant services such as Grafana, Alerta, Bucket, Harbor, Bootbox, and SeaweedFS.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • packages/apps/harbor/templates/httproute.yaml
    • Added Gateway API HTTPRoute and Gateway resources for Harbor.
  • packages/apps/tenant/templates/namespace.yaml
    • Updated to include gateway configuration and labels for tenant namespaces.
  • packages/apps/tenant/values.yaml
    • Introduced a new gateway parameter for tenant configuration.
  • packages/core/platform/sources/cozystack-gateway.yaml
    • Added the package source definition for cozystack-gateway.
  • packages/core/platform/templates/apps.yaml
    • Modified to propagate Gateway API related cluster values.
  • packages/core/platform/templates/bundles/system.yaml
    • Updated to conditionally include the cozystack-gateway package.
  • packages/core/platform/values.yaml
    • Configured default settings for the system gateway and added a hostnames map for publishing.
  • packages/extra/bootbox/templates/matchbox/httproute.yaml
    • Added Gateway API HTTPRoute and Gateway resources for Bootbox.
  • packages/extra/seaweedfs/templates/tlsroute.yaml
    • Added Gateway API TLSRoute and Gateway resources for SeaweedFS.
  • packages/system/bucket/templates/httproute.yaml
    • Added Gateway API HTTPRoute and Gateway resources for Bucket.
  • packages/system/cozystack-api/templates/api-tlsroute.yaml
    • Added Gateway API TLSRoute for the Kubernetes API.
  • packages/system/cozystack-basics/templates/cozystack-values-secret.yaml
    • Updated to include gateway in the tenant root values secret.
  • packages/system/cozystack-gateway/Chart.yaml
    • Added the Helm Chart definition for cozy-cozystack-gateway.
  • packages/system/cozystack-gateway/templates/gateway.yaml
    • Added the central cozystack Gateway and an HTTPRoute for HTTP to HTTPS redirection.
  • packages/system/cozystack-gateway/values.yaml
    • Added the default values file for cozystack-gateway.
  • packages/system/dashboard/templates/httproute.yaml
    • Added Gateway API HTTPRoute for the Dashboard.
  • packages/system/keycloak/templates/httproute.yaml
    • Added Gateway API HTTPRoute for Keycloak.
  • packages/system/kubevirt-cdi/templates/cdi-uploadproxy-tlsroute.yaml
    • Added Gateway API TLSRoute for CDI Upload Proxy.
  • packages/system/kubevirt/templates/vm-exportproxy-tlsroute.yaml
    • Added Gateway API TLSRoute for VM Export Proxy.
  • packages/system/monitoring/templates/alerta/httproute.yaml
    • Added Gateway API HTTPRoute and Gateway resources for Alerta.
  • packages/system/monitoring/templates/grafana/httproute.yaml
    • Added Gateway API HTTPRoute and Gateway resources for Grafana.
Activity
  • No activity has been recorded for this pull request yet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces comprehensive support for the Gateway API across system and tenant components, providing a clear migration path from ingress-nginx. The changes are well-structured, with a central gateway for system services and per-tenant gateways for tenant services, which is a solid design. The use of HTTPRoute and TLSRoute is appropriate for the different services.

I have a few suggestions for improvement:

  • My main concern is the use of the deprecated gateway.networking.k8s.io/v1alpha2 API version for TLSRoute resources. I strongly recommend updating this to a stable version like v1 or v1beta1 for future compatibility.
  • I've also identified a couple of areas with repetitive code in the Helm templates where using helper templates or loops could improve maintainability.

Overall, this is a great enhancement. Addressing these points will make the implementation more robust and easier to maintain.

namespaces:
from: Same
---
apiVersion: gateway.networking.k8s.io/v1alpha2
Copy link
Contributor

Choose a reason for hiding this comment

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

high

The apiVersion for TLSRoute is set to gateway.networking.k8s.io/v1alpha2, which is from an old experimental channel of the Gateway API and has been deprecated. It's recommended to use a more recent, stable version. Given that HTTPRoute resources in this PR are using v1, for consistency and future compatibility, you should update TLSRoute to gateway.networking.k8s.io/v1 if your cluster's Gateway API support is at v1.0.0 or newer. If not, v1beta1 would be a better choice than v1alpha2. This applies to all new TLSRoute resources in this pull request (cozystack-api/templates/api-tlsroute.yaml, kubevirt-cdi/templates/cdi-uploadproxy-tlsroute.yaml, and kubevirt/templates/vm-exportproxy-tlsroute.yaml).

apiVersion: gateway.networking.k8s.io/v1

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed that

Comment on lines +32 to +35
{{- $gateway := $parentNamespace.gateway | default "" }}
{{- if .Values.gateway }}
{{- $gateway = $tenantName }}
{{- end }}
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

This logic for determining the service reference is repeated for etcd, ingress, monitoring, and seaweedfs. To improve maintainability and reduce code duplication, consider creating a shared helper template. For example, you could define a helper in a common _helpers.tpl file:

{{- define "tenant.serviceRef" -}}
{{-   $serviceName := .serviceName -}}
{{-   $ref := index .parentNamespace $serviceName | default "" -}}
{{-   if index .values $serviceName -}}
{{-     $ref = .tenantName -}}
{{-   end -}}
{{-   $ref -}}
{{- end -}}

And then use it like this for each service:

{{- $gateway := include "tenant.serviceRef" (dict "serviceName" "gateway" "tenantName" $tenantName "parentNamespace" $parentNamespace "values" .Values) -}}

This would make the template cleaner and easier to manage.

Comment on lines +26 to +84
{{- if has "dashboard" $exposeServices }}
- name: https-dashboard
protocol: HTTPS
port: 443
hostname: {{ index $hostnames "dashboard" | default (printf "dashboard.%s" $rootHost) | quote }}
tls:
mode: Terminate
certificateRefs:
- name: gateway-dashboard-tls
allowedRoutes:
namespaces:
from: All
{{- end }}
{{- if eq $oidcEnabled "true" }}
- name: https-keycloak
protocol: HTTPS
port: 443
hostname: {{ index $hostnames "keycloak" | default (printf "keycloak.%s" $rootHost) | quote }}
tls:
mode: Terminate
certificateRefs:
- name: gateway-keycloak-tls
allowedRoutes:
namespaces:
from: All
{{- end }}
{{- if has "api" $exposeServices }}
- name: tls-passthrough-api
protocol: TLS
port: 443
hostname: {{ index $hostnames "api" | default (printf "api.%s" $rootHost) | quote }}
tls:
mode: Passthrough
allowedRoutes:
namespaces:
from: All
{{- end }}
{{- if has "vm-exportproxy" $exposeServices }}
- name: tls-passthrough-vm-exportproxy
protocol: TLS
port: 443
hostname: {{ index $hostnames "vm-exportproxy" | default (printf "vm-exportproxy.%s" $rootHost) | quote }}
tls:
mode: Passthrough
allowedRoutes:
namespaces:
from: All
{{- end }}
{{- if has "cdi-uploadproxy" $exposeServices }}
- name: tls-passthrough-cdi-uploadproxy
protocol: TLS
port: 443
hostname: {{ index $hostnames "cdi-uploadproxy" | default (printf "cdi-uploadproxy.%s" $rootHost) | quote }}
tls:
mode: Passthrough
allowedRoutes:
namespaces:
from: All
{{- end }}
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The listener definitions for different services are very repetitive. To improve maintainability, you could refactor this by defining a list or map of services and their properties, and then looping through them to generate the listener configurations. This would reduce code duplication and make it easier to add or modify services in the future.

@sircthulhu sircthulhu force-pushed the feat/gateway-api-httproutes branch from 3b366e2 to 8c3ad83 Compare March 16, 2026 17:13
@sircthulhu sircthulhu changed the base branch from feat/envoy-gateway to main March 18, 2026 16:08
@sircthulhu sircthulhu self-assigned this Mar 18, 2026
sircthulhu and others added 19 commits March 18, 2026 21:09
- Upgrade Gateway API CRDs from v1.2.0 to v1.5.0 (experimental channel)
- Add gateway-api-crds as a component in all networking variants,
  with Cilium depending on it to ensure CRDs are available first
- Add gateway.gatewayAPI platform config (enables Cilium
  gatewayAPI.enabled=true), can be used alongside gateway.ingress
- Enable Gateway API support in cert-manager

Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: Kirill Ilin <stitch14@yandex.ru>
When gateway.gatewayAPI is true, pass gateway-httproute source to the
system external-dns package via components values override.

Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: Kirill Ilin <stitch14@yandex.ru>
…ayAPI

Previously enableGatewayAPI was hardcoded to true in cert-manager values,
causing startup failures in isp-hosted variant where Gateway API CRDs
are not installed. Now passed via component override only when
gateway.gatewayAPI is enabled.

Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: Kirill Ilin <stitch14@yandex.ru>
Add cozystack-gateway system package that creates a shared Gateway
resource with per-hostname HTTPS listeners and TLS passthrough
listeners for system services. Listeners are dynamically generated
from expose-services config.

Platform changes:
- Add gateway-api flag to _cluster config for component awareness
- Add gateway.name/namespace to platform values for parentRef config
- Add publishing.hostnames map for per-service hostname overrides
- Wire cozystack-gateway package into system bundle (conditional)

Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: Kirill Ilin <stitch14@yandex.ru>
Add Gateway API route templates alongside existing Ingress templates
for all system-level services. Routes are conditional on
_cluster.gateway-api being enabled.

HTTPRoute (TLS terminate via central Gateway):
- dashboard: routes to incloud-web-gatekeeper:8000
- keycloak: routes to keycloak-http:80

TLSRoute (TLS passthrough via central Gateway):
- cozystack-api: passthrough to kubernetes:443
- kubevirt vm-exportproxy: passthrough to vm-exportproxy:443
- kubevirt-cdi uploadproxy: passthrough to cdi-uploadproxy:443

All routes reference the central Gateway via parentRefs with
sectionName for listener matching. Hostname resolution follows
convention ({service}.{root-host}) with override support via
_cluster.hostnames map.

Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: Kirill Ilin <stitch14@yandex.ru>
Add gateway field to tenant namespace configuration, following the
same inheritance pattern as ingress:
- tenant-root defaults to gateway: tenant-root
- Sub-tenants with gateway: true get their own LB
- Sub-tenants without gateway inherit from parent

Add infrastructure.labels to central Gateway for shared LB with
tenant-root services (cozystack.io/gateway: tenant-root).

Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: Kirill Ilin <stitch14@yandex.ru>
Add per-component Gateway + HTTPRoute/TLSRoute for tenant-level
services. Each component creates its own Gateway with specific
hostname HTTPS listener and cert-manager annotation for automatic
certificate provisioning via HTTP01 or DNS01.

All Gateways within a tenant share a single LoadBalancer IP through
infrastructure.labels (cozystack.io/gateway: {tenant-name}), matching
the current ingress-nginx model of one LB per tenant.

HTTPRoute (per-component Gateway with TLS terminate):
- monitoring/grafana: routes to grafana-service:3000
- monitoring/alerta: routes to alerta:80
- bucket: routes to {bucketName}-ui:8080
- apps/harbor: routes to {release}:80
- extra/bootbox: routes to bootbox:8080

TLSRoute (per-component Gateway with TLS passthrough):
- extra/seaweedfs: passthrough to filer-external:18888

Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: Kirill Ilin <stitch14@yandex.ru>
- Add HTTP-to-HTTPS redirect HTTPRoute for all Gateways (central and
  per-tenant) to ensure plain HTTP requests are properly redirected
- Add oidc-enabled check to keycloak HTTPRoute condition to match
  the Gateway listener condition
- Use gateway-name from cluster config instead of hardcoded value
  in central Gateway template
- Remove redundant namespace from TLSRoute metadata where it matches
  the HelmRelease install namespace (kubevirt, kubevirt-cdi)

Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: Kirill Ilin <stitch14@yandex.ru>
Signed-off-by: Kirill Ilin <stitch14@yandex.ru>
v1alpha2 is deprecated in Gateway API v1.5.0 with a removal warning.
Update all TLSRoute resources to use gateway.networking.k8s.io/v1.

Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: Kirill Ilin <stitch14@yandex.ru>
Replace hardcoded `gatewayClassName: cilium` in all 7 Gateway
templates with a configurable value from _cluster.gateway-class-name.
Default remains "cilium" for backward compatibility.

This enables custom GatewayClass resources with different parameters
(e.g. NodePort via CiliumGatewayClassConfig) and maintains
vendor-neutrality for non-Cilium Gateway API controllers.

Assisted-By: Claude AI
Signed-off-by: Kirill Ilin <stitch14@yandex.ru>
Add cozy-lib.gateway.httpRoute and cozy-lib.gateway.tlsRoute helpers
that encapsulate the full Gateway + HTTPRoute/TLSRoute pattern with
HTTP-to-HTTPS redirect. This eliminates ~350 lines of duplicated
boilerplate across 6 tenant-level components.

Add cozy-lib as dependency to bucket, monitoring, harbor, bootbox,
seaweedfs, and cozystack-gateway charts. Update PackageSource
definitions for cozystack-gateway and bucket-system to include
cozy-lib library.

Add ns-gateway helper to _cozyconfig.tpl for consistency with
existing ns-ingress, ns-etcd, etc.

Assisted-By: Claude AI
Signed-off-by: Kirill Ilin <stitch14@yandex.ru>
When gateway.gatewayAPI is enabled in platform config:

- Set Cilium envoy.streamIdleTimeoutDurationSeconds to 86400 (24h)
  to support long-lived WebSocket (dashboard/noVNC) and large file
  uploads (bucket, harbor, seaweedfs). Cilium does not support
  per-route timeouts (GEP-1742), so a global override is needed.

- Enable gatewayAPI.enableAlpn for HTTP/2 and gRPC support through
  Gateway API listeners (required by seaweedfs filer gRPC backend).

- Disable Keycloak sticky session route attachment
  (KC_SPI_STICKY_SESSION_ENCODER_INFINISPAN_SHOULD_ATTACH_ROUTE=false)
  so Keycloak works without cookie-based session affinity. Infinispan
  distributed cache handles session replication across nodes. This
  removes the dependency on nginx cookie affinity annotations.

Assisted-By: Claude AI
Signed-off-by: Kirill Ilin <stitch14@yandex.ru>
Match the existing symlink convention used by other charts
(e.g. keycloak, tenant) where the cozy-lib symlink target
includes a trailing slash: ../../../library/cozy-lib/

Assisted-By: Claude AI
Signed-off-by: Kirill Ilin <stitch14@yandex.ru>
Revert cozy-lib refactoring to debug platform upgrade issue.
Gateway templates restored to inline form. cozy-lib dependency
removed from bucket, cozystack-gateway, monitoring, harbor,
bootbox, seaweedfs charts.

Assisted-By: Claude AI
Signed-off-by: Kirill Ilin <stitch14@yandex.ru>
…kage

cozystack.platform.package renders `components: {}` when given an
empty dict, which causes the operator post-render to fail with YAML
unmarshal errors. Use package.default (no components) when the dict
is empty, package (with components) only when non-empty.

Fixes cert-manager and external-dns conditional components blocks
that pass an empty dict when gateway.gatewayAPI is false.

Assisted-By: Claude AI
Signed-off-by: Kirill Ilin <stitch14@yandex.ru>
…ingress disabled

When ingress is disabled and Gateway API is used, create a
CiliumLoadBalancerIPPool from publishing.externalIPs so that Cilium
assigns those IPs to the Gateway's LoadBalancer Service.

Priority logic: ingress takes externalIPs when enabled; Gateway gets
them only when ingress is off.

Propagate gateway.ingress as ingress-enabled in _cluster values so the
gateway chart can make this decision.

Assisted-By: Claude AI
Signed-off-by: Kirill Ilin <stitch14@yandex.ru>
Cover central Gateway, system HTTPRoutes/TLSRoutes, HTTP-to-HTTPS
redirect, TLS passthrough to API server, per-tenant Grafana Gateway,
and ingress coexistence verification.

Assisted-By: Claude AI
Signed-off-by: Kirill Ilin <stitch14@yandex.ru>
Signed-off-by: Kirill Ilin <stitch14@yandex.ru>
@sircthulhu sircthulhu force-pushed the feat/gateway-api-httproutes branch from 17f38a2 to d0cc82b Compare March 18, 2026 16:09
@sircthulhu sircthulhu marked this pull request as ready for review March 18, 2026 16:10
@dosubot dosubot bot added size:XL This PR changes 500-999 lines, ignoring generated files. enhancement New feature or request labels Mar 18, 2026
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 8

🧹 Nitpick comments (1)
packages/system/cozystack-gateway/Chart.yaml (1)

1-3: Consider adding a description field.

While not required, adding a description field would improve discoverability and help users understand the chart's purpose.

📝 Suggested enhancement
 apiVersion: v2
 name: cozy-cozystack-gateway
+description: Central Gateway API Gateway for system-level HTTP and TLS routing
 version: 0.0.0 # Placeholder, the actual version will be automatically set during the build process
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/system/cozystack-gateway/Chart.yaml` around lines 1 - 3, Add a
human-readable description field to Chart.yaml to improve discoverability and
explain the chart's purpose; in the Chart.yaml near the existing
apiVersion/name/version entries, add a top-level description: "<brief one-line
summary of cozy-cozystack-gateway's purpose>" (use clear, concise wording) so
consumers see what cozy-cozystack-gateway does when viewing the chart metadata.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@hack/e2e-install-cozystack.bats`:
- Around line 259-267: The curl probes use the IP in the URL so TLS SNI is sent
as the IP (causing hostname-based routing/cert selection to fail); update the
curl invocations that use "https://${gateway_ip}" (the blocks that set http_code
and check Dashboard and Kubernetes API responses) to instead request the
hostname in the URL (e.g., https://dashboard.example.org and
https://api.example.org) and add curl's --resolve option to map each hostname to
${gateway_ip} so the hostname is preserved for SNI while resolving to the
gateway IP; modify both the Dashboard probe (where http_code is set for
dashboard.example.org) and the Kubernetes API probe (and the similar block
around the second occurrence noted) to use --resolve with the appropriate
hostname and ${gateway_ip}.

In `@packages/core/platform/templates/bundles/system.yaml`:
- Around line 173-186: Update the v1.0.0 migration/upgrade notes to document
that external-dns is now opt-in by requiring cozystack.external-dns to be added
to bundles.enabledPackages (which defaults to an empty list), and add a short
operator guidance block instructing anyone upgrading from v0.x to check if they
depend on external-dns and, if so, explicitly add "cozystack.external-dns" to
bundles.enabledPackages in their Platform values before upgrading.

In `@packages/extra/bootbox/templates/matchbox/httproute.yaml`:
- Around line 74-76: The HTTPRoute backendRefs currently references name:
bootbox with port: 8080 which does not match the Service bootbox exposed port
80; update the HTTPRoute backendRefs entry (backendRefs / name: bootbox / port)
in matchbox/httproute.yaml to use port: 80 so it matches the Service definition
in packages/extra/bootbox/templates/matchbox/service.yaml and ensures proper
route resolution.

In `@packages/extra/seaweedfs/templates/tlsroute.yaml`:
- Line 7: The top render condition currently requires (.Values.filer.grpcHost)
which prevents the template from rendering when grpcHost is empty but a fallback
host exists; update the initial if-condition (the line with and (eq $gatewayAPI
"true") (ne $gateway "") (not (eq .Values.topology "Client"))
(.Values.filer.grpcHost)) to instead allow either .Values.filer.grpcHost or the
fallback host (e.g., check for (.Values.filer.grpcHost) OR (. _namespace.host) /
the same host variable used in the fallback at the usages around the
filer.<host> logic on lines referencing the fallback) so the block renders when
a fallback host is available.
- Line 1: Normalize the gateway-api check by converting the value to a string
before comparing and ensure the grpcHost fallback is considered in the
conditional: change the template to set $gatewayAPI := printf "%v" (index
.Values._cluster "gateway-api" | default false) and then compute a $grpcHost
variable using default .Values.filer.grpcHost with the same fallback expression
used later in the template (the explicit fallback hostnames present where
grpcHost is used), and use $grpcHost in the if-condition that currently compares
$gatewayAPI to "true" so boolean/unquoted values and the fallback host are both
respected.

In `@packages/system/cozystack-gateway/templates/gateway.yaml`:
- Around line 111-113: The template loop that emits "cidr: {{ . }}/32" from "{{-
range splitList \",\" $exposeExternalIPs }}" can produce "cidr: /32" for empty
items; update the range to skip empty/whitespace entries by checking the trimmed
value before emitting. Specifically, inside the range over splitList ","
$exposeExternalIPs, wrap the cidr block in a conditional like "if (ne (trim .)
\"\")" (or equivalent trim+not-empty check) so only non-empty values produce
"cidr: {{ . }}/32".

In `@packages/system/gateway-api-crds/Makefile`:
- Line 9: The Makefile now kustomizes Gateway API CRDs to v1.5.0 (the kubectl
kustomize
"github.com/kubernetes-sigs/gateway-api/config/crd/experimental?ref=v1.5.0"
line) but v1.5.0 has breaking changes (TLSRoute and ListenerSet moved from
Experimental->Standard, new validating admission policy
safe-upgrades.gateway.networking.k8s.io, and TLSRoute CEL requiring Kubernetes
>=1.31); before changing the ref, either keep the existing v1.2.0 CRD ref or
update other CRD targets so Standard and Experimental CRDs are applied together,
scan the cluster for resources using TLSRoute v1alpha2 and migrate them to the
new v1 types (or plan removal), ensure target clusters run Kubernetes >=1.31 if
using TLSRoute CEL, and apply CRDs with kubectl apply --server-side=true to
avoid VAP conflicts; also remove or adjust generation of
templates/crds-experimental.yaml if you intend to fully migrate to the Standard
channel so you don't install mixed channels separately which will be blocked by
the new VAP.

In `@packages/system/keycloak/templates/httproute.yaml`:
- Around line 27-29: The HTTPRoute's backendRefs currently points to port 80
which does not exist on the keycloak-http Service (service.yaml exposes port
8080); update the HTTPRoute backendRefs entry for name: keycloak-http to use
port: 8080 (replace the existing port: 80) so the route matches the Service's
exposed port and routing will succeed.

---

Nitpick comments:
In `@packages/system/cozystack-gateway/Chart.yaml`:
- Around line 1-3: Add a human-readable description field to Chart.yaml to
improve discoverability and explain the chart's purpose; in the Chart.yaml near
the existing apiVersion/name/version entries, add a top-level description:
"<brief one-line summary of cozy-cozystack-gateway's purpose>" (use clear,
concise wording) so consumers see what cozy-cozystack-gateway does when viewing
the chart metadata.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: d3b12f3a-79b0-42fa-9d84-ffce62178120

📥 Commits

Reviewing files that changed from the base of the PR and between 7ab6283 and d0cc82b.

📒 Files selected for processing (30)
  • hack/e2e-install-cozystack.bats
  • packages/apps/harbor/templates/httproute.yaml
  • packages/apps/tenant/README.md
  • packages/apps/tenant/templates/namespace.yaml
  • packages/apps/tenant/values.schema.json
  • packages/apps/tenant/values.yaml
  • packages/core/platform/sources/cozystack-gateway.yaml
  • packages/core/platform/sources/networking.yaml
  • packages/core/platform/templates/apps.yaml
  • packages/core/platform/templates/bundles/system.yaml
  • packages/core/platform/values.yaml
  • packages/extra/bootbox/templates/matchbox/httproute.yaml
  • packages/extra/seaweedfs/templates/tlsroute.yaml
  • packages/system/bucket/templates/httproute.yaml
  • packages/system/cert-manager/values.yaml
  • packages/system/cozystack-api/templates/api-tlsroute.yaml
  • packages/system/cozystack-basics/templates/cozystack-values-secret.yaml
  • packages/system/cozystack-gateway/Chart.yaml
  • packages/system/cozystack-gateway/templates/gateway.yaml
  • packages/system/cozystack-gateway/values.yaml
  • packages/system/dashboard/templates/httproute.yaml
  • packages/system/gateway-api-crds/Makefile
  • packages/system/gateway-api-crds/templates/crds-experimental.yaml
  • packages/system/keycloak/templates/httproute.yaml
  • packages/system/keycloak/templates/sts.yaml
  • packages/system/kubevirt-cdi/templates/cdi-uploadproxy-tlsroute.yaml
  • packages/system/kubevirt/templates/vm-exportproxy-tlsroute.yaml
  • packages/system/monitoring/templates/alerta/httproute.yaml
  • packages/system/monitoring/templates/grafana/httproute.yaml
  • packages/system/tenant-rd/cozyrds/tenant.yaml

Comment on lines +259 to +267
http_code=$(curl -sS -k "https://${gateway_ip}" -H 'Host: dashboard.example.org' --max-time 30 -o /dev/null -w '%{http_code}')
if [ "$http_code" != "200" ] && [ "$http_code" != "302" ] && [ "$http_code" != "303" ]; then
echo "Failed to access Dashboard via Gateway, got HTTP ${http_code}" >&2
exit 1
fi

# Kubernetes API via TLS passthrough (401/403 expected without credentials)
http_code=$(curl -sS -k "https://${gateway_ip}" -H 'Host: api.example.org' --max-time 30 -o /dev/null -w '%{http_code}')
if [ "$http_code" != "401" ] && [ "$http_code" != "403" ]; then
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🌐 Web query:

Does curl set TLS SNI based on the URL hostname, and does -H 'Host: ...' change SNI?

💡 Result:

Yes, curl sets the TLS SNI based on the hostname from the URL. No, the -H 'Host: ...' header does not change the SNI; it only affects the HTTP Host header sent after the TLS handshake.

Citations:


Use SNI-correct HTTPS probes in Gateway tests.

The current pattern curl https://<ip> -H 'Host: ...' sends TLS SNI as the IP address, not the target hostname. Gateway API TLS listeners use SNI for hostname-based routing and certificate selection; mismatched SNI causes these checks to fail or produce false negatives even when routes are healthy.

Use --resolve to map the hostname to the IP while preserving the hostname in the URL, ensuring correct SNI:

🔧 Suggested fix
-  http_code=$(curl -sS -k "https://${gateway_ip}" -H 'Host: dashboard.example.org' --max-time 30 -o /dev/null -w '%{http_code}')
+  http_code=$(curl -sS -k --resolve "dashboard.example.org:443:${gateway_ip}" \
+    "https://dashboard.example.org" --max-time 30 -o /dev/null -w '%{http_code}')

-  http_code=$(curl -sS -k "https://${gateway_ip}" -H 'Host: api.example.org' --max-time 30 -o /dev/null -w '%{http_code}')
+  http_code=$(curl -sS -k --resolve "api.example.org:443:${gateway_ip}" \
+    "https://api.example.org" --max-time 30 -o /dev/null -w '%{http_code}')

-  if ! curl -sS -k "https://${grafana_gw_ip}" -H 'Host: grafana.example.org' --max-time 30 | grep -q Found; then
+  if ! curl -sS -k --resolve "grafana.example.org:443:${grafana_gw_ip}" \
+    "https://grafana.example.org" --max-time 30 | grep -q Found; then

-  if ! curl -sS -k "https://${ingress_ip}" -H 'Host: grafana.example.org' --max-time 30 | grep -q Found; then
+  if ! curl -sS -k --resolve "grafana.example.org:443:${ingress_ip}" \
+    "https://grafana.example.org" --max-time 30 | grep -q Found; then

Also applies to: 298-307

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@hack/e2e-install-cozystack.bats` around lines 259 - 267, The curl probes use
the IP in the URL so TLS SNI is sent as the IP (causing hostname-based
routing/cert selection to fail); update the curl invocations that use
"https://${gateway_ip}" (the blocks that set http_code and check Dashboard and
Kubernetes API responses) to instead request the hostname in the URL (e.g.,
https://dashboard.example.org and https://api.example.org) and add curl's
--resolve option to map each hostname to ${gateway_ip} so the hostname is
preserved for SNI while resolving to the gateway IP; modify both the Dashboard
probe (where http_code is set for dashboard.example.org) and the Kubernetes API
probe (and the similar block around the second occurrence noted) to use
--resolve with the appropriate hostname and ${gateway_ip}.

Comment on lines +173 to +186
{{- $externalDnsComponents := dict -}}
{{- if .Values.gateway.gatewayAPI -}}
{{- $externalDnsValues := dict "external-dns" (dict "sources" (list "service" "ingress" "gateway-httproute")) -}}
{{- $_ := set $externalDnsComponents "external-dns" (dict "values" $externalDnsValues) -}}
{{- end -}}
{{- $disabled := default (list) .Values.bundles.disabledPackages -}}
{{- $enabled := default (list) .Values.bundles.enabledPackages -}}
{{- if and (has "cozystack.external-dns" $enabled) (not (has "cozystack.external-dns" $disabled)) -}}
{{- if gt (len $externalDnsComponents) 0 }}
{{include "cozystack.platform.package" (list "cozystack.external-dns" "default" $ $externalDnsComponents) }}
{{- else }}
{{include "cozystack.platform.package.default" (list "cozystack.external-dns" $) }}
{{- end }}
{{- end }}
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Description: Check if external-dns enablement change is documented in release notes or migration docs

# Search for documentation about this change
rg -i "external-dns" -g "*.md" -g "CHANGELOG*" -g "RELEASE*" -C 3

Repository: cozystack/cozystack

Length of output: 50377


🏁 Script executed:

# Check the platform values.yaml file around lines 11-22
head -30 packages/core/platform/values.yaml | cat -n

Repository: cozystack/cozystack

Length of output: 1068


🏁 Script executed:

# Search for migration documentation at repo root
find . -maxdepth 2 -type f \( -name "*MIGRATION*" -o -name "*CHANGELOG*" -o -name "*RELEASE*" \) | head -20

Repository: cozystack/cozystack

Length of output: 45


🏁 Script executed:

# Check if there's any documentation about the bundles.enabledPackages change
rg "enabledPackages" -A 2 -B 2 --max-count 20

Repository: cozystack/cozystack

Length of output: 3756


🏁 Script executed:

# Search for CHANGELOG, MIGRATION, or release documentation at root level
find . -maxdepth 1 -type f \( -iname "*changelog*" -o -iname "*migration*" -o -iname "*release*" -o -iname "*NEWS*" \)

Repository: cozystack/cozystack

Length of output: 45


🏁 Script executed:

# Check the migration script to understand the enabledPackages context
cat hack/migrate-to-version-1.0.sh | head -100

Repository: cozystack/cozystack

Length of output: 4438


🏁 Script executed:

# Look for any documentation about bundles and enabledPackages in the templates
rg "Optional System Packages|enabledPackages" packages/core/platform/templates/bundles/system.yaml -B 5 -A 5

Repository: cozystack/cozystack

Length of output: 2147


🏁 Script executed:

# Check if there's a README in packages/core/platform explaining the bundles
head -100 packages/core/platform/README.md 2>/dev/null || echo "No README found"

Repository: cozystack/cozystack

Length of output: 78


🏁 Script executed:

# Search for migration documentation in the repository
find . -type f \( -name "*MIGRATION*" -o -name "*UPGRADE*" -o -name "*v1.0*" -o -name "*release*" \) | grep -iE "(md|txt|rst)" | head -20

Repository: cozystack/cozystack

Length of output: 526


🏁 Script executed:

# Check if there's documentation about the v1.0 migration or upgrade path
rg -i "migration|upgrade|breaking" --type md | head -30

Repository: cozystack/cozystack

Length of output: 5099


🏁 Script executed:

# Look for any documentation that mentions external-dns being optional or breaking change
rg "external-dns" --type md -B 3 -A 3 | head -50

Repository: cozystack/cozystack

Length of output: 5408


🏁 Script executed:

# Check what the template_helpers says about optional packages
rg "cozystack.platform.package.optional" packages/core/platform/templates/_helpers.tpl -B 5 -A 10

Repository: cozystack/cozystack

Length of output: 1333


🏁 Script executed:

# Check the v1.0.0 changelog to see if external-dns being optional is documented
cat docs/changelogs/v1.0.0.md | head -200

Repository: cozystack/cozystack

Length of output: 29028


🏁 Script executed:

# Search for external-dns in all changelog files
rg "external-dns" docs/changelogs/ -B 2 -A 2

Repository: cozystack/cozystack

Length of output: 45


🏁 Script executed:

# Check if there's a breaking changes section in the current or recent changelogs
rg -i "breaking|breaking change" docs/changelogs/ -B 2 -A 2

Repository: cozystack/cozystack

Length of output: 16771


Document external-dns enablement requirement in migration guide.

External-dns is now optional and only deployed when explicitly added to bundles.enabledPackages. Since enabledPackages defaults to an empty list (per packages/core/platform/values.yaml:22), existing deployments upgrading from v0.x will lose external-dns unless they explicitly enable it. This behavioral change is not documented in the v1.0.0 "Breaking Changes & Upgrade Notes" section despite being a breaking change for existing clusters.

Add guidance to the migration notes instructing operators upgrading from v0.x to check if external-dns is needed and explicitly add cozystack.external-dns to bundles.enabledPackages in their Platform values if they rely on it.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/core/platform/templates/bundles/system.yaml` around lines 173 - 186,
Update the v1.0.0 migration/upgrade notes to document that external-dns is now
opt-in by requiring cozystack.external-dns to be added to
bundles.enabledPackages (which defaults to an empty list), and add a short
operator guidance block instructing anyone upgrading from v0.x to check if they
depend on external-dns and, if so, explicitly add "cozystack.external-dns" to
bundles.enabledPackages in their Platform values before upgrading.

Comment on lines +74 to +76
backendRefs:
- name: bootbox
port: 8080
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

Fix backendRef port to match the Service’s exposed port.

Line 76 uses port: 8080, but packages/extra/bootbox/templates/matchbox/service.yaml exposes Service bootbox on port: 80 (Line 10). HTTPRoute.backendRefs.port must match the Service port, so this can cause route resolution/routing failure.

🔧 Proposed fix
   - name: bootbox
-    port: 8080
+    port: 80
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
backendRefs:
- name: bootbox
port: 8080
backendRefs:
- name: bootbox
port: 80
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/extra/bootbox/templates/matchbox/httproute.yaml` around lines 74 -
76, The HTTPRoute backendRefs currently references name: bootbox with port: 8080
which does not match the Service bootbox exposed port 80; update the HTTPRoute
backendRefs entry (backendRefs / name: bootbox / port) in
matchbox/httproute.yaml to use port: 80 so it matches the Service definition in
packages/extra/bootbox/templates/matchbox/service.yaml and ensures proper route
resolution.

@@ -0,0 +1,43 @@
{{- $gatewayAPI := (index .Values._cluster "gateway-api") | default "false" }}
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== Find gateway-api definitions and example values =="
rg -n -C2 'gateway-api' -g '*.yaml' -g '*.yml' -g '*.json'

echo
echo "== Find how _cluster.gateway-api is consumed in templates =="
rg -n -C2 '_cluster|gateway-api|eq \$gatewayAPI "true"' -g '*.yaml' -g '*.tpl'

Repository: cozystack/cozystack

Length of output: 50376


🏁 Script executed:

cat -n packages/extra/seaweedfs/templates/tlsroute.yaml

Repository: cozystack/cozystack

Length of output: 1582


🏁 Script executed:

# Find values files where gateway-api is configured
find . -name "values*.yaml" -o -name "values*.yml" | head -30 | xargs grep -l "gateway-api" 2>/dev/null | head -10

# Then examine how the value is set (boolean vs string)
echo "=== Checking how gateway-api is provided in values ==="
find . -name "values*.yaml" -o -name "values*.yml" | xargs grep -A2 -B2 "gateway-api:" 2>/dev/null | head -50

Repository: cozystack/cozystack

Length of output: 117


🏁 Script executed:

# Search for where gateway.gatewayAPI is defined
echo "=== Looking for gateway.gatewayAPI definition ==="
rg -n "gateway\.gatewayAPI|gatewayAPI:" -A2 -B2 | head -60

# Also search for how _cluster values are passed/injected
echo ""
echo "=== Looking for _cluster value injection ==="
rg -n "\"_cluster\"|_cluster:" -l | head -10

# Check the platform values to understand gateway configuration
echo ""
echo "=== Platform gateway configuration ==="
find . -path "*/platform/*" -name "values*.yaml" | xargs cat 2>/dev/null | grep -A 10 "gateway:" | head -30

Repository: cozystack/cozystack

Length of output: 5718


🏁 Script executed:

# Check if other templates have similar grpcHost gates
echo "=== Checking for grpcHost usage in other templates ==="
rg -n "grpcHost" -B2 -A2

# Also check other TLSRoute files to compare their gate conditions
echo ""
echo "=== Comparing gate conditions in similar TLSRoute templates ==="
fd "tlsroute.yaml|httproute.yaml" -x head -10 {} +

Repository: cozystack/cozystack

Length of output: 51185


🏁 Script executed:

# Check if seaweedfs ingress.yaml has the same grpcHost gate
echo "=== Checking seaweedfs ingress.yaml for grpcHost gate ==="
sed -n '1,20p' packages/extra/seaweedfs/templates/ingress.yaml

echo ""
echo "=== Checking if other packages with external endpoints use similar gates ==="
rg "grpcHost" packages/extra/seaweedfs/templates/

Repository: cozystack/cozystack

Length of output: 1998


Normalize gateway-api type before comparison and make the grpcHost fallback actually reachable.

Line 7 compares $gatewayAPI to the string "true". If _cluster.gateway-api is ever passed as a boolean (not quoted), this comparison silently fails and resources don't render. Additionally, the same line requires (.Values.filer.grpcHost) to be truthy, but lines 22 and 38 provide a fallback hostname—making the gate inconsistent with the template's intent.

🔧 Proposed fix
-{{- $gatewayAPI := (index .Values._cluster "gateway-api") | default "false" }}
+{{- $gatewayAPI := (index .Values._cluster "gateway-api") | default false | toString | lower }}
 {{- $gateway := .Values._namespace.gateway | default "" }}
 {{- $host := .Values._namespace.host }}
 
 {{- $gatewayClassName := (index .Values._cluster "gateway-class-name") | default "cilium" }}
 
-{{- if and (eq $gatewayAPI "true") (ne $gateway "") (not (eq .Values.topology "Client")) (.Values.filer.grpcHost) }}
+{{- if and (eq $gatewayAPI "true") (ne $gateway "") (not (eq .Values.topology "Client")) (or .Values.filer.grpcHost $host) }}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
{{- $gatewayAPI := (index .Values._cluster "gateway-api") | default "false" }}
{{- $gatewayAPI := (index .Values._cluster "gateway-api") | default false | toString | lower }}
🧰 Tools
🪛 YAMLlint (1.38.0)

[error] 1-1: syntax error: expected the node content, but found '-'

(syntax)

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/extra/seaweedfs/templates/tlsroute.yaml` at line 1, Normalize the
gateway-api check by converting the value to a string before comparing and
ensure the grpcHost fallback is considered in the conditional: change the
template to set $gatewayAPI := printf "%v" (index .Values._cluster "gateway-api"
| default false) and then compute a $grpcHost variable using default
.Values.filer.grpcHost with the same fallback expression used later in the
template (the explicit fallback hostnames present where grpcHost is used), and
use $grpcHost in the if-condition that currently compares $gatewayAPI to "true"
so boolean/unquoted values and the fallback host are both respected.


{{- $gatewayClassName := (index .Values._cluster "gateway-class-name") | default "cilium" }}

{{- if and (eq $gatewayAPI "true") (ne $gateway "") (not (eq .Values.topology "Client")) (.Values.filer.grpcHost) }}
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Render gate blocks the documented/default hostname path.

Line 7 requires .Values.filer.grpcHost, but Lines 22 and 38 already support fallback to filer.<host>. With grpcHost empty and _namespace.host set, this template won’t render at all.

🔧 Proposed fix
 {{- $gatewayClassName := (index .Values._cluster "gateway-class-name") | default "cilium" }}
+{{- $filerHost := .Values.filer.grpcHost | default (printf "filer.%s" $host) }}

-{{- if and (eq $gatewayAPI "true") (ne $gateway "") (not (eq .Values.topology "Client")) (.Values.filer.grpcHost) }}
+{{- if and (eq $gatewayAPI "true") (ne $gateway "") (not (eq .Values.topology "Client")) (or .Values.filer.grpcHost $host) }}
@@
-    hostname: {{ .Values.filer.grpcHost | default (printf "filer.%s" $host) | quote }}
+    hostname: {{ $filerHost | quote }}
@@
-  - {{ .Values.filer.grpcHost | default (printf "filer.%s" $host) | quote }}
+  - {{ $filerHost | quote }}

Also applies to: 22-22, 38-38

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/extra/seaweedfs/templates/tlsroute.yaml` at line 7, The top render
condition currently requires (.Values.filer.grpcHost) which prevents the
template from rendering when grpcHost is empty but a fallback host exists;
update the initial if-condition (the line with and (eq $gatewayAPI "true") (ne
$gateway "") (not (eq .Values.topology "Client")) (.Values.filer.grpcHost)) to
instead allow either .Values.filer.grpcHost or the fallback host (e.g., check
for (.Values.filer.grpcHost) OR (. _namespace.host) / the same host variable
used in the fallback at the usages around the filer.<host> logic on lines
referencing the fallback) so the block renders when a fallback host is
available.

Comment on lines +111 to +113
{{- range splitList "," $exposeExternalIPs }}
- cidr: {{ . }}/32
{{- end }}
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Guard against empty IP entries when generating CIDRs.

If expose-external-ips has a trailing comma, this renders an invalid block (cidr: /32). Please skip empty items before emitting blocks.

🔧 Proposed fix
-  {{- range splitList "," $exposeExternalIPs }}
-  - cidr: {{ . }}/32
-  {{- end }}
+  {{- range $ip := splitList "," $exposeExternalIPs }}
+  {{- if $ip }}
+  - cidr: {{ $ip }}/32
+  {{- end }}
+  {{- end }}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
{{- range splitList "," $exposeExternalIPs }}
- cidr: {{ . }}/32
{{- end }}
{{- range $ip := splitList "," $exposeExternalIPs }}
{{- if $ip }}
- cidr: {{ $ip }}/32
{{- end }}
{{- end }}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/system/cozystack-gateway/templates/gateway.yaml` around lines 111 -
113, The template loop that emits "cidr: {{ . }}/32" from "{{- range splitList
\",\" $exposeExternalIPs }}" can produce "cidr: /32" for empty items; update the
range to skip empty/whitespace entries by checking the trimmed value before
emitting. Specifically, inside the range over splitList "," $exposeExternalIPs,
wrap the cidr block in a conditional like "if (ne (trim .) \"\")" (or equivalent
trim+not-empty check) so only non-empty values produce "cidr: {{ . }}/32".

rm -rf templates
mkdir templates
kubectl kustomize "github.com/kubernetes-sigs/gateway-api/config/crd/experimental?ref=v1.2.0" > templates/crds-experimental.yaml
kubectl kustomize "github.com/kubernetes-sigs/gateway-api/config/crd/experimental?ref=v1.5.0" > templates/crds-experimental.yaml
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🌐 Web query:

What is the latest version of Kubernetes Gateway API and when was v1.5.0 released?

💡 Result:

The latest version of Kubernetes Gateway API is v1.5.1, released on March 14, 2026. The v1.5.0 version was released on February 26, 2026.

Citations:


🌐 Web query:

Kubernetes Gateway API v1.5.0 release notes breaking changes changelog

💡 Result:

Kubernetes Gateway API v1.5.0 was released around February 26-27, 2026. Official release notes are available at https://github.com/kubernetes-sigs/gateway-api/releases/tag/v1.5.0. ## Breaking Changes 1. TLSRoute v1alpha2 and XListenerSet removal from Experimental channel: TLSRoute and ListenerSet have graduated to the Standard channel as v1. TLSRoute v1alpha2 is only in Experimental channel in v1.5.0 and will be removed in v1.6. Additionally, TLSRoute's CEL validation requires Kubernetes 1.31+. 2. New Validating Admission Policy (VAP): Introduces safe-upgrades.gateway.networking.k8s.io VAP to prevent: - Downgrading to versions prior to 1.5 after installing v1.5. - Installing Experimental CRDs after Standard CRDs. Workaround: Delete the VAP if needed for specific operations. ## Major Changes Since v1.4.1 (Standard Channel Graduations) - TLSRoute v1 (GEP-2643) - HTTPRoute CORS filter (GEP-1767) - ListenerSet support (GEP-1713) - Certificate selection for Gateway TLS origination (GEP-3155) - ReferenceGrant to v1 ## Experimental - Gateway/HTTPRoute level authentication (GEP-1494) Full changelog: kubernetes-sigs/gateway-api@v1.4.1...v1.5.0 Note: Use server-side apply for installation due to large CRD sizes: kubectl apply --server-side=true -f https://github.com/kubernetes-sigs/gateway-api/releases/download/v1.5.0/[standard|experimental]-install.yaml. A patch release v1.5.1 followed with minor fixes.

Citations:


Address breaking changes in Gateway API v1.5.0 before upgrading.

This updates Gateway API CRDs from v1.2.0 to v1.5.0 (released Feb 26, 2026). While the version is valid, this release includes breaking changes that require attention:

  • TLSRoute and ListenerSet: Both graduated from Experimental to Standard channel as v1. TLSRoute v1alpha2 is deprecated and will be removed in v1.6.
  • New Validating Admission Policy: A VAP (safe-upgrades.gateway.networking.k8s.io) now prevents downgrading to pre-1.5 versions and mixing Experimental/Standard CRDs installed separately.
  • Kubernetes 1.31+ requirement: TLSRoute CEL validation requires Kubernetes 1.31 or later.

Consider whether existing resources depend on the experimental v1alpha2 types and verify cluster compatibility before applying. Use kubectl apply --server-side=true due to large CRD sizes.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/system/gateway-api-crds/Makefile` at line 9, The Makefile now
kustomizes Gateway API CRDs to v1.5.0 (the kubectl kustomize
"github.com/kubernetes-sigs/gateway-api/config/crd/experimental?ref=v1.5.0"
line) but v1.5.0 has breaking changes (TLSRoute and ListenerSet moved from
Experimental->Standard, new validating admission policy
safe-upgrades.gateway.networking.k8s.io, and TLSRoute CEL requiring Kubernetes
>=1.31); before changing the ref, either keep the existing v1.2.0 CRD ref or
update other CRD targets so Standard and Experimental CRDs are applied together,
scan the cluster for resources using TLSRoute v1alpha2 and migrate them to the
new v1 types (or plan removal), ensure target clusters run Kubernetes >=1.31 if
using TLSRoute CEL, and apply CRDs with kubectl apply --server-side=true to
avoid VAP conflicts; also remove or adjust generation of
templates/crds-experimental.yaml if you intend to fully migrate to the Standard
channel so you don't install mixed channels separately which will be blocked by
the new VAP.

Comment on lines +27 to +29
backendRefs:
- name: keycloak-http
port: 80
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

Critical: Port mismatch will cause routing failure.

The HTTPRoute references port 80, but per packages/system/keycloak/templates/service.yaml, the keycloak-http Service exposes port 8080:

# From service.yaml
ports:
  - name: http
    port: 8080

Traffic to this HTTPRoute will fail because port 80 doesn't exist on the backend Service.

🐛 Proposed fix
     backendRefs:
     - name: keycloak-http
-      port: 80
+      port: 8080
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/system/keycloak/templates/httproute.yaml` around lines 27 - 29, The
HTTPRoute's backendRefs currently points to port 80 which does not exist on the
keycloak-http Service (service.yaml exposes port 8080); update the HTTPRoute
backendRefs entry for name: keycloak-http to use port: 8080 (replace the
existing port: 80) so the route matches the Service's exposed port and routing
will succeed.

@sircthulhu sircthulhu marked this pull request as draft March 20, 2026 04:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request size:XL This PR changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant