Skip to content

Commit d1dddd7

Browse files
committed
fix(computeplane): address review round three
Gate the Proxied ingress Service on _namespace.etcd like the addon HelmRelease it fronts, so an etcd-less tenant with the addon pinned on does not get a selector-less Service (+ test). Correct the secrets framing: the tenant-visible surface is an allowlist (include: [] withholds everything), so drop the never-load-bearing exclude entry, the bats cross-check and the rename-coupling comments, and state the real mechanism. Fix the etcd prerequisite docs (an ancestor's etcd satisfies the wrapped chart; the awaiting-etcd beacon is the diagnostic), reword the tenant toggle to stop advertising the not-yet-shipped placement routing, require maxReplicas >= 1 on the ingress-role node group, and fix comment drift (Service name after the release rename, placement-hook label, package-guard lookup semantics). Assisted-By: Claude <[email protected]> Signed-off-by: Andrei Kvapil <[email protected]>
1 parent 413df59 commit d1dddd7

12 files changed

Lines changed: 66 additions & 62 deletions

File tree

‎api/apps/v1alpha1/tenant/types.go‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎hack/check-computeplane-kubeconfig-exclusion.bats‎

Lines changed: 0 additions & 31 deletions
This file was deleted.

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
{{- $ingress := .Values._namespace.ingress }}
2-
{{- if and .Values.addons.ingressNginx.enabled (eq .Values.addons.ingressNginx.exposeMethod "Proxied") }}
2+
{{- /* The _namespace.etcd gate mirrors the ingress-nginx addon HelmRelease:
3+
on an etcd-less tenant the chart collapses to the awaiting-etcd beacon,
4+
so no addon controller exists and the Service would select nothing. */}}
5+
{{- if and .Values.addons.ingressNginx.enabled .Values._namespace.etcd (eq .Values.addons.ingressNginx.exposeMethod "Proxied") }}
36
{{- if .Values.addons.ingressNginx.hosts }}
47
---
58
apiVersion: networking.k8s.io/v1

‎packages/apps/kubernetes/tests/ingress_proxied_gate_test.yaml‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ release:
1515
set:
1616
_namespace:
1717
ingress: tenant-root
18+
etcd: tenant-root
1819
tests:
1920
- it: renders nothing when the addon is disabled (default)
2021
asserts:
@@ -60,3 +61,21 @@ tests:
6061
asserts:
6162
- hasDocuments:
6263
count: 0
64+
65+
# The addon HelmRelease itself gates on _namespace.etcd (the etcd-less
66+
# render collapses to the awaiting-etcd beacon), so the Service must too —
67+
# otherwise an etcd-less tenant with the addon pinned on (ComputePlane)
68+
# gets the selector-less Service by another route.
69+
- it: renders nothing on an etcd-less tenant even with the addon enabled
70+
set:
71+
_namespace:
72+
ingress: tenant-root
73+
etcd: ""
74+
addons:
75+
ingressNginx:
76+
enabled: true
77+
exposeMethod: Proxied
78+
hosts: []
79+
asserts:
80+
- hasDocuments:
81+
count: 0

‎packages/apps/tenant/README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ tenant-u1
8282
| `ingress` | Deploy own Ingress Controller. | `bool` | `false` |
8383
| `gateway` | Deploy own Gateway API Gateway (backed by Cilium Gateway API controller). When unset (the default), the chart auto-enables the Gateway for tenants whose apex is derived from the parent (i.e. `host` is empty), and leaves it off for tenants with a custom non-derived apex. Set to `true` or `false` explicitly to override that auto-behaviour. Note: leave the key absent (do not write `gateway: null`) — the chart distinguishes "unset" via missing-key, not via null value, to satisfy the JSON schema generated from this comment. | `bool` | `false` |
8484
| `seaweedfs` | Deploy own SeaweedFS. | `bool` | `false` |
85-
| `computeplane` | Deploy own ComputePlane — a single-tenant, Cozystack-managed cluster for untrusted-code applications. Applications with placement: ComputePlane are routed onto it. The tenant receives no admin kubeconfig for it. See design-proposals/compute-plane in cozystack/community. | `bool` | `false` |
85+
| `computeplane` | Deploy own ComputePlane — a single-tenant, Cozystack-managed cluster for untrusted-code applications. The tenant receives no admin kubeconfig for it. Automatic routing of catalog applications onto it (placement: ComputePlane) is a planned follow-up and is not available yet; until it lands, external catalogs target the cluster via its computeplane-cluster-admin-kubeconfig Secret. See design-proposals/compute-plane in cozystack/community. | `bool` | `false` |
8686
| `schedulingClass` | The name of a SchedulingClass CR to apply scheduling constraints for this tenant's workloads. | `string` | `""` |
8787
| `resourceQuotas` | Define resource quotas for the tenant. | `map[string]quantity` | `{}` |
8888

‎packages/apps/tenant/templates/computeplane.yaml‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,11 @@
1717
HelmRelease pointing at a nonexistent ExternalArtifact and retry forever
1818
with no diagnostic. The Capabilities gate keeps the check active in-cluster
1919
(the Package CRD is always installed there) while letting offline renders
20-
(helm template / helm-unittest, where lookup returns nothing) pass.
20+
(helm template / helm-unittest, where lookup returns nothing) pass. Note
21+
the guard deliberately fails closed on a nil lookup once the API group is
22+
discoverable: a client-side `helm template --validate` against a live
23+
cluster would trip it, but no packaging path in this repo renders the
24+
tenant chart that way — Flux renders in-cluster where lookup works.
2125
*/}}
2226
{{- if .Capabilities.APIVersions.Has "cozystack.io/v1alpha1" }}
2327
{{- if not (lookup "cozystack.io/v1alpha1" "Package" "" "cozystack.computeplane-application") }}

‎packages/apps/tenant/values.schema.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
"default": false
3333
},
3434
"computeplane": {
35-
"description": "Deploy own ComputePlane — a single-tenant, Cozystack-managed cluster for untrusted-code applications. Applications with placement: ComputePlane are routed onto it. The tenant receives no admin kubeconfig for it. See design-proposals/compute-plane in cozystack/community.",
35+
"description": "Deploy own ComputePlane — a single-tenant, Cozystack-managed cluster for untrusted-code applications. The tenant receives no admin kubeconfig for it. Automatic routing of catalog applications onto it (placement: ComputePlane) is a planned follow-up and is not available yet; until it lands, external catalogs target the cluster via its computeplane-cluster-admin-kubeconfig Secret. See design-proposals/compute-plane in cozystack/community.",
3636
"type": "boolean",
3737
"default": false
3838
},

‎packages/apps/tenant/values.yaml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ ingress: false
1919
## @param {bool} seaweedfs - Deploy own SeaweedFS.
2020
seaweedfs: false
2121

22-
## @param {bool} computeplane - Deploy own ComputePlane — a single-tenant, Cozystack-managed cluster for untrusted-code applications. Applications with placement: ComputePlane are routed onto it. The tenant receives no admin kubeconfig for it. See design-proposals/compute-plane in cozystack/community.
22+
## @param {bool} computeplane - Deploy own ComputePlane — a single-tenant, Cozystack-managed cluster for untrusted-code applications. The tenant receives no admin kubeconfig for it. Automatic routing of catalog applications onto it (placement: ComputePlane) is a planned follow-up and is not available yet; until it lands, external catalogs target the cluster via its computeplane-cluster-admin-kubeconfig Secret. See design-proposals/compute-plane in cozystack/community.
2323
computeplane: false
2424

2525
## @param {string} [schedulingClass] - The name of a SchedulingClass CR to apply scheduling constraints for this tenant's workloads.

‎packages/extra/computeplane/README.md‎

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,19 @@ The cluster `HelmRelease` is named `computeplane-cluster` and its release name
1818
is derived from it, so Kamaji writes the admin kubeconfig to the Secret
1919
`computeplane-cluster-admin-kubeconfig` (key `super-admin.svc`) — the derived
2020
contract consumed by the HelmReleases of `placement: ComputePlane`
21-
applications, and the exact name this module's `ApplicationDefinition`
22-
withholds from tenant-visible secrets.
23-
24-
**Prerequisite:** the tenant must have the `etcd` module enabled. The tenant
25-
Kubernetes machinery — including the cluster-autoscaler that brings up the
26-
default scale-from-zero `md0` node group — is backed by the tenant's etcd;
27-
without it the ComputePlane provisions no workers and gives no diagnostic.
21+
applications. The tenant never sees that Secret: tenant-visible secrets are an
22+
allowlist, and this module's `ApplicationDefinition` includes nothing, which
23+
withholds every Secret in the module's lineage by construction.
24+
25+
**Prerequisite:** an `etcd` module must be available to the tenant — its own,
26+
or one inherited from an ancestor tenant (the `_namespace.etcd` context
27+
propagates down the tenant tree, so enabling a redundant local etcd is not
28+
required). The tenant Kubernetes machinery — including the cluster-autoscaler
29+
that brings up the default scale-from-zero `md0` node group — is backed by
30+
that etcd; without it the wrapped chart collapses to its `awaiting-etcd`
31+
status beacon and the ComputePlane provisions no control plane or workers
32+
(the HelmReleases still report Ready over the empty shell, so check for the
33+
beacon ConfigMap when nothing comes up).
2834

2935
See the full design in
3036
[cozystack/community design-proposals/compute-plane](https://github.com/cozystack/community/tree/main/design-proposals/compute-plane).

‎packages/extra/computeplane/templates/cluster.yaml‎

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,10 @@
1616
Kamaji therefore writes the cluster's admin kubeconfig to the Secret
1717
`computeplane-cluster-admin-kubeconfig` (key super-admin.svc) — the derived
1818
contract consumed by the HelmReleases of `placement: ComputePlane`
19-
applications, and the exact name computeplane-rd withholds from
20-
tenant-visible secrets. Renaming this object renames the Secret and breaks
21-
both; don't.
19+
applications. The tenant never sees it: tenant-visible secrets are an
20+
allowlist (computeplane-rd declares include: [], which withholds
21+
everything), so the withholding is rename-proof by construction. Renaming
22+
this object still renames the Secret and dangles every consumer; don't.
2223

2324
Everything security-relevant is fixed here and unreachable by the tenant:
2425
the tenant holds no admin kubeconfig for this cluster and the module exposes
@@ -41,12 +42,12 @@
4142
{{- if .Values.nodeGroups }}
4243
{{- $hasIngressRole := false }}
4344
{{- range $name, $group := .Values.nodeGroups }}
44-
{{- if has "ingress-nginx" (default (list) $group.roles) }}
45+
{{- if and (has "ingress-nginx" (default (list) $group.roles)) (gt (int (default 0 $group.maxReplicas)) 0) }}
4546
{{- $hasIngressRole = true }}
4647
{{- end }}
4748
{{- end }}
4849
{{- if not $hasIngressRole }}
49-
{{- fail "computeplane: at least one nodeGroup must carry roles: [ingress-nginx] — the module pins the ingress-nginx addon on, and its controller only schedules onto ingress-nginx nodes" }}
50+
{{- fail "computeplane: at least one nodeGroup must carry roles: [ingress-nginx] with maxReplicas >= 1 — the module pins the ingress-nginx addon on, and its controller only schedules onto ingress-nginx nodes" }}
5051
{{- end }}
5152
{{- end }}
5253
apiVersion: helm.toolkit.fluxcd.io/v2
@@ -55,6 +56,9 @@ metadata:
5556
name: computeplane-cluster
5657
labels:
5758
sharding.fluxcd.io/key: tenants
59+
# No in-tree reader yet: this is the selector hook for the deferred
60+
# placement: ComputePlane routing in cozystack-api (and for operators
61+
# locating ComputePlane cluster releases) — do not remove as dead.
5862
internal.cozystack.io/computeplane: "true"
5963
spec:
6064
chartRef:
@@ -102,8 +106,9 @@ spec:
102106
enabled: true
103107
# Expose the ComputePlane ingress-nginx via the Proxied NodePort Service so a
104108
# ComputePlane app's per-app management Ingress can route to it without a
105-
# management LoadBalancer. The Service (computeplane-ingress-nginx) is created
106-
# whenever exposeMethod is Proxied, independent of any hosts list.
109+
# management LoadBalancer. The Service (computeplane-cluster-ingress-nginx,
110+
# named after the cluster release) is created whenever the addon is enabled
111+
# with exposeMethod Proxied, independent of any hosts list.
107112
exposeMethod: Proxied
108113
{{- with .Values.nodeGroups }}
109114
nodeGroups: {{- toYaml . | nindent 6 }}

0 commit comments

Comments
 (0)