feat(gateway-api): ADR-060 Fase 1.1 — chart a HTTPRoute (Traefik + Gateway API)
All checks were successful
__APP_NAME__ — build & deploy / ¿Credenciales de build listas? (push) Successful in 1s
__APP_NAME__ — build & deploy / Calidad + build + push (push) Has been skipped
__APP_NAME__ — build & deploy / ¿Cluster del tenant listo? (push) Has been skipped
__APP_NAME__ — build & deploy / Helm upgrade --install (push) Has been skipped

Sincronizado desde repo IDP templates/ (CHART-SYNC-IDP-GITEA-DRIFT). Reemplaza el
Ingress (rke2-ingress-nginx, EOL marzo 2026) por HTTPRoute (Gateway API) adjunto al
Gateway tenant-gateway que crea stack-deployer (§3c). NetworkPolicy egress kube-system
-> traefik-system. FQDN DOT (ADR-082) preservado.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
ilopez
2026-06-11 21:58:56 -05:00
parent 5eead4f23f
commit 632ad1d507
5 changed files with 69 additions and 55 deletions

View File

@@ -1,6 +1,14 @@
apiVersion: v2 apiVersion: v2
name: __APP_NAME__ name: __APP_NAME__
# Helm chart del Golden Path web-backend/python. # Helm chart del Golden Path web-backend/python.
# 0.4.0 (2026-06-13): ADR-060 Fase 1 — migración del shape `Ingress`
# (networking.k8s.io/v1, ingressClassName=nginx) a `HTTPRoute`
# (gateway.networking.k8s.io/v1) adjunto al Gateway `tenant-gateway` (ns apps,
# creado por stack-deployer §3c). El cluster tenant pasa de rke2-ingress-nginx
# (EOL marzo 2026) a Traefik Proxy + Gateway API. TLS / force-ssl-redirect /
# body-size salen del recurso de ruta (los maneja el Gateway listener / Traefik
# global). values: bloque `ingress` → `httpRoute`; networkPolicy
# ingressControllerNamespace kube-system → traefik-system. GATEWAY-API-MIGRATION.
# 0.3.0 (2026-05-25): ADR-066 — AddonClaim sale del chart y vive en # 0.3.0 (2026-05-25): ADR-066 — AddonClaim sale del chart y vive en
# manifests/addonclaim.yaml. El workflow del tenant lo aplica con # manifests/addonclaim.yaml. El workflow del tenant lo aplica con
# kubectl apply ANTES de helm upgrade --install. Razon: en chart 0.2.x el # kubectl apply ANTES de helm upgrade --install. Razon: en chart 0.2.x el
@@ -16,7 +24,7 @@ name: __APP_NAME__
# adicional. tlsSecretName por default = apps-wildcard-tls (Gap 3). # adicional. tlsSecretName por default = apps-wildcard-tls (Gap 3).
description: Helm chart del Golden Path web-backend/python description: Helm chart del Golden Path web-backend/python
type: application type: application
version: 0.3.0 version: 0.4.0
appVersion: "0.1.0" appVersion: "0.1.0"
keywords: keywords:
- fastapi - fastapi

View File

@@ -0,0 +1,37 @@
{{- if .Values.httpRoute.enabled }}
# HTTPRoute (gateway.networking.k8s.io/v1) — ADR-060 Fase 1.
# El cluster tenant usa Traefik Proxy + Gateway API (reemplaza rke2-ingress-nginx,
# EOL marzo 2026, sin parches de seguridad). El recurso `Gateway` `tenant-gateway`
# (ns apps) lo crea stack-deployer por tenant (ADR-060 D7 / §3c de su spec); este
# HTTPRoute se le adjunta vía parentRefs.
#
# Lo que NO vive aquí (separación de capas — ADR-060 D6):
# - TLS: lo termina el listener HTTPS del Gateway, que referencia el Secret
# `tenant-wildcard-tls` (cert-manager local del cluster, ADR-060 Fase 2). El
# HTTPRoute solo declara el hostname.
# - force-ssl-redirect (HTTP->HTTPS): config global de Traefik Proxy
# (ports.web.redirectTo.websecure) en el bundle traefik-bootstrap.
# - proxy-body-size: config global de Traefik (transport); Middleware per-route
# solo si se necesita granularidad futura.
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
name: {{ .Release.Name }}
labels:
{{- include "app.labels" . | nindent 4 }}
spec:
parentRefs:
- name: {{ .Values.httpRoute.gatewayName | default "tenant-gateway" }}
namespace: {{ .Release.Namespace }}
sectionName: https
hostnames:
- {{ .Values.httpRoute.host | quote }}
rules:
- matches:
- path:
type: PathPrefix
value: /
backendRefs:
- name: {{ .Release.Name }}
port: {{ .Values.service.port }}
{{- end }}

View File

@@ -1,35 +0,0 @@
{{- if .Values.ingress.enabled }}
# Ingress estándar networking.k8s.io/v1 con ingressClassName=nginx.
# Razón: el cluster tenant nace con rke2-ingress-nginx por default —
# instalar Traefik añade footprint e inconsistencia respecto al control
# plane (donde Traefik sí está). NGINX Ingress es más portable y permite
# que el tenant siga su exit plan sin lock-in.
# Decisión: APERTURA COVE Sesión 3 (2026-05-19) — ADR-053 §11.
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: {{ .Release.Name }}
labels:
{{- include "app.labels" . | nindent 4 }}
annotations:
nginx.ingress.kubernetes.io/force-ssl-redirect: "true"
nginx.ingress.kubernetes.io/ssl-redirect: "true"
nginx.ingress.kubernetes.io/proxy-body-size: {{ .Values.ingress.proxyBodySize | default "10m" | quote }}
spec:
ingressClassName: {{ .Values.ingress.className | default "nginx" }}
tls:
- hosts:
- {{ .Values.ingress.host | quote }}
secretName: {{ .Values.ingress.tlsSecretName | default "apps-wildcard-tls" }}
rules:
- host: {{ .Values.ingress.host | quote }}
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: {{ .Release.Name }}
port:
number: {{ .Values.service.port }}
{{- end }}

View File

@@ -1,8 +1,9 @@
{{- if .Values.networkPolicy.enabled }} {{- if .Values.networkPolicy.enabled }}
# NetworkPolicy mínima del shape: bajo deny-all-default del namespace, permite: # NetworkPolicy mínima del shape: bajo deny-all-default del namespace, permite:
# - Ingress: rke2-ingress-nginx (web-backend público) + Prometheus (scrape de /metrics). # - Ingress: Traefik Proxy (web-backend público) + Prometheus (scrape de /metrics).
# - Egress: DNS, Harbor (pull en startup), ns-addons del tenant (BD). # - Egress: DNS, Harbor (pull en startup), ns-addons del tenant (BD).
# Nota: el cluster tenant usa rke2-ingress-nginx en kube-system, NO Traefik. # Nota: el cluster tenant usa Traefik Proxy + Gateway API en ns traefik-system
# (ADR-060 Fase 1; reemplaza rke2-ingress-nginx que corría en kube-system).
# Materializada como Helm hook (pre-install/pre-upgrade, weight "-8") para que # Materializada como Helm hook (pre-install/pre-upgrade, weight "-8") para que
# este disponible ANTES de que el Job Alembic (hook weight 0) ejecute su # este disponible ANTES de que el Job Alembic (hook weight 0) ejecute su
# InitContainer wait-for-secret — el InitContainer hace REST API call al # InitContainer wait-for-secret — el InitContainer hace REST API call al
@@ -37,12 +38,12 @@ spec:
policyTypes: [Ingress, Egress] policyTypes: [Ingress, Egress]
ingress: ingress:
# Tráfico HTTP desde rke2-ingress-nginx (Ingress estándar). # Tráfico HTTP desde Traefik Proxy (Gateway API, ADR-060 Fase 1).
# El controller corre en kube-system por default en RKE2. # El controller corre en ns traefik-system (lo instala el bundle traefik-bootstrap).
- from: - from:
- namespaceSelector: - namespaceSelector:
matchLabels: matchLabels:
kubernetes.io/metadata.name: {{ .Values.networkPolicy.ingressControllerNamespace | default "kube-system" }} kubernetes.io/metadata.name: {{ .Values.networkPolicy.ingressControllerNamespace | default "traefik-system" }}
ports: ports:
- protocol: TCP - protocol: TCP
port: 8000 port: 8000

View File

@@ -65,20 +65,22 @@ service:
type: ClusterIP type: ClusterIP
port: 8000 port: 8000
ingress: httpRoute:
# HTTPRoute (Gateway API) — el cluster tenant usa Traefik Proxy + Gateway API
# (ADR-060 Fase 1). El tráfico entra por Traefik vía el Gateway `tenant-gateway`
# del ns apps, creado por stack-deployer por tenant (§3c).
enabled: true enabled: true
# className por defecto = nginx (rke2-ingress-nginx pre-instalado en cluster tenant). # Nombre del Gateway al que se adjunta el HTTPRoute (parentRefs). Default fijo
# Cambiar solo si el tenant trae su propio IngressClass. # del IDP; no se cambia salvo que el tenant traiga su propio Gateway.
className: nginx gatewayName: tenant-gateway
# FQDN en formato subdominio (ADR-067): <app>.<tenant-uuid>.apps.coralware.cloud # FQDN canónico (ADR-067 / ADR-082): <app>.<tenant-uuid>.apps.coralware.cloud
# Cubierto por el wildcard A record *.{tenant-uuid}.apps.coralware.cloud (un solo record) # Cubierto por el wildcard *.{tenant-uuid}.apps.coralware.cloud y el cert
# y el Certificate CR tenant-wildcard-tls emitido por cert-manager local del cluster. # tenant-wildcard-tls que TERMINA el listener HTTPS del Gateway (no este route).
host: __APP_NAME__.__TENANT_ID__.apps.coralware.cloud host: __APP_NAME__.__TENANT_ID__.apps.coralware.cloud
# Secret TLS generado por cert-manager local del cluster tenant (ADR-060 Fase 2). # NOTA: el TLS (Secret tenant-wildcard-tls), el HTTP->HTTPS redirect y el
# cert-manager emite *.{tenant-uuid}.apps.coralware.cloud vía DNS-01 Cloudflare. # body-size ya NO viven en este recurso (ADR-060 D6): el cert lo termina el
tlsSecretName: tenant-wildcard-tls # listener del Gateway; el redirect y el body-size son config global de
# Body size para subidas/uploads de la app — ajustar según necesidad. # Traefik Proxy (bundle traefik-bootstrap).
proxyBodySize: 10m
alembic: alembic:
enabled: true enabled: true
@@ -96,5 +98,6 @@ networkPolicy:
enabled: true enabled: true
addonsNamespace: addons # ADR-054: namespace funcional fijo en cluster tenant addonsNamespace: addons # ADR-054: namespace funcional fijo en cluster tenant
# Namespace donde corre el ingress controller del cluster tenant. # Namespace donde corre el ingress controller del cluster tenant.
# RKE2 instala rke2-ingress-nginx en kube-system por default. # ADR-060 Fase 1: el ingress es Traefik Proxy en ns traefik-system
ingressControllerNamespace: kube-system # (bundle traefik-bootstrap), reemplaza rke2-ingress-nginx (kube-system).
ingressControllerNamespace: traefik-system