Skip to content

Commit c6ddefb

Browse files
committed
fix(gateway-api): address round 2 review — comments and fail on misconfiguration
Add architecture documentation comment to extra/gateway explaining the two-Gateway model on port 80, mergeGateways reliance, and why one rejected parentRef per ACME challenge is expected. Add comment to cert-manager-issuers explaining dual parentRef strategy. Replace silent ingress fallback with fail() when both ingress and gatewayAPI are disabled — catches misconfiguration at template time. Assisted-By: Claude AI Signed-off-by: Kirill Ilin <stitch14@yandex.ru>
1 parent 87bc216 commit c6ddefb

2 files changed

Lines changed: 28 additions & 3 deletions

File tree

packages/extra/gateway/templates/gateway.yaml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,29 @@ spec:
3939
name: gateway-proxy
4040
namespace: {{ .Release.Namespace }}
4141
---
42+
{{/*
43+
HTTP port 80 architecture — two Gateways with mergeGateways:
44+
45+
1. acme-challenge (from: Selector, cozystack.io/system label)
46+
Accepts ACME HTTP-01 challenge HTTPRoutes from system namespaces
47+
(cozy-dashboard, cozy-keycloak, etc.) and per-hostname redirect
48+
HTTPRoutes created by system service charts.
49+
50+
2. http-redirect (from: Same)
51+
Accepts the catch-all redirect-to-https HTTPRoute and ACME
52+
challenges from this tenant namespace (e.g., bucket certificates).
53+
54+
Both Gateways declare port 80 HTTP with no hostname filter. This
55+
relies on Envoy Gateway's mergeGateways to combine them into one
56+
Envoy listener. Standard Gateway API conformance tests may flag this
57+
as a conflict — if a future Envoy Gateway release tightens spec
58+
compliance, consolidation into a single Gateway will be needed
59+
(requires OR logic in label selectors or operator-managed labels).
60+
61+
cert-manager solver references both Gateways as parentRefs. Each
62+
challenge HTTPRoute will have one accepted and one rejected parent —
63+
this is expected and cert-manager handles partial acceptance correctly.
64+
*/}}
4265
apiVersion: gateway.networking.k8s.io/v1
4366
kind: Gateway
4467
metadata:

packages/system/cert-manager-issuers/templates/cluster-issuers.yaml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ solvers:
2121
ingress:
2222
class: nginx
2323
{{- end }}
24+
{{/* Dual parentRef: acme-challenge accepts system namespaces (Selector),
25+
http-redirect accepts the gateway's own namespace (Same). Each challenge
26+
HTTPRoute will have one accepted and one rejected parent — this is
27+
expected, cert-manager handles partial acceptance correctly. */}}
2428
{{- if and (eq $gatewayAPI "true") (ne $gateway "") }}
2529
- http01:
2630
gatewayHTTPRoute:
@@ -33,9 +37,7 @@ solvers:
3337
kind: Gateway
3438
{{- end }}
3539
{{- if and (ne $ingressEnabled "true") (or (ne $gatewayAPI "true") (eq $gateway "")) }}
36-
- http01:
37-
ingress:
38-
class: nginx
40+
{{- fail "At least one of gateway.ingress or gateway.gatewayAPI must be enabled for ACME HTTP-01 solver" }}
3941
{{- end }}
4042
{{- end }}
4143
{{- end -}}

0 commit comments

Comments
 (0)