Skip to content

Commit 80fbfa1

Browse files
authored
fix(networking): point host ouroboros proxy at the root-tenant ingress (#2800)
## What this PR does With `publishing.proxyProtocol: true`, the host emits a `cozystack.ouroboros` Package using the no-override Package macro, so the proxy inherits the wrapper chart default backend `ingress-nginx-controller.cozy-ingress-nginx`. That layout describes a managed Kubernetes tenant cluster, not the host: on the host, `extra/ingress` deploys ingress-nginx into the root tenant namespace as `root-ingress-controller` in `tenant-root`. The composed backend FQDN never resolves, so `ouroboros-proxy` never reaches Ready. This emits the host ouroboros Package with a `proxy.target` override derived from `publishing.ingressName` — namespace plus `<short>-ingress-controller` service name — mirroring the `trimPrefix "tenant-"` transform `extra/ingress` applies to its release namespace. The derivation reuses the existing platform invariant that `publishing.ingressName` is the namespace where the host ingress controller runs. Adds bundle helm-unittest coverage for the default ingress name and a non-default one, and corrects the misleading wrapper `values.yaml` comment that claimed the host uses `cozy-ingress-nginx`. Scope: this fixes the ouroboros readiness defect only. The separate defect where the injected nginx PROXY-protocol config keys are not consumed by the host ingress is tracked independently and not touched here. Closes #2797 ### Release note ```release-note fix(networking): point the host ouroboros PROXY-protocol proxy at the root-tenant ingress so it becomes Ready when publishing.proxyProtocol is enabled ``` <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Enhanced proxy protocol configuration to automatically route through the appropriate ingress-nginx service based on your ingress name settings. * **Tests** * Added test coverage for proxy protocol bundle wiring and ingress service routing. * **Documentation** * Clarified proxy target configuration behavior and fallback mechanisms. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
2 parents be13ac8 + f90411d commit 80fbfa1

3 files changed

Lines changed: 81 additions & 10 deletions

File tree

‎packages/core/platform/templates/bundles/system.yaml‎

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,22 @@
157157
CrashLoop the controller on WaitForCacheSync against missing
158158
GVRs. Operators on hosts that do install Gateway-API CRDs out
159159
of band can enable it via the standard Package values override. */ -}}
160-
{{include "cozystack.platform.package.default" (list "cozystack.ouroboros" $) }}
160+
{{- /* Point the ouroboros proxy at the HOST ingress-nginx Service. The
161+
wrapper chart default (cozy-ingress-nginx / ingress-nginx-controller)
162+
describes a managed Kubernetes tenant cluster, NOT the host: on the
163+
host, extra/ingress deploys ingress-nginx into the root tenant
164+
namespace (publishing.ingressName, default tenant-root) with
165+
fullnameOverride <short>-ingress, yielding the controller Service
166+
<short>-ingress-controller (e.g. root-ingress-controller). Derive
167+
namespace + serviceName from publishing.ingressName so a non-default
168+
ingress name still resolves; mirror the trimPrefix "tenant-"
169+
transform extra/ingress applies to .Release.Namespace. */ -}}
170+
{{- $ingressNs := .Values.publishing.ingressName | default "tenant-root" -}}
171+
{{- $ingressSvc := printf "%s-ingress-controller" (trimPrefix "tenant-" $ingressNs) -}}
172+
{{- $ouroborosTarget := dict "namespace" $ingressNs "serviceName" $ingressSvc -}}
173+
{{- $ouroborosValues := dict "ouroboros" (dict "proxy" (dict "target" $ouroborosTarget)) -}}
174+
{{- $ouroborosComponents := dict "ouroboros" (dict "values" $ouroborosValues) -}}
175+
{{include "cozystack.platform.package" (list "cozystack.ouroboros" "default" $ $ouroborosComponents) }}
161176
{{- end }}
162177
{{include "cozystack.platform.package.default" (list "cozystack.flux-plunger" $) }}
163178
{{include "cozystack.platform.package.default" (list "cozystack.victoria-metrics-operator" $) }}

‎packages/core/platform/tests/bundles_proxy_protocol_test.yaml‎

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,50 @@ tests:
6464
path: spec.variant
6565
value: default
6666

67+
- it: points the host ouroboros proxy at the root-tenant ingress Service (default ingressName)
68+
set:
69+
bundles:
70+
system:
71+
enabled: true
72+
variant: isp-full
73+
publishing:
74+
proxyProtocol: true
75+
documentSelector:
76+
path: metadata.name
77+
value: cozystack.ouroboros
78+
asserts:
79+
# The host ingress-nginx is deployed by extra/ingress into the root
80+
# tenant namespace as <short>-ingress-controller, NOT the chart
81+
# default ingress-nginx-controller.cozy-ingress-nginx (which is the
82+
# managed-Kubernetes-tenant layout). Both are derived from
83+
# publishing.ingressName (default tenant-root).
84+
- equal:
85+
path: spec.components.ouroboros.values.ouroboros.proxy.target.namespace
86+
value: tenant-root
87+
- equal:
88+
path: spec.components.ouroboros.values.ouroboros.proxy.target.serviceName
89+
value: root-ingress-controller
90+
91+
- it: derives the ouroboros proxy target from a non-default publishing.ingressName
92+
set:
93+
bundles:
94+
system:
95+
enabled: true
96+
variant: isp-full
97+
publishing:
98+
proxyProtocol: true
99+
ingressName: tenant-foo
100+
documentSelector:
101+
path: metadata.name
102+
value: cozystack.ouroboros
103+
asserts:
104+
- equal:
105+
path: spec.components.ouroboros.values.ouroboros.proxy.target.namespace
106+
value: tenant-foo
107+
- equal:
108+
path: spec.components.ouroboros.values.ouroboros.proxy.target.serviceName
109+
value: foo-ingress-controller
110+
67111
- it: injects three PROXY-protocol nginx config keys into ingress-application when proxyProtocol is true (use-proxy-protocol, real-ip-header, enable-real-ip)
68112
set:
69113
bundles:

‎packages/system/ouroboros/values.yaml‎

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,26 @@ ouroboros:
3030
# this field for tenants that DO install Gateway-API.
3131
proxy:
3232
target:
33-
# cozystack deploys ingress-nginx into cozy-ingress-nginx in both
34-
# the host control plane and every tenant control plane (the tenant
35-
# HelmRelease sets fullnameOverride: ingress-nginx + targetNamespace:
36-
# cozy-ingress-nginx). Override the chart-default `ingress-nginx`
37-
# namespace; the chart-default serviceName matches as-is. Leaving
38-
# `host:` empty (chart-default) tells the proxy to compose the
39-
# backend host at runtime as
33+
# Tenant-cluster fallback default. A managed Kubernetes tenant
34+
# cluster deploys ingress-nginx into cozy-ingress-nginx (its
35+
# HelmRelease sets fullnameOverride: ingress-nginx +
36+
# targetNamespace: cozy-ingress-nginx), so overriding the
37+
# chart-default `ingress-nginx` namespace to cozy-ingress-nginx
38+
# matches there; the chart-default serviceName lines up as-is.
39+
#
40+
# The HOST is different: extra/ingress deploys ingress-nginx into
41+
# the root tenant namespace (publishing.ingressName, default
42+
# tenant-root) as <short>-ingress-controller (e.g.
43+
# root-ingress-controller), NOT cozy-ingress-nginx. The host
44+
# platform bundle (core/platform templates/bundles/system.yaml)
45+
# therefore overrides proxy.target.{namespace,serviceName} when it
46+
# emits cozystack.ouroboros, derived from publishing.ingressName.
47+
# This default is never effective on the host once that override
48+
# lands.
49+
#
50+
# Leaving `host:` empty (chart-default) tells the proxy to compose
51+
# the backend host at runtime as
4052
# `<serviceName>.<namespace>.svc.<auto-detected-cluster-domain>`,
41-
# which works on cozy.local (cozystack tenants), cluster.local
42-
# (kubeadm), or any other domain without operator override.
53+
# which works on cozy.local (cozystack), cluster.local (kubeadm),
54+
# or any other domain without operator override.
4355
namespace: cozy-ingress-nginx

0 commit comments

Comments
 (0)