Skip to content

Commit 7e65f73

Browse files
committed
fix(kubernetes): render the Proxied ingress Service only when the addon is enabled
exposeMethod defaults to Proxied while the addon defaults to off, so gating the Service on exposeMethod alone emitted a selector-less Service — surfaced in the tenant dashboard — on every cluster that runs no ingress-nginx at all. Gate on the addon instead; ComputePlane sets enabled: true explicitly, and the Service still renders without a hosts list. Assisted-By: Claude <[email protected]> Signed-off-by: Andrei Kvapil <[email protected]>
1 parent 565e1c6 commit 7e65f73

2 files changed

Lines changed: 57 additions & 5 deletions

File tree

‎packages/apps/kubernetes/templates/ingress.yaml‎

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{{- $ingress := .Values._namespace.ingress }}
2-
{{- if eq .Values.addons.ingressNginx.exposeMethod "Proxied" }}
2+
{{- if and .Values.addons.ingressNginx.enabled (eq .Values.addons.ingressNginx.exposeMethod "Proxied") }}
33
{{- if .Values.addons.ingressNginx.hosts }}
44
---
55
apiVersion: networking.k8s.io/v1
@@ -44,10 +44,13 @@ spec:
4444
{{- end }}
4545
{{- end }}
4646
---
47-
# The proxy Service is created whenever exposeMethod is Proxied (independent of
48-
# `hosts`) so that external consumers — e.g. a ComputePlane app's per-app management
49-
# Ingress — can route to the tenant cluster's ingress-nginx without the tenant module
50-
# having to know every app host in advance.
47+
# The proxy Service is created whenever the addon is enabled with exposeMethod
48+
# Proxied (independent of `hosts`) so that external consumers — e.g. a ComputePlane
49+
# app's per-app management Ingress — can route to the tenant cluster's ingress-nginx
50+
# without the tenant module having to know every app host in advance. The addon
51+
# gate matters: exposeMethod defaults to Proxied while the addon defaults to off,
52+
# so gating on exposeMethod alone would emit a selector-less Service on every
53+
# cluster that runs no ingress-nginx at all.
5154
apiVersion: v1
5255
kind: Service
5356
metadata:
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
suite: proxied ingress Service gates on the addon, not on hosts
2+
# exposeMethod defaults to Proxied while addons.ingressNginx.enabled defaults
3+
# to false, so the Service must render only when the addon is actually on —
4+
# otherwise every cluster without ingress-nginx grows a Service whose selector
5+
# (node-role.kubernetes.io/ingress-nginx) matches no pods, and kubernetes-rd
6+
# surfaces it in the tenant dashboard advertising ports that route nowhere.
7+
# The Service intentionally does NOT require `hosts`: a ComputePlane app's
8+
# per-app management Ingress routes to it without the module knowing app hosts
9+
# in advance.
10+
templates:
11+
- templates/ingress.yaml
12+
release:
13+
name: kubernetes-alice
14+
namespace: tenant-alice
15+
set:
16+
_namespace:
17+
ingress: tenant-root
18+
tests:
19+
- it: renders nothing when the addon is disabled (default)
20+
asserts:
21+
- hasDocuments:
22+
count: 0
23+
24+
- it: renders the Service (and no Ingress) when enabled with Proxied and no hosts
25+
set:
26+
addons:
27+
ingressNginx:
28+
enabled: true
29+
exposeMethod: Proxied
30+
hosts: []
31+
asserts:
32+
- hasDocuments:
33+
count: 1
34+
- isKind:
35+
of: Service
36+
- equal:
37+
path: metadata.name
38+
value: kubernetes-alice-ingress-nginx
39+
40+
- it: renders Ingress and Service when enabled with Proxied and hosts
41+
set:
42+
addons:
43+
ingressNginx:
44+
enabled: true
45+
exposeMethod: Proxied
46+
hosts: ["app.example.com"]
47+
asserts:
48+
- hasDocuments:
49+
count: 2

0 commit comments

Comments
 (0)