mirror of
https://github.com/cozystack/cozystack.git
synced 2026-11-21 12:13:55 +09:00
The TenantGateway controller withheld the HTTPS-terminate listener for a name a passthrough listener answers only once a TLSRoute was attached there and resolved a backend, mirroring how Cilium builds its filter chains. That kept a served endpoint up on Cilium 1.19.5, but it tied every route's status to one implementation's translator and needed Service and ReferenceGrant watches to land the deferred decision. The shipped operator accepts a wildcard terminate listener beside a narrower passthrough listener on 443 and keeps conflicting every other overlap. A terminate listener for the passthrough name itself is not narrower, so on 443 the rule now protects the dataplane outright; on a native port Gateway API would serve the pair, and the rule holds as a policy that keeps a platform name with its passthrough listener. Reading it off the spec makes the outcome the same on every implementation. Under http01 an HTTPRoute claiming such a name gets no listener and no certificate whether or not a TLSRoute is attached. A route whose every hostname is reserved reads Accepted=False with NoMatchingListenerHostname; one that also claims a free hostname stays Accepted and is served there, as Gateway API accepts a route whose hostnames intersect at least one listener. dns01 and existingSecret are unchanged: their wildcard listener still covers such a name, and the passthrough listener answers it by its exact server name. The chart writes the passthrough services on the publishing tenant alone, so the names reserved by default are the ones the platform publishes there through its own TLSRoutes. The shape an upgrade changes is an HTTPRoute on such a name whose platform TLSRoute forwards nowhere, because it never attached (the package owning the service is not installed) or because none of its backends resolve: that route kept a terminate listener and now gets none. The backend resolution, its watches and the RBAC rules that served them go away. Assisted-by: LLM Signed-off-by: Aleksei Sviridkin <f@lex.la>
76 lines
3.8 KiB
YAML
76 lines
3.8 KiB
YAML
kind: ClusterRole
|
|
apiVersion: rbac.authorization.k8s.io/v1
|
|
metadata:
|
|
name: cozystack-controller
|
|
rules:
|
|
- apiGroups: ['cozystack.io', 'gateway.cozystack.io']
|
|
resources: ['*']
|
|
verbs: ['*']
|
|
# TenantGatewayReconciler renders Gateway / HTTPRoute / TLSRoute and
|
|
# reads back their status to populate TenantGateway.Status.
|
|
- apiGroups: ["gateway.networking.k8s.io"]
|
|
resources: ["gateways", "httproutes", "tlsroutes"]
|
|
verbs: ["get", "list", "watch", "create", "update", "patch", "delete"]
|
|
- apiGroups: ["gateway.networking.k8s.io"]
|
|
resources: ["gateways/status", "httproutes/status", "tlsroutes/status"]
|
|
verbs: ["get", "update", "patch"]
|
|
# Read-only, to report a class whose supportedFeatures leave out a
|
|
# route kind the tenant Gateway renders listeners for.
|
|
- apiGroups: ["gateway.networking.k8s.io"]
|
|
resources: ["gatewayclasses"]
|
|
verbs: ["get", "list", "watch"]
|
|
# TenantGatewayReconciler renders the per-tenant Issuer and the
|
|
# wildcard / per-listener Certificates the Gateway listeners reference.
|
|
- apiGroups: ["cert-manager.io"]
|
|
resources: ["issuers", "certificates"]
|
|
verbs: ["get", "list", "watch", "create", "update", "patch", "delete"]
|
|
# TenantLogRoutingReconciler patches the forced-upgrade request annotations on
|
|
# cozy-monitoring/monitoring-agents when a namespace monitoring label changes.
|
|
- apiGroups: ["helm.toolkit.fluxcd.io"]
|
|
resources: ["helmreleases"]
|
|
verbs: ["get", "list", "watch", "patch", "update"]
|
|
# TapMaterializerReconciler manages the finalizer and materialized-revision
|
|
# annotation on a community tap's OCIRepository. Read (get/list/watch) is
|
|
# covered by the catch-all rule below; the update/patch it needs are scoped to a
|
|
# namespaced Role in cozy-system (see tap-source-role.yaml), since the
|
|
# materializer only ever touches tap sources there. PackageSource writes it
|
|
# performs are already covered by the cozystack.io:*/* rule above.
|
|
# CACertReconciler reconciles TenantProjection sentinels a chart renders and
|
|
# writes their Ready status. It never creates or deletes a sentinel; that is
|
|
# the chart's (helm-controller's) job. No tenant role grants any verb on
|
|
# internal.cozystack.io, which is what keeps sentinels out of tenant reach.
|
|
- apiGroups: ["internal.cozystack.io"]
|
|
resources: ["tenantprojections"]
|
|
verbs: ["get", "list", "watch"]
|
|
- apiGroups: ["internal.cozystack.io"]
|
|
resources: ["tenantprojections/status"]
|
|
verbs: ["get", "update", "patch"]
|
|
- apiGroups: [""]
|
|
resources: ["namespaces"]
|
|
verbs: ["get", "list", "watch", "patch", "update"]
|
|
# TenantQuotaReconciler manages the per-namespace "tenant-quota-allocated"
|
|
# ResourceQuota that enforces each tenant's share of its parent pool, and emits
|
|
# events on the tenant namespace when sub-tenant quotas overcommit the budget.
|
|
- apiGroups: [""]
|
|
resources: ["resourcequotas"]
|
|
verbs: ["get", "list", "watch", "create", "update", "patch", "delete"]
|
|
- apiGroups: [""]
|
|
resources: ["events"]
|
|
verbs: ["create", "patch"]
|
|
# Two reconcilers share this one Secret write grant on the platform controller's
|
|
# own ServiceAccount; it widens no tenant's RBAC. WildcardSecretReconciler
|
|
# replicates the operator wildcard TLS Secret into each tenant namespace;
|
|
# CACertReconciler writes — and withdraws — the key-free "<release>.tenant-ca"
|
|
# projection, deleting only a projection it owns by owner reference, never a
|
|
# foreign Secret. Read was already covered by the catch-all rule below;
|
|
# create/update/patch/delete are the new grants.
|
|
- apiGroups: [""]
|
|
resources: ["secrets"]
|
|
verbs: ["get", "list", "watch", "create", "update", "patch", "delete"]
|
|
# Leader election (--leader-elect) is granted by a namespaced Role in cozy-system
|
|
# (see leader-election-role.yaml): the Lease lives in the controller's own
|
|
# namespace, so the write does not need to reach every namespace.
|
|
- apiGroups: ['*']
|
|
resources: ['*']
|
|
verbs: ["get", "list", "watch"]
|